Skip to content

qruise-toolset

qruise.toolset.hamiltonian

Docstring for the hamiltonian.py module.

Anything that is related to the definition of the Hamiltonian of a quantum system.

Hamiltonian

Declaring the Hamiltonian of a system of interest.

This instantiates a Hamiltonian object with time-indepedent part specified by H0 and time-dependent parts drives passed as a list of tuples with the first element the basis and the second element as its time-dependent coefficient.

Parameters:

Name Type Description Default
H0 Array | Qobj

JAX matrix or a Qobj representing the time-independent part of the Hamiltonion.

_A
Ht List[Tuple[Array | Qobj, Callable]]

List of tuples with the first element being the basis and the second being the time-dependent coefficient.

_A

Attributes:

Name Type Description
H0 Array

JAX array signifying the time-independent part of the Hamiltonian.

coeffs List[Callable]

List of callable functions defining the coefficients of the time-dependent part of the Hamiltonian.

hamils List[Array]

List of JAX arrays which in combination with coeffs specifies the operators of the time-depenedent parts of the Hamiltonian.

Methods:

Name Description
add_term

add a time-dependent part to the Hamiltonian

__call__(A, t, params)

Return the Hamiltonian at a given instance of time.

Parameters:

Name Type Description Default
t float | Array

An instance of time.

required
params Dict[str, float]

Dictiorary of parameters that is passed to the envelopes of the Hamiltonian's terms.

required

Returns:

Type Description
Array

The Hamiltonian matrix.

add_term(A, hamil, coeff)

Method to add extra terms to the base Hamiltonian.

Given the basis hamil and its coefficient coeff a new time-depenedent part will be added to the Hamiltonian.

Parameters:

Name Type Description Default
hamil Array | Qobj

Hamiltonian matrix operator.

required
coeff Callable

Callable function as the coefficient of the Hamiltonian channel hamil, usually time-dependent.

required

qruise.toolset.control_stack

Docstring for the control_stack.py module.

Module for defining the functional behaviour of different control electronics in a control stack.

Every component falls into two categories: (i) it is either a source, i.e. it produces a signal, or (ii) it transforms the input signal from a source. These components can be represented by a function. The reason we use classes here is due to the fact that some transformations are non-local in time. Therefore some memory kernels or internal states must be tracked.

ADC

Bases: SignalChainComponent

Analogue-to-Digital component.

It discretise the input up to a precision indicated by the number of bits. The ADC component is limited to a range of operation voltage, namely \(V_{min}\) and \(V_{max}\). Mathematically, it transforms an input signal \(f(t)\) via

\[ \begin{gather} \delta = \frac{V_{max} - V_{min}}{2^n - 1}\\ f_{d}(t) = V_{min} + \Big[\frac{f(t) - V_{min}}{\delta}\Big] \delta \end{gather} \]

where \(n\) is the number of bits, and \(f_d(t)\) is the digitised representation of the function \(f(t)\).

__call__(signal, nob, min_range, max_range, alpha=100.0, epsilon=0.001)

Converts a continuous analogue signal to a digital one.

Parameters:

Name Type Description Default
signal ArrayOrFloat

The analogue pulse to be discretised.

required
nob int

Number of bits. Represents how finely the ADC component converts the analogue signal to its digital counterpart.

required
min_range ArrayOrFloat

The minimum voltage resolved by the ADC component.

required
max_range ArrayOrFloat

The maximum voltage resolved by the ADC component.

required
alpha ArrayOrFloat

Approximates the rounding effect. The higher the value, the closer the behaviour is to exact round function.

100.0
epsilon ArrayOrFloat

Threshold for alpha. Set at a very low value. If alpha falls beneath this value, the rounding behaves as the true round function.

0.001

Returns:

Type Description
Array

JAX array of a digitised signal

Gaussian

Bases: SignalChainComponent

Normalised Gaussian pulse.

The mathematical expression is given by

\[ \frac{a}{\sigma\sqrt{2\pi}} \exp [-\frac{(t-\mu)^2}{2\sigma^2}] \]

where \(a\) is a factor that scales the maximum value of the puls, \(\sigma\) is the standard deviation and \(\mu\) is the mean value.

__call__(t, amplitude, mean, sigma)

Generates samples of a normalised Gaussian pulse.

Parameters:

Name Type Description Default
t ArrayOrFloat

Scalar or array of timestapm(s).

required
amplitude ArrayOrFloat

Scaling factor that tunes the maximum value of the Gaussian pulse.

required
mean ArrayOrFloat

Mean value (centre) of the Gaussian pulse.

required
sigma ArrayOrFloat

Standard deviation.

required

Returns:

Type Description
Array

Normalised Gaussian pulse sampled at timestamps t's.

HeaviSide

Bases: SignalChainComponent

Gerenate a Heaviside (step-) functon.

__call__(t, centre=0.0)

Output a Heaviside (step-) function.

The definition is:

\[ H(t) = \left\lbrace \begin{aligned} &0\,,\; &t \lt 0 \\ &1\,,\; &t = 0 \\ &1\,,\; &t \gt 0 \end{aligned} \right. \]

Parameters:

Name Type Description Default
t ArrayOrFloat

Time instance t.

required
centre float

Centre of the Heaviside function.

0.0

Returns:

Type Description
Array

Step function signal.

LocalOscillator

Bases: SignalChainComponent

Local oscillator.

Generates pure sine function given by

\[ f(t; \{\omega\}) = \sin(\omega t). \]

where \(\omega\) is the frequency and \(t\) is an instance of time.

__call__(t, frequency, phase=0.0)

Generates a pure sine function.

Parameters:

Name Type Description Default
t ArrayOrFloat

A single or an array of timestamps.

required
frequency ArrayOrFloat

The frequency of the sine function.

required
phase float

Optional phase of the local oscillator.

0.0

Returns:

Type Description
Array

Array of sine function sampled at t.

SignalChainComponent

Abstract class for declaring a callable function.

Since each component of a control stack acts as a transformer on the input signal, it can be abstracted as a function.

TransferFunction

Bases: SignalChainComponent

Transfer Function modelled in its space-state representation.

State-space representation of transfer function, also known as Rosenbrock system matrix, for dynamical system of the form

\[ \begin{aligned} \dot{x}(t) &= Ax(t) + Bu(t)\\ y(t) &= Cx(t) + Du(t) \end{aligned} \]

is given by the Rosenbrock system matrix as follows

\[ \begin{aligned} P(s) = \begin{pmatrix} sI - A & -B\\ C & D \end{pmatrix}. \end{aligned} \]

As a linear time-invariant systems, transfer functions have state-space reperestation[1].

Parameters:

Name Type Description Default
state Array

JAX array to initialise the internal state of the state-space model.

required

Attributes:

Name Type Description
state Array

JAX array specifying the current internal state of the state-space model.

Methods:

Name Description
reset

Resets the internal state of the state-space model.

update_state

Updates the internal state of the state-space model.

Notes

[1] De Schutter, B., 2000. Minimal state-space realization in linear system theory: an overview. Journal of computational and applied mathematics, 121(1-2), pp.331-354.

__call__(signal, A, B, C, D)

Action of the Transfer Function on the input pulse.

The input pulse signal is transformed according to the state-space representation of the Transfer Function given by matrices A, B, C and D given the initial internal state state.

Parameters:

Name Type Description Default
signal ArrayOrFloat

The signal to be transformed.

required
A Array

The matrix A in the Rosenbrock system matrix.

required
B Array

The matrix B in the Rosenbrock system matrix.

required
C Array

The matrix C in the Rosenbrock system matrix.

required
D Array

The matrix D in the Rosenbrock system matrix.

required

Returns:

Type Description
Array

The transformed signal.

reset(A)

Reset the internal state of the state-space model to zero.

update_state(A, state)

Update the internal state of the state-space model.

Parameters:

Name Type Description Default
state Array

JAX array to update the internal state.

required

qruise.toolset.parameter

Docstring for the parameter.py module.

The intention is to enable the user to effectively and efficiently keeps track of the parameters involved in the simulation of a quantum system. The only and single source of truth on which the user can rely to get current value of the parameters after any mutable operation. This allows other parts of qruise-toolset to remain static.

ParameterCollection

A collection of parameters.

A single source of truth to keep track of parameters to be optimised or parsed anytime anywhere.

Attributes:

Name Type Description
params Dict[str, float]

A dictionary of parameters.

Methods:

Name Description
add_param

Add a key-value pair to the collection.

get_val

Get the value of a given key.

add_dict

Adding an input dictionary as a batch of key-pair values.

get_collection

Returns the collection of parameters.

__repr__(B)

Print nicely all the parameters in the collection.

Returns:

Type Description
str

Nicely formatted string listing all the parameters.

add_dict(A, source_dict)

Add a set of key-value pairs in a batch mode.

Parameters:

Name Type Description Default
source_dict Dict[str, float]

A dictionary of key-value pairs.

required

add_param(B, key, val)

Add a single key-value pair to the parameter collection.

Parameters:

Name Type Description Default
key str

A string specifying the name of the parameter.

required
val float

Value associated with the key.

required

get_collection(A)

Return all the parameters in the collection.

Returns:

Type Description
Dict[str, float]

Dictionary of key-value pairs of the parameters in the collection.

get_val(A, key)

Get the value of a parameter.

Parameters:

Name Type Description Default
key str

The name of the parameter.

required

Returns:

Type Description
float

The value of the parameter.

qruise.toolset.problem

Docstring for the problem.py module.

A Problem defines a set of ordinary differential equations to solve the dynamics of a quantum system given its Hamiltonian. Generally speaking, if the Hamiltonian of a system is known, one can solve the dynamics of a closed quantum system using the Schrödinger equation, or if one deals with an open quantum system, the von Neumann equation or Lindblad equation is the right choice.

EnsembleProblem

Bases: Problem

An ensemble problem.

Parameters:

Name Type Description Default
hamiltonian Hamiltonion

The Hamiltonian of interest.

required
y0_axis Tuple[Array, int | None]

Tuple of initial state and the dimension over which the the batching is assumed.

required
params Tuple[str, ArrayOrFloat]

Simulation parameters provided as an array or a scalar float.

required
time_span Tuple[ArrayOrFloat, ArrayOrFloat]

Simulation time span indicating the starting and ending times. Each element can be either an array or a scalar float.

required

Attributes:

Name Type Description
hamiltonian Hamiltonian

System's Hamiltonian.

y0 Array

The initial quantum state(s).

params Dict[str, ArrayOrFloat]

Simulation parameters

time_span Tuple[ArrayOrFloat, ArrayOrFloat]

Simulation time span; tuple of starting and ending times. Can be either an array or a scalar float.

problem(A)

Provide an AbstractSolver with necessary inputs for a simulation.

Returns:

Name Type Description
Tuple Tuple[Array, Dict[str, ArrayOrFloat], Tuple[ArrayOrFloat, ArrayOrFloat], InAxes]

A tuple with the first element as the initial quantum state, the second as a dictionary of parameters, the third as a simulation time span and the last as the axes description for JAX vectorisation map.

Problem

Generic class for specifying a quantum simulation problem.

Parameters:

Name Type Description Default
hamiltonian Hamiltonian

The Hamiltonian of interest.

required
y0 Array

The initial state of the quantum system.

required
params Dict[str, float]

Parameters that uniquely define the Hamiltonian.

required
time_span Tuple[float, float]

Time interval over which the problem is defined. Basically, the start and end of the simulation.

required

Attributes:

Name Type Description
hamiltonian Hamiltonian

Hamiltonian of the system.

time_span Tuple[float]

The time interval of the simulation.

y0 Array

Initial quantum state.

time_span Tuple[float, float]

Simulation starting and ending times.

dimension Int

Size of the Hilbert space.

Methods:

Name Description
problem

Return a tuple of initial condition, parameters and simulation time span.

schroedinger

System of ODEs for the Schrödinger equation.

von_neumann

System of ODEs for the von Neumann master equation.

lindblad

System of ODEs for the Lindblad equation.

sepwc

System of equations for piece-wise constant Schrödinger equation.

mepwc

System of equations for piece-wise constant master equation.

lindblad(E, c_ops)

Return the Lindblad master equation.

The Lindblad master equation is given by

\[ i\frac{\partial}{\partial t}\rho_t = [H_t, \rho_t] + \sum_i \gamma_i \left(L_i \rho_t L_i^\dagger - \frac{1}{2}\left\{L_i^\dagger L_i, \rho_t \right\}\right), \]

where \(i\) is the imaginary number, \(\rho_t\) is the density matrix of the system at time \(t\), and \(H_t\) is the Hamiltonian of the system. The notion \([., .]\) stands on the commutation relation, whereas \(\{., .\}\) stands on anti-commutation. The operators \(L_i\) are called collapse operators. We used the convention of setting \(\hbar = 1\).

Parameters:

Name Type Description Default
c_ops List[Qobj | Array]

List of collapse operators as QuTiP objects or JAX arrays.

required

Returns:

Type Description
Callable

ODE defining the Lindblad master equation.

mepwc(A)

Compile an equation for solving a quantum master equation.

Returns:

Name Type Description
Callable Callable

A callable function that solves unitary evolution of a quantum density matrix.

problem(A)

Return the initial condition, parameters and the time span.

Returns:

Type Description
Tuple[Array, Dict[str, float], Tuple[float, float]]:

Tuple with the first element as a initial condition, the second element as the parameter dictionary and the last as a tuple of time span.

schroedinger(A)

Return the Schrödinger equation.

The Schrödinger is given by

\[ i\frac{\partial}{\partial t}|\psi(t)\rangle = H(t)|\psi(t)\rangle, \]

where \(i\) is the imaginary number, \(|\psi(t)\rangle\) is the wave-function of the system at time \(t\), and \(H(t)\) is the Hamiltonian of the system. We used the convention of setting \(\hbar = 1\).

Returns:

Type Description
Callable

ODE defining the Schrödinger equation.

sepwc(A)

Compile an equation for solving the Schrödinger equation.

Returns:

Name Type Description
Callable Callable

A callable function that solves unitary evolution of a quantum state vector.

von_neumann(A)

Return the von Neumann equation.

The von Neumann master equation is given by

\[ i\frac{\partial}{\partial t}\rho(t) = [H(t), \rho(t)], \]

where \(i\) is the imaginary number, \(\rho(t)\) is the density matrix of the system at time \(t\), and \(H(t)\) is the Hamiltonian of the system. The notion \([., .]\) stands on the commutation relation. We used the convention of setting \(\hbar = 1\).

Returns:

Type Description
Callable

ODE defining the von Neumann master equation.

QOCProblem

Bases: Problem

Specify a Quantum Optimal Control problem.

Parameters:

Name Type Description Default
hamiltonian Hamiltonian

The Hamiltonian of interest.

required
y0 Array

The initial state of the quantum system.

required
params Dict[str, float]

Parameters that uniquely define the Hamiltonian.

required
time_span Tuple[float, float]

Time interval over which the problem is defined. Basically, the start and end of the simulation.

required
yt Array

The desired target state.

required
loss Callable

Loss function used for the minimisation problem.

required

Attributes:

Name Type Description
yt Array

The desired target state.

loss Callable

Loss function used for the minimisation problem.

problem(A)

Return values required as the inputs of an optimiser.

Returns:

Type Description
Tuple[Arr, Dict[str, float], Tuple[float, float], Array]:

Tuple of four elements. The first is the initial state, the second is the set of parameters, the third is the simulation time span and the last is the target state.

qruise.toolset.signal_chain

Docstring for the signal_chain.py module.

The module provides necessary structure to simulate a control stack seemlessly using directed trees. For instance consider the following case:

we have a perfect source that generates a Gaussian pulse. The pulse is then modulated by a cosine function and then digitised. This can naturally resembles an arbitrary waveform generator, with a local oscillator and a digital-to-analogue or analogue-to-digital component. Diagrammatically, this can be shown as follows:


| AWG | ------> \ ------- \ \ --------- ------- ------> | Mixer | -----> | DAC | / --------- ------- ------- /

| LO | ------> /

It provides also flexibilities to merge two components into one function. For instance the local oscillator can be encapsulated within the AWG component by writing a suitably modified function. This significantly reduces the complexity of the signal chain.

Signal

Encapsulates the behaviour of a signal chain of control electronics.

Signal chain is modelled by a directed graph where we traverse the graph from the root(s) and pass the output down the graph until we reach the leaf(s). Each node has a name associated with it, along with a function that either produces the signal (source node) or manipulates it (transformer). If a node is a source, it has a signature of f(t, param1, param2, ...), whereas a transformer has a function signature of f(input, param1, param2, ...). The node has also an associated dictionary of parameters.

Parameters:

Name Type Description Default
name str

Name of the signal chain.

'sig1'

Attributes:

Name Type Description
_digraph DiGraph

A networkx DiGraph object.

Methods:

Name Description
add

Add a electronic component with the name name and its action on the pulse given by function. params are the parameters of the function. If an tail component is provided, then an edge is also created between the tail node and the component being added.

add_from

The same as add with the difference that the arguments are lists. It adds mulitple electorinc components passed as a list.

add_edge

Adds an edge between two given nodes.

get_nodes

Returns a list with the components currently existing in the signal chain.

node_update_params

Update the parameters associated with the function of a given node identified by node.

chain_sanity

Check that the signal chain is connected and acyclic.

function

Compiles the stack and returns a single function that traverse the digraph from the root to the leaves.

add(B, name, function, params, tail=_A)

Add a single node.

The node is added along with a given name, a function and the parameters associated with it. Also, optionally create an edge between the added node and another node already in the graph.

Parameters:

Name Type Description Default
name str

The name of the node.

required
function Callable

A function that mimics the behaviour of the electronic component of interest.

required
params Dict[str, Tuple[float, bool]]

A dictionary of parameters where the keys match the signature of the function and its value is a tuple of the value associated with that parameter and the second element being a boolean specifying whether the parameter is optimised or not.

required
tail str

Incident node with out-degree one as the parent of the node being added. If not None, an edge will be added between the tail node and the node being created (head).

_A

add_edge(A, tail, head)

Add an edge between two nodes in the digraph.

Parameters:

Name Type Description Default
tail str

The origin (starting) node.

required
head str

The destination node.

required

add_from(E, names, functions, params)

Add a list of nodes.

For a list of components and their corresponding functions, adds a node and an edge between two consecutive components in the list.

Parameters:

Name Type Description Default
names List[str]

List of strings specifying the name of each node.

required
functions List[Callable]

List of functions associated with each node.

required
params List[Dict[str, Tuple[float, bool]]]

List of parameters passed as dictionaries where the keys match the signature of the corresponding function and the value is a tuple of a number and boolean where the former specifies the value of the parameter and the latter indicates whether that parameter must be optimised or not.

required

chain_sanity(A)

Check that the di-graph is connected and acyclic.

function(B, node=_A)

Compile a function associated with the behaviour of the signal chain.

This method compiles a function with the signature f(t, params) where t is an instance of time at which we are interested to get the profile of the signal, and params is a dictionary of all the parameters in the DiGraph (tree of signal chain) that can be optimised. For back tracing the origin of each parameter, the parameter's name string is prefixed by the name of its node for instance if we have a Gaussian function gauss(t, amp, mean, sigma) associated with the node gauss1, and if amp and sigma are trainable.

Parameters:

Name Type Description Default
node str | int

The node name (string) or node level (integer) up to which the signal will be transformed. If not provided, the signal.

_A

Returns:

Type Description
Tuple[Callable, Dict[str, float]]

A tuple with the first element the function that generates the signal at the source node and traverse the digraph from the root to the leaves and transform the initial source signal. The second element is a dictionary that parametrise the whole signal chain.

get_nodes(A)

Get the nodes within the digraph.

Returns:

Type Description
List[str]

List of the node names that exist in the digraph at the time of the call.

node_update_params(A, node, params)

Update the parameters of a given node.

The parameters of a given node is updated according to the key-value pairs of the input dictionary. The dictionary my contain only a subset of the parameters associated to the input node.

Parameters:

Name Type Description Default
node str

The node name.

required
params Dict[str, Tuple[float, bool]]

Dictionary of parameters with the keys and the values where values are tuple of a number and a boolean where the former is the value of the parameter of interest and the latter specifies whether the parameter must be optimised.

required

qruise.toolset.transforms

Docstring for the transforms.py module.

The sole purpose of this module so to provide the user with utilities to handle optimal control problem efficiently by providing the initial and target states. It provides checks and tools to ensure those states are defined in a sane manner.

Transform

Specify the initial and target states of the Quantum Optimal Control Problem.

Parameters:

Name Type Description Default
input_state Qobj | Array

The initial state.

required
output_state Qobj | Array

The target state.

required

Attributes:

Name Type Description
input_state Qobj | Array

The initial state.

output_state Qobj | Array

The target state.

dims Tuple

Dimension of the initial and target states.

Methods:

Name Description
get_y0_yt

Get the initial state and the target state as a tuple.

get_y0_yt(A)

Helper method to get the initial and target states.

Returns:

Type Description
Tuple[Array, Array]:

Tuple of two elements. The first is the initial state and the second is the target state.

qruise.toolset.solvers.abstract_solver

Abstract solvers and abstract minimisers module.

Contains declaration of two major classes for abstract solvers and optimisers.

AbstractSolver

Bases: ABC

Abstract Solver.

Parameters:

Name Type Description Default
eq Callable

Defines the equation governing the dynamics.

_A

Methods:

Name Description
set_system

Set the equation governing the dynamics.

evolve

Evolve the dynamics of the system.

ensemble_evolve

Evolve the dynamics of an ensemble of systems.

ensemble_evolve(A, y0, params, t_span, in_axes, cartesian=False, compile=False)

Simulate an ensemble problem.

The ensemble simulation can take place over either an ensemble of initial conditions, parameters or simulation time spans.

Parameters:

Name Type Description Default
y0 Array

A JAX array, a tensor of rank 1, 2 or 3. If the rank is 1, no parallelisation takes place.

required
params Dict[str, ArrayOrFloat]

Dictionary of parameters with values passed as either JAX arrays or floats.

required
t_span Tuple[ArrayOrFloat, ArrayOrFloat]

Tuple of the simulation starting and ending points. Passed as either JAX arrays or floats.

required
in_axes InAxes

Tuple of axes that provides jax.vmap method with a pytree structure for an ensemble simulation.

required
cartesian bool

If set to true, compiles a vectorised map function to simulate an ensemble problem and return the result as a an array for a set yielded by the Cartesian product of all the parameters , initial conditions and simulation time spans.

False
compile bool

If the pytree structure of in_axes changes, set to True to compile a new jitted JAX vmapped function that is compatible.

False

Returns:

Name Type Description
Array Array | Solution

Return an \(n\)-dimensional JAX array solution.

evolve(y0, params, t_span) abstractmethod

Solve for the dynamics of a given system.

For a given equation describing the dynamics, this method evolves the state of the system given its initial condition, input parameters and the interval over which the dynamics must be simulated.

Parameters:

Name Type Description Default
y0 Array

Array specifying the initial condition.

required
params Dict[str, float]:

Set of parameters.

required
t_span Tuple[float, float]

Tuple indicating the starting and ending times of the simulation.

required

Returns:

Type Description
Array | Solution:

Result of the dynamics returned as a JAX array or a diffrax solution.

set_system(A, eq)

Set the equation describing the dynamics of the system.

Parameters:

Name Type Description Default
eq Callable

The equation governing the dynamics of the system.

required

qruise.toolset.solvers.solvers

Solvers Module.

Class definitions for Ordinary Differential Equations and Pice-Wise Constant solvers.

The module is compatible with diffrax for solving ODE'. Piece-wise constant solver used in extreme cases when ODE solvers fail to converge (which is quite rare). It uses matrix exponentiation of the Hamiltonian to generates unitaries that are infinitesimal generators of the system's dynamics.

ODESolver

Bases: AbstractSolver

Solve an ODE equation.

Parameters:

Name Type Description Default
solver AbstractSolver

A diffrax ODE solver.

required
eq Callable

An ODE governing the dynamics.

_A
**kwargs Dict

Keyworded arguments used to set the ODE solver parameters such as relative, absolute tolerance, and etc. See diffrax API documentation for diffeqsolve.

required

Attributes:

Name Type Description
solver AbstractSolver

A diffrax ODE solver.

kwargs Dict

Keyworded arguments used to set the ODE solver parameters such as relative, absolute tolerance, and etc.

Methods:

Name Description
set_system

Register the system of ODE's to be solved.

evolve

Solve an ODE for a given initial condition y0 and a set of parameters given by params evaluated at timestamps t_span.

evolve(A, y0, params, t_span)

Solve for the ODE equation.

Simulate the dynamical system given the initial condition y and the time interval t_eval.

Parameters:

Name Type Description Default
y0 Array

The initial condition.

required
params Dict[str, float] | Dict[str, Array]

A dictionary of parameters where the values can be a scalar or a JAX array. The array form provides the user with the possibility to parallelise for an ensemble simulation.

required
t_span Tuple[float, float]

The starting and ending time instances.

required

Returns:

Type Description
Array | Solution

Solution to the ODE equation. If "saveat" keyword has an array type for keyword "ts" the output is a JAX array. Otherwise, the output is an interpolated solution.

PWCSolver

Bases: AbstractSolver

Piece-wise constant solver.

Parameters:

Name Type Description Default
dt float

The smallest increment of simulation time grid.

required
store bool

Specify whether to store the result at each timestamp.

False
eq Callable

Set of equations describing the unitary evolution of the system.

_A

Attributes:

Name Type Description
dt float

The smallest increment of simulation time grid.

Methods:

Name Description
set_system

Set the desired set of equations used to evolve the initial state of the system.

evolve

Simulate a quantum dynamics problem.

evolve(A, y0, params, t_span)

Propagate the the initial state vector.

Parameters:

Name Type Description Default
y0 Array

JAX array specifying the initial state.

required
params Dict[str, float]

Simulation parameters.

required
t_span Tuple[float, float]

Tuple of size two with indicating the starting and ending times of the simulation.

required

Returns:

Type Description
Array

Array of state vectors or the last state vector.

set_system(A, eq)

Specify the unitary equation to be solved by the solver.

Parameters:

Name Type Description Default
eq Callable

The unitary equation of interest.

required