Systems (qiskit_dynamics.systems)

This module provides high level interfaces for building and solving models of quantum systems. Where the solvers and models modules provide interfaces for defining and solving systems in terms of user-defined arrays, this module provides tools for building descriptions of systems in terms of tensor-factor subsystems, an algebraic system for defining operators on subsystems, a high level class representing an abstract dynamical model of a quantum system, and tools for analysing results. The ultimate purpose of the module is to minimize the need for a user to work explicitly with building and manipulating arrays and array indexing, which can be time consuming and prone to error. See the Systems Modelling Tutorial and the How-to use advanced system modelling functionality for detailed examples.

The core building block of a model is a Subsystem, which represents a single finite-dimensional complex vector space on which to define the model of a quantum system. A single model may be defined on multiple subsystems, in which each subsystem represents a tensor factor in a tensor-product space.

Q0 = Subsystem(name="Q0", dim=2)
Q1 = Subsystem(name="Q0", dim=2)

Abstract operators acting on these subsystems can be defined as follows:

X0 = X(Q0)
Y1 = Y(Q1)

Using algebraic operations, new operators may be defined. For example, the tensor product of X on Q0 and Y on Q1 can be constructed through matrix multiplication:

X0 @ Y1

Similarly, the sum of these operators can be constructed through addition X0 + Y1. To facilitate working with operators on subsystems without needing to always specify the full context of all subsystems in a given model, operators are always assumed to act as the identity on all unspecified subsystems, similar to the common mathematical notation in which an operator \(a_2\) means “the operator \(a\) acting on subsystem \(2\) and the identity on all others”.

The matrix of an abstract operator can be built by calling the matrix method. The specific ordering of the tensor factors desired can be supplied, e.g.:

(X0 @ Y1).matrix(ordered_subsystems=[Q0, Q1])

If no explicitly ordering is supplied, the default internal ordering built during the construction of the operator will be used. In addition to a set of pre-defined operators, users can instantiate a SubsystemOperator instance with an arbitrary concrete matrix which acts on an arbitrary list of Subsystem instances.

Operators can be assumbled into models of quantum systems using the QuantumSystemModel class. For example, a model of a standard qubit can be built as follows:

q0_model = QuantumSystemModel(
    static_hamiltonian=2 * np.pi * 5. * N(Q0),
    drive_hamiltonians=[2 * np.pi * 0.1 * X(Q0)],
    drive_hamiltonian_coefficients=["d0"]
)

This model can now be solved with a single call:

results = q0_model.solve(
    signals={"d0": Signal(1., carrier_freq=5.)},
    t_span=t_span,
    t_eval=t_eval,
    y0=y0
)

with results being the standard OdeResult object returned by Qiskit Dynamics solvers.

In addition to the functionality above, this module contains the SubsystemMapping class for defining linear maps between tensor factor spaces given as lists of Subsystem instances. As shown in the How-to use advanced system modelling functionality userguide entry, this class can be used to define injections of subspaces into larger spaces, or to restrict a model to a subspace of interest.

Furthermore, the ONBasis and DressedBasis classes represent bases for subspaces on tensor product spaces represented by lists of Subsystem instances.

System modelling classes

Subsystem(name, dim)

A Hilbert space with a name and a dimension.

SubsystemOperator(matrix, subsystems[, ...])

A concrete operator specified in terms of a matrix.

FunctionOperator(func, operator[, func_name])

A function applied on an operator.

ONBasis(subsystems[, basis_vectors, labels])

Represents a list of orthonormal vectors.

DressedBasis(subsystems, basis_vectors, evals)

A basis with labels of the form {"index": index, "eval": eval}, where each eval is a float representing an eigenvalue.

SubsystemMapping(matrix, in_subsystems[, ...])

A linear mapping from a list of subsystems representing a tensor product space to another.

QuantumSystemModel([static_hamiltonian, ...])

Quantum system model class.

IdealQubit(subsystem, frequency, drive_strength)

Simple dynamical model of a quantum system.

DuffingOscillator(subsystem, frequency, ...)

Duffing oscillator.

ExchangeInteraction(subsystems, g)

An exchange interaction between two systems.

Pre-defined operators

I(subsystems)

The identity operator.

X(subsystems)

X operator.

Y(subsystems)

Y operator.

Z(subsystems)

Z operator.

N(subsystems)

The number operator.

A(subsystems)

Annihilation operator.

Adag(subsystems)

Creation operator.