GeneratorModel#

class GeneratorModel(static_operator=None, operators=None, signals=None, rotating_frame=None, in_frame_basis=False, evaluation_mode='dense')[source]#

Bases: BaseGeneratorModel

A model for a a linear matrix differential equation in standard form.

GeneratorModel is a concrete instance of BaseGeneratorModel, where the map \(\Lambda(t, y)\) is explicitly constructed as:

\[ \begin{align}\begin{aligned}\Lambda(t, y) = G(t)y,\\G(t) = \sum_i s_i(t) G_i + G_d\end{aligned}\end{align} \]

where the \(G_i\) are matrices (represented by Operator or Array objects), the \(s_i(t)\) are signals represented by a list of Signal objects, and \(G_d\) is the constant-in-time static term of the generator.

Initialize.

Parameters:
  • static_operator (Optional[Array]) – Constant part of the generator.

  • operators (Optional[Array]) – A list of operators \(G_i\).

  • signals (Union[SignalList, List[Signal], None]) – Stores the terms \(s_i(t)\). While required for evaluation, GeneratorModel signals are not required at instantiation.

  • rotating_frame (Union[Operator, Array, RotatingFrame, None]) – Rotating frame operator.

  • in_frame_basis (bool) – Whether to represent the model in the basis in which the rotating frame operator is diagonalized.

  • evaluation_mode (str) – Evaluation mode to use. Supported options are 'dense' and 'sparse'. Call help(GeneratorModel.evaluation_mode) for more details.

Raises:

QiskitError – If model not sufficiently specified.

Methods

copy()#

Return a copy of self.

evaluate(time)[source]#

Evaluate the model in array format as a matrix, independent of state.

Parameters:

time (float) – The time to evaluate the model at.

Returns:

The evaluated model as a matrix.

Return type:

Array

Raises:

QiskitError – If model cannot be evaluated.

evaluate_rhs(time, y)[source]#

Evaluate G(t) @ y.

Parameters:
  • time (float) – The time to evaluate the model at .

  • y (Array) – Array specifying system state.

Return type:

Array

Returns:

Array defined by \(G(t) \times y\).

Raises:

QiskitError – If model cannot be evaluated.

Attributes

dim#

The matrix dimension.

evaluation_mode#

Numerical evaluation mode of the model.

Possible values:

  • "dense": Stores/evaluates operators using dense Arrays.

  • "sparse": Stores/evaluates operators using sparse matrices. If the default Array backend is JAX, implemented with JAX BCOO arrays, otherwise uses scipy csr_matrix sparse type. Note that JAX sparse mode is only recommended for use on CPU.

Raises:
  • NotImplementedError – If, when being set, new_mode is not one of the above supported

  • evaluation modes.

in_frame_basis#

Whether the model is represented in the basis that diagonalizes the frame operator.

operators#

The operators in the model.

rotating_frame#

The rotating frame.

This property can be set with a RotatingFrame instance, or any valid constructor argument to this class.

Setting this property updates the internal operator to use the new frame.

signals#

The signals in the model.

Raises:

QiskitError – If set to None when operators exist, or when set to a number of signals different then the number of operators.

static_operator#

The static operator.