Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

ParameterExpression

ParameterExpression(symbol_map, expr) GitHub(opens in a new tab)

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.

Parameters

  • symbol_map (dict) – Mapping of Parameter instances to the sympy.Symbol serving as their placeholder in expr.
  • expr (sympy.Expr) – Expression of sympy.Symbols.

Attributes

parameters

Returns a set of the unbound Parameters in the expression.


Methods

__mul__

ParameterExpression.__mul__(other)

bind

ParameterExpression.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.

Returns

a new expression parameterized by any parameters

which were not bound by parameter_values.

Return type

ParameterExpression

subs

ParameterExpression.subs(parameter_map)

Returns a new Expression with replacement Parameters.

Parameters

parameter_map (dict) – Mapping from Parameters in self to the Parameter instances with which they should be replaced.

Raises

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.

Returns

a new expression with the specified parameters

replaced.

Return type

ParameterExpression

Was this page helpful?