ParameterExpression#

class qiskit.circuit.ParameterExpression(symbol_map, expr)[código fonte]#

Bases: object

ParameterExpression class to enable creating expressions of Parameters.

Create a new ParameterExpression.

Not intended to be called directly, but to be instantiated via operations on other Parameter or ParameterExpression objects.

Parâmetros:

Attributes

parameters#

Returns a set of the unbound Parameters in the expression.

Methods

abs()[código fonte]#

Absolute of a ParameterExpression

arccos()[código fonte]#

Arccos of a ParameterExpression

arcsin()[código fonte]#

Arcsin of a ParameterExpression

arctan()[código fonte]#

Arctan of a ParameterExpression

assign(parameter, value)[código fonte]#

Assign one parameter to a value, which can either be numeric or another parameter expression.

Parâmetros:
Retorno:

A new expression parameterized by any parameters which were not bound by assignment.

Tipo de retorno:

ParameterExpression

bind(parameter_values, allow_unknown_parameters=False)[código fonte]#

Binds the provided set of parameters to their corresponding values.

Parâmetros:
  • parameter_values (dict) – Mapping of Parameter instances to the numeric value to which they will be bound.

  • allow_unknown_parameters (bool) – If False, raises an error if parameter_values contains Parameters in the keys outside those present in the expression. If True, any such parameters are simply ignored.

Levanta:
  • CircuitError

    • If parameter_values contains Parameters outside those in self. - If a non-numeric value is passed in parameter_values.

  • ZeroDivisionError

    • If binding the provided values requires division by zero.

Retorno:

A new expression parameterized by any parameters which were not bound by parameter_values.

Tipo de retorno:

ParameterExpression

conjugate()[código fonte]#

Return the conjugate.

Tipo de retorno:

ParameterExpression

cos()[código fonte]#

Cosine of a ParameterExpression

exp()[código fonte]#

Exponential of a ParameterExpression

gradient(param)[código fonte]#

Get the derivative of a parameter expression w.r.t. a specified parameter expression.

Parâmetros:

param (Parameter) – Parameter w.r.t. which we want to take the derivative

Retorno:

ParameterExpression representing the gradient of param_expr w.r.t. param or complex or float number

Tipo de retorno:

ParameterExpression | complex

is_real()[código fonte]#

Return whether the expression is real

log()[código fonte]#

Logarithm of a ParameterExpression

sin()[código fonte]#

Sine of a ParameterExpression

subs(parameter_map, allow_unknown_parameters=False)[código fonte]#

Returns a new Expression with replacement Parameters.

Parâmetros:
  • parameter_map (dict) – Mapping from Parameters in self to the ParameterExpression instances with which they should be replaced.

  • allow_unknown_parameters (bool) – If False, raises an error if parameter_map contains Parameters in the keys outside those present in the expression. If True, any such parameters are simply ignored.

Levanta:

CircuitError

  • If parameter_map contains Parameters outside those in self. - If the replacement Parameters in parameter_map would result in a name conflict in the generated expression.

Retorno:

A new expression with the specified parameters replaced.

Tipo de retorno:

ParameterExpression

sympify()[código fonte]#

Return symbolic expression as a raw Sympy or Symengine object.

Symengine is used preferentially; if both are available, the result will always be a symengine object. Symengine is a separate library but has integration with Sympy.

Nota

This is for interoperability only. Qiskit will not accept or work with raw Sympy or Symegine expressions in its parameters, because they do not contain the tracking information used in circuit-parameter binding and assignment.

tan()[código fonte]#

Tangent of a ParameterExpression