3.1.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 Expression(*args, **kwargs)[source]

Bases: Hashable, Protocol

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

evaluate_in_scope(scope: Mapping) Real | 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]) Expression[source]

Substitute a part of the expression for another

evaluate_time_dependent(scope: Mapping) Expression | Real | ndarray[source]

Evaluate to a time dependent expression or a constant.

get_serialization_data()[source]
classmethod make(expression_or_dict, numpy_evaluation=None) 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 ExpressionScalar(*args, **kwargs)[source]

Bases: Expression, Scalar, Ordered, Protocol

class ExpressionVector(*args, **kwargs)[source]

Bases: Expression, Protocol

class Ordered(*args, **kwargs)[source]

Bases: Protocol

class Scalar(*args, **kwargs)[source]

Bases: Protocol