## General Introduction

For an arbitrary quantum system defined on a $d$-dimensional Hilbert space, the most general control Hamiltonian is written

in terms of the vectorized control solution

specifying the phasor $\boldsymbol{\gamma}(t)$ and amplitude $\boldsymbol{\alpha}(t)$ modulations applied to the associated operators, $\boldsymbol{A}$ and $\boldsymbol{C}$ respectively, over the duration $t\in[0,\tau]$. This is a generic structure within which special cases exist. In particular, Q-CTRL provides tools to evaluate segmented control solutions , including a variety of familiar redefined control solutions.

It is often more useful to specify the form of the control Hamiltonian , or functional form of the drive controls $\boldsymbol{\gamma}(t)$ and amplitude $\boldsymbol{\alpha}(t)$, locally in time. In this case the time-domain $t\in[0,\tau]$ is partitioned into a series of intervals, or segments. The functional form of the drive controls and Hamiltonian are then defined on each segment. This is illustrated below for control amplitude $\alpha_{l}(t).$ The time domain $t\in[0,\tau]$ has been formally partitioned into $m$ subintervals

where $t_{i-1}$ and $t_{i}$ are respectively the start and end times of the $i$th segment, and

is its duration. The control amplitude $\alpha_{l}(t)$ is piecewise-constant, defined to take the constant value $\alpha_{i,l}$ on the $i$th segment, $t\in[t_{i-1},t_{i}]$.

## Generic Shaped-Control Segments

To streamline the discussion of segmented controls below introduce some simplifying notation. Let the time domain be partitioned into $m$ segments, and define the window function on the $i$th segment by

Let $f(t)$ be a scalar or vector function of time, locally defined on the $i$th segment by

such that

This partitioning define the map

which we refer to as the segments of $f(t)$. Using this notation we define the drive control segments

where the doubly-subscripted functions $\gamma_{i,j}(t)$ and $\alpha_{i,l}(t)$ define the *time-dependent* modulation envelopes for the $j$th phasor and $l$th amplitude on the $i$th segment. Each column maps to a distinct control, while each row maps a distinct segment. The segments of the control Hamiltonian are given by

where the control Hamiltonian on the $i$th segment is given by

Control is therefore completely specified by the $m\times (n_{\gamma}+n_{\alpha})$ functions tabulated in the time-dependent control-space array as

## Control Coordinates

Given the control phasor $\gamma(t) = \Omega(t)e^{+i\phi(t)}$ we define the coordinate map

where where establish the following definitions

Applying these coordinate maps to a segmented control solution, the segment coordinate variables for the $j$th control phasor $\gamma_{j}(t)$ are given by

Applying these maps to each phasor in the control solution, the control-space array is tabulated in terms of these coordinate systems as

Q-CTRL uses this format to list generic control environments.

The most general control solution corresponds to defining an arbitrary set of time-dependent control functions $\gamma_{i,j}(t)$ and $\alpha_{i,l}(t).$ Individual control segments may either be constant over the segment duration, or may be shaped to exhibit a custom envelope in each segment. Piecewise-constant control illustrated above corresponds to the case that these functions are constant-valued on each segment.

Implementing control solutions with a desired envelope or pulse shape on the constituent segments therefore corresponds to specifying the appropriate functional form of the $\gamma_{i,j}(t)$ and $\alpha_{i,l}(t)$ on each segment. Examples are provided in the following sections.

## In-Built Shaped-Control Segments

As an example, Q-CTRL employs analytically defined Gaussian functions as in-built control envelopes. Let $\gamma_{i,j}(t) = \Omega_{i,j}(t)e^{+i\phi_{i,j}(t)}$ denote the drive phasor during the $i$th segment for the $j$th control operator $C_{j}$. Constraining the drive phase to be constant over each segment, $\phi_{i,j}(t) = \phi_{i,j}$, the generalized rotation angle generated by $C_{j}$ over $i$th segment given by

This may be implemented using a Gaussian envelope centred at the segment midpoint by setting

where the *unnormalized* and *offset* Gaussian envelope is defined by

where $\mu_{i}$ and $\sigma$ are the mean and standard-deviation respectively, and where

is the normalization factor integrated over the $i$th segment, $t\in[\mu_{i}-\tau_{i}/2,\mu_{i}+\tau_{i}/2]$, with duration $\tau_{i}$. This definition ensures that the value the waveform is zero at the edges of the time window $t=\mu_{i}\pm\tau_{i}/2$. For a segmented control solution with $m$-segments, the segment boundary times are defined by

The segment midpoints and durations for the $i$th segment are then defined

## Example Format: Single-Qubit Drive

The generic formalism described above is illustrated for a single qubit. In this case the control Hamiltonian takes the form

where is the non-Hermitian operator associated with $xy$ rotations driven by the control phasor $\gamma_{xy}(t)$, and $A_{z} = \frac{1}{2}\sigma_{z}$ is the Hermitian operator associated with $z$ rotations driven by the control amplitude $\alpha_{z}(t)$. The control-space arrays in the two coordinate systems are therefore tabulated as

where $I(t) = \Omega(t) \cos(\phi(t))$ and $Q(t) = \Omega(t) \sin(\phi(t))$ are the mappings between polar and Cartesian variables.

### Cartesian Controls

We note the equivalent expression for the single-qubit control Hamiltonian may be written

where

justifying reference to this coordinate representation as *Cartesian*.

### Cylindrical Controls

The correspondence between polar $(\Omega, \phi, \alpha_{z})$ and Cartesian $(I,Q,\alpha_{z})\equiv(\alpha_{x},\alpha_{y},\alpha_{z})$ variables is given by

where

This is the same as the correspondence between 3D cylindrical and Cartesian coordinates. For a single qubit we therefore refer to polar or cylindrical coordinates interchangeably.

### Units

Control solutions defined for single-qubits and represented in either polar or Cartesian coordinates are parameterized in terms of the the Rabi rate, $\Omega(t)$. Accordingly, a control defined within the control library may be rescaled by changing the (dimensionful) Rabi rate and segment duration, while ensuring the same operation is completed, so long as it has zero detuning for every segment.

Given an old maximum Rabi rate $\Omega_{max,old}$ and a new one $\Omega_{max,new}$ the Rabi rate and the durations of a control are scaled as follows:

Scaling of controls when detuning is non-zero is currently disabled, as it cannot be guaranteed that the operation implemented will be identical without simultaneously scaling the Rabi rate and detuning, i.e. the modified Rabi rate .

Note that filter functions are not invariant under this operation. Hence if you scale an optimized control it may result in a solution with a performance metric that is worse for the same noise power spectral density .

## Dynamical Decoupling Sequences

A Dynamical decoupling sequence (DDS) is defined as series of instantaneous unitary operations that are applied to a single qubit at a particular offset time.

A DDS with a total *duration* $\tau$ and *number of offsets* $n$ has operations parameterized as follows.

The $j$th operation will have an *offset* time $t_j$ that defines when the operation is applied to
the qubit. Each unitary operation is then defined by three parameters:

where $\omega_j$ is the *rabi rotation*, $\phi_j$ is the *azimuthal angle* and $\delta_j$ is the *detuning rotation*.

In addition to the DDS a user may want to add a $\pi/2$-rotation to the start or end of the sequence to create a superposition. We use $j = 1 \cdots n$ for the dynamical decoupling operations, then use $j=0$ ($t_0=0$) and $j=n$ ($t_{n+1}=\tau$) for the preparation and measurement pulses at the start and finish respectfully.

Following these conventions, a DDS can be completely characterized by an array,