Skip to content

Drives

Drives define the control fields applied to a quantum system and contribute to the time-dependent part of the Hamiltonian, shaping the system's evolution over time.

In QruiseML, a drive is defined by:

  • a time-dependent drive function
  • a drive channel, which specifies a corresponding set of parameters

These are combined using the Drive object, which can then be paired with operators in a Hamiltonian.

Defining the time-dependent drive function

In QruiseML, drive functions are defined as annotated Python functions. This means that each input parameter, as well as the function output, must have a type annotation. These annotations must use the types defined in the types module, such as Float64 or array types like Array1D(Float64).

A drive function generally takes the form

\[ f(t; p_1, p_2, \ldots), \]

where \(t\) is time and \(p_i\) are the parameters defining the drive.

A generic drive function would look like this:

from qruise.toolset.types import input_type1, input_type2, output_type

def f(t: input_type1, p1: input_type2, p2: input_type2) -> output_type:
    ...

For example, let's consider a sinusoidal drive function with amplitude a, frequency \(\omega\), and phase \(\phi\):

\[ f(t; a, \omega, \phi) = a \sin(\omega t + \phi). \]

This can be implemented as:

import numpy as np
from qruise.toolset.types import Float64

# define sine drive
def f(t: Float64, a: Float64, w: Float64, p: Float64) -> Float64:
    return a * np.sin(w * t + p)

For this function, all inputs and the output are of type Float64.

Creating the Drive object

To create a Drive object, you need to first define a drive channel. A drive channel is a label that associates the drive with a corresponding set of parameters in the parameter space. You can then instantiate the Drive with the drive channel and the corresponding drive function:

from qruise.toolset import Drive

drv1 = Drive("d1", f)
drv2 = Drive("d2", f)

These Drive objects can be paired with operators to construct the time-dependent terms in your Hamiltonian.