Parameter
class Parameter(name)
Bases: qiskit.circuit.parameterexpression.ParameterExpression
Parameter Class for variable parameters.
Create a new named Parameter
.
Parameters
name (str
) – name of the Parameter
, used for visual representation. This can be any unicode string, e.g. “ϕ”.
Methods
arccos
Parameter.arccos()
Arccos of a ParameterExpression
arcsin
Parameter.arcsin()
Arcsin of a ParameterExpression
arctan
Parameter.arctan()
Arctan of a ParameterExpression
assign
Parameter.assign(parameter, value)
Assign one parameter to a value, which can either be numeric or another parameter expression.
Parameters
- parameter (Parameter) – A parameter in this expression whose value will be updated.
- value (
Union
[ParameterExpression
,float
]) – The new value to bind to.
Return type
ParameterExpression
Returns
A new expression parameterized by any parameters which were not bound by assignment.
bind
Parameter.bind(parameter_values)
Binds the provided set of parameters to their corresponding values.
Parameters
parameter_values (Dict
) – Mapping of Parameter instances to the numeric value to which they will be bound.
Raises
-
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.
Return type
ParameterExpression
Returns
A new expression parameterized by any parameters which were not bound by parameter_values.
conjugate
Parameter.conjugate()
Return the conjugate.
Return type
ParameterExpression
cos
Parameter.cos()
Cosine of a ParameterExpression
exp
Parameter.exp()
Exponential of a ParameterExpression
gradient
Parameter.gradient(param)
Get the derivative of a parameter expression w.r.t. a specified parameter expression.
Parameters
param (Parameter) – Parameter w.r.t. which we want to take the derivative
Return type
Union
[ParameterExpression
, complex
]
Returns
ParameterExpression representing the gradient of param_expr w.r.t. param or complex or float number
is_real
Parameter.is_real()
Return whether the expression is real
log
Parameter.log()
Logarithm of a ParameterExpression
sin
Parameter.sin()
Sine of a ParameterExpression
subs
Parameter.subs(parameter_map)
Substitute self with the corresponding parameter in parameter_map
.
tan
Parameter.tan()
Tangent of a ParameterExpression
Attributes
name
Returns the name of the Parameter
.
parameters
Returns a set of the unbound Parameters in the expression.
Return type
Set