pyqpanda.Visualization.parameterexpression

ParameterExpression Class to enable creating simple expressions of Parameters.

Classes

ParameterExpression

ParameterExpression class to enable creating expressions of Parameters.

Module Contents

class pyqpanda.Visualization.parameterexpression.ParameterExpression(symbol_map, expr)[源代码]

ParameterExpression class to enable creating expressions of Parameters.

property parameters[源代码]

Returns a set of the unbound Parameters in the expression.

bind(parameter_values)[源代码]

Binds the provided set of parameters to their corresponding values.

Args:
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:
ParameterExpression:

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

subs(parameter_map)[源代码]

Returns a new Expression with replacement Parameters.

Args:
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:
ParameterExpression: a new expression with the specified parameters

replaced.