3.2.1. qupulse.expressions.protocol

This module contains the interface / protocol descriptions of Expression, ExpressionScalar and ExpressionVector.

Classes

Expression(*args, **kwargs)

This protocol defines how Expressions are allowed to be used in qupulse.

ExpressionScalar(*args, **kwargs)

ExpressionVector(*args, **kwargs)

Ordered(*args, **kwargs)

Scalar(*args, **kwargs)

class qupulse.expressions.protocol.Expression(*args, **kwargs)[source]

Bases: Hashable, Protocol

This protocol defines how Expressions are allowed to be used in qupulse.

evaluate_in_scope(scope: Mapping) Union[numbers.Real, numpy.ndarray][source]

Evaluate the expression by taking the variables from the given scope (typically of type Scope, but it can be any mapping.) :param scope:

Returns:

evaluate_symbolic(substitutions: Mapping[str, Any]) qupulse.expressions.protocol.Expression[source]

Substitute a part of the expression for another

evaluate_time_dependent(scope: Mapping) Union[qupulse.expressions.protocol.Expression, numbers.Real, numpy.ndarray][source]

Evaluate to a time dependent expression or a constant.

get_serialization_data()[source]
classmethod make(expression_or_dict, numpy_evaluation=None) qupulse.expressions.protocol.Expression[source]

Backward compatible expression generation to allow creation from dict.

property underlying_expression: Any

Return some internal unspecified representation

property variables: Sequence[str]

Get all free variables in the expression.

Returns

A collection of all free variables occurring in the expression.

class qupulse.expressions.protocol.ExpressionScalar(*args, **kwargs)[source]

Bases: qupulse.expressions.protocol.Expression, qupulse.expressions.protocol.Scalar, qupulse.expressions.protocol.Ordered, Protocol

class qupulse.expressions.protocol.ExpressionVector(*args, **kwargs)[source]

Bases: qupulse.expressions.protocol.Expression, Protocol

class qupulse.expressions.protocol.Ordered(*args, **kwargs)[source]

Bases: Protocol

class qupulse.expressions.protocol.Scalar(*args, **kwargs)[source]

Bases: Protocol