Control formats

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

\[\begin{align} H_{c}(t) = \boldsymbol{\alpha}(t) \boldsymbol{A} + \Big(\boldsymbol{\gamma}(t) \boldsymbol{C} + \text{H.C.}\Big) + D \end{align}\]

in terms of the vectorized control solution

\[\begin{align} &\boldsymbol{\alpha} (t) = \begin{bmatrix} \alpha_{1}(t), & \alpha_{2}(t), & \dots & \alpha_{n_{\alpha}}(t) \end{bmatrix}, && \hspace{1cm} \boldsymbol{A}= \begin{bmatrix} A_{1} \\ A_{2} \\ \vdots \\ A_{n_{\alpha}} \end{bmatrix}, \hspace{1cm} &&t\in[0,\tau] \\ \\ &\boldsymbol{\gamma} (t) = \begin{bmatrix} \gamma_{1}(t), & \gamma_{2}(t), & \dots & \gamma_{n_{\gamma}}(t) \end{bmatrix}, && \hspace{1cm} \boldsymbol{C}= \begin{bmatrix} C_{1} \\ C_{2} \\ \vdots \\ C_{n_{\gamma}} \end{bmatrix}, \hspace{1cm} &&t\in[0,\tau] \end{align}\]

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

\[\begin{align} [t_{i-1},t_{i}], \hspace{1cm} i\in\{1,...,m\}, \hspace{1cm} t_{0} \equiv 0, \hspace{1cm} t_{m} \equiv \tau \end{align}\]

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

\[\begin{align} \tau_{i} = t_{i}-t_{i-1} \end{align}\]

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}]$.

The below image shows segmentation of control amplitude $\alpha_{j}(t)$ for control axis $A_{j}$ into $m$ segments. The area under the $i$th segment is given by the variable $\theta_{i,j} \equiv \alpha_{i,j}\tau_{j}$.

Control segments

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

\[\begin{align} \Theta_i(t) = \begin{cases} 1 & t\in[t_{i-1},t_{i}]\\ 0 & \text{else} \end{cases}. \end{align}\]

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

\[\begin{align} f_{i}(t) = \Theta_{i}(t)f(t) \hspace{1cm} i\in\{1,...,m\} \end{align}\]

such that

\[\begin{align} f(t) = \sum_{i=1}^{m}f_{i}(t). \end{align}\]

This partitioning define the map

\[\begin{align} S:\hspace{0.25cm} f(t) \hspace{0.25cm}\mapsto\hspace{0.25cm} \begin{bmatrix} f_{1}(t) \\ f_{2}(t) \\ \vdots \\ f_{m}(t) \end{bmatrix} \end{align}\]

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

\[\begin{align} S(\boldsymbol{\gamma}(t)) & = \begin{bmatrix} \gamma_{1,1}(t) & \gamma_{1,2}(t) & \dots & \gamma_{1,n_{\gamma}}(t) \\ \gamma_{2,1}(t) & \gamma_{2,2}(t) & \dots & \gamma_{2,n_{\gamma}}(t) \\ \vdots & \vdots & \ddots & \vdots \\ \gamma_{m,1}(t) & \gamma_{m,2}(t) & \dots & \gamma_{m,n_{\gamma}}(t) \end{bmatrix}, \hspace{1cm} \gamma_{i,j}(t) \equiv \Theta_{i}(t)\gamma_{j}(t) \end{align}\] \[\begin{align} S(\boldsymbol{\alpha}(t)) & = \begin{bmatrix} \alpha_{1,1}(t) & \alpha_{1,2}(t) & \dots & \alpha_{1,n_{\alpha}}(t) \\ \alpha_{2,1}(t) & \alpha_{2,2}(t) & \dots & \alpha_{2,n_{\alpha}}(t) \\ \vdots & \vdots & \ddots & \vdots \\ \alpha_{m,1}(t) & \alpha_{m,2}(t) & \dots & \alpha_{m,n_{\alpha}}(t) \end{bmatrix}, \hspace{1cm} \alpha_{i,l}(t) \equiv \Theta_{i}(t)\alpha_{l}(t) \end{align}\]

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

\[\begin{align} S(H_{c}(t)) = \begin{bmatrix} H_{c,1}(t) \\ H_{c,2}(t) \\ \vdots \\ H_{c,m}(t) \end{bmatrix} \end{align}\]

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

\[\begin{align} H_{c,i}(t) & = \left( \Big[ S(\boldsymbol{\gamma}(t)) \Big]_{i} \boldsymbol{C} + \text{H.C.} \right) + \Big[ S(\boldsymbol{\alpha}(t)) \Big]_{i} \boldsymbol{A} + D\\ & = \left(\sum_{j = 1}^{n_{\gamma}}\gamma_{i,j}(t) C_{j} \hspace{0.15cm}+\hspace{0.15cm} \text{H.C.} \right) \hspace{0.15cm}+\hspace{0.15cm} \sum_{l = 1}^{n_{\alpha}}\alpha_{i,l}(t) A_{l} \hspace{0.15cm}+\hspace{0.15cm} D. \end{align}\]

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

\[\begin{align} \left[ \begin{array}{c|ccc|ccc} - & \gamma_{1}(t) & \cdots & \gamma_{n_{\gamma}}(t) & \alpha_{1}(t) & \cdots & \alpha_{n_{\alpha}}(t) \\ \hline \tau_{1} & \gamma_{1,1}(t) & \dots & \gamma_{1,n_{\gamma}}(t) & \alpha_{1,1}(t) & \dots & \alpha_{1,n_{\alpha}}(t)\\ \vdots & \vdots & \ddots & \vdots & \vdots & \ddots & \vdots\\ \tau_{m} & \gamma_{m,1}(t) & \dots & \gamma_{m,n_{\gamma}}(t) & \alpha_{m,1}(t) & \dots & \alpha_{m,n_{\alpha}}(t)\\ \end{array} \right] \end{align}\]

Control coordinates

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

\[\begin{align} &\text{polar controls:} \hspace{1cm}\hspace{3.35cm} \Omega\phi: &&\gamma(t) \hspace{0.25cm} &&\mapsto&& \begin{bmatrix} \Omega(t), & \phi(t) \end{bmatrix} \\ &\text{Cartesian controls:} \hspace{1cm}\hspace{2.4cm} \text{IQ}\hspace{0.25cm}: &&\gamma(t) \hspace{0.25cm} &&\mapsto&& \begin{bmatrix} I(t), & Q(t) \end{bmatrix} \end{align}\]

where where establish the following definitions

\[\begin{align} &\text{coupling rate:} \hspace{1cm} &&\Omega(t) &&= &&|\gamma(t)| \\ &\text{phase angle:} \hspace{1cm} &&\phi(t) &&= &&\text{Arg}\left(\gamma(t)\right) \\ &\text{control x (in-phase):} \hspace{1cm} &&I(t) &&= &&\text{Re}\left(\gamma(t)\right) &&=&&\Omega(t) \cos(\phi(t)) \\ &\text{control y (in-quadrature):} \hspace{1cm} &&Q(t) &&= &&\text{Im}\left(\gamma(t)\right) &&=&&\Omega(t) \sin(\phi(t)) \end{align}\]

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

\[\begin{align} S(\Omega\phi(\gamma_{j})) & = \begin{bmatrix} \Omega_{1,j}(t) & \phi_{1,j}(t) \\ \Omega_{2,j}(t) & \phi_{2,j}(t) \\ \vdots & \vdots \\ \Omega_{m,j}(t) & \phi_{m,j}(t) \end{bmatrix} &&\Omega_{i,j}(t) \equiv \Theta_{i}(t)\Omega_{j}(t), &&\phi_{i,j}(t) \equiv \Theta_{i}(t)\phi_{j}(t) \end{align}\] \[\begin{align} S(\text{IQ}(\gamma_{j})) & = \begin{bmatrix} I_{1,j}(t) & Q_{1,j}(t) \\ I_{2,j}(t) & Q_{2,j}(t) \\ \vdots & \vdots \\ I_{m,j}(t) & Q_{m,j}(t) \end{bmatrix} &&I_{i,j}(t) \equiv \Theta_{i}(t)I_{j}(t), &&Q_{i,j}(t) \equiv \Theta_{i}(t)Q_{j}(t) \end{align}\]

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

\[\begin{align} &\text{polar controls}: &&\left[ \begin{array}{c|cc|c|cc|ccc} - & \Omega_{1}(t) & \phi_{1}(t) & \cdots & \Omega_{n_{\gamma}}(t) & \phi_{n_{\gamma}}(t) & \alpha_{1}(t) & \cdots & \alpha_{n_{\alpha}}(t) \\ \hline \tau_{1} & \Omega_{1,1}(t) & \phi_{1,1}(t) & \dots & \Omega_{1,n_{\gamma}}(t) & \phi_{1,n_{\gamma}}(t) & \alpha_{1,1}(t) & \dots & \alpha_{1,n_{\alpha}}(t)\\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots\\ \tau_{m} & \Omega_{1,m}(t) & \phi_{1,m}(t) & \dots & \Omega_{m,n_{\gamma}}(t) & \phi_{m,n_{\gamma}}(t) & \alpha_{m,1}(t) & \dots & \alpha_{m,n_{\alpha}}(t)\\ \end{array} \right] \\ \\ &\text{Cartesian controls}: &&\left[ \begin{array}{c|cc|c|cc|ccc} - & I_{1}(t) & Q_{1}(t) & \cdots & I_{n_{\gamma}}(t) & Q_{n_{\gamma}}(t) & \alpha_{1}(t) & \cdots & \alpha_{n_{\alpha}}(t) \\ \hline \tau_{1} & I_{1,1}(t) & Q_{1,1}(t) & \dots & I_{1,n_{\gamma}}(t) & Q_{1,n_{\gamma}}(t) & \alpha_{1,1}(t) & \dots & \alpha_{1,n_{\alpha}}(t)\\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots\\ \tau_{m} & I_{1,m}(t) & Q_{1,m}(t) & \dots & I_{m,n_{\gamma}}(t) & Q_{m,n_{\gamma}}(t) & \alpha_{m,1}(t) & \dots & \alpha_{m,n_{\alpha}}(t)\\ \end{array} \right] \end{align}\]

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

\[\begin{align} \theta_{ij} = \int_{t_{i-1}}^{t_{i}}\Omega_{i,j}(t)dt. \end{align}\]

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

\[\begin{align} \Omega_{i,j}(t) = \theta_{ij}\frac{G(t;\mu_{i},\sigma,\tau_{i})}{I_i(\sigma)}\Theta_{j}(t) \end{align}\]

where the unnormalized and offset Gaussian envelope is defined by

\[\begin{align} G(t;\mu_{i},\sigma,\tau_{i}) = \exp\left[-\frac{(t-\mu_{i})^2}{2\sigma^2}\right] - \exp\left[-\frac{\tau_{i}^2}{8\sigma^2}\right] \end{align}\]

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

\[\begin{align} I_i(\sigma) = \int_{t_{i-1}}^{t_{i}}G(t;\mu_{i},\sigma,\tau_{i})dt \end{align}\]

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

\[\begin{align} t_{i} = \sum_{j = 0}^{i}t_{j}, \hspace{1cm} i\in\{0,...,m\}. \end{align}\]

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

\[\begin{align} &\text{segment midpoints:}\hspace{1cm}&&\mu_{i} = \frac{t_{i}+t_{i-1}}{2}\\ &\text{segment durations:}\hspace{1cm}&&\tau_{i} = t_{i}-t_{i-1} \end{align}\]

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

\[\begin{align} &H_{c}(t) = \Big(\gamma_{xy}(t) C_{xy} + \text{H.C.}\Big) + \alpha_{z}(t)A_{z}, && && \gamma_{xy}(t) = \Omega(t)e^{+i \phi(t)}, \hspace{0cm} && && \alpha_{z}(t) = \Delta(t) \end{align}\]


\[C_{xy} = \frac{1}{2}|0\rangle\hspace{-0.07cm}\langle 1|\]

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

\[\begin{align} &\text{polar/cylindrical controls}: && && \left[ \begin{array}{c|ccc} - & \Omega(t) & \phi(t) & \alpha_{z}(t) \\ \hline \tau_{1} & \Omega_{1}(t) & \phi_{1}(t) & \Delta_{1}(t)\\ \tau_{2} & \Omega_{2}(t) & \phi_{2}(t) & \Delta_{2}(t)\\ \vdots & \vdots & \vdots & \vdots \\ \tau_{m} & \Omega_{m}(t) & \phi_{m}(t) & \Delta_{m}(t)\\ \end{array} \right] % && && && \begin{array}{c} \Omega_{i}(t) = \Theta_{i}(t)\Omega(t) \\ \\ \phi_{i}(t) = \Theta_{i}(t)\phi(t) \\ \\ \Delta_{i}(t) = \Theta_{i}(t)\Delta(t) \end{array} \\ \\ &\text{Cartesian controls}: && && \left[ \begin{array}{c|ccc} - & I(t) & Q(t) & \alpha_{z}(t) \\ \hline \tau_{1} & I_{1}(t) & Q_{1}(t) & \Delta_{1}(t) \\ \tau_{2} & I_{2}(t) & Q_{1}(t) & \Delta_{2}(t) \\ \vdots & \vdots & \vdots & \vdots \\ \tau_{m} & I_{m}(t) & Q_{m}(t) & \Delta_{m}(t) \\ \end{array} \right] && && && \begin{array}{c} I_{i}(t) = \Theta_{i}(t)I(t) \\ \\ Q_{i}(t) = \Theta_{i}(t)Q(t) \\ \\ \Delta_{i}(t) = \Theta_{i}(t)\Delta(t) \end{array} \end{align}\]

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

\[\begin{align} H_{c} = \frac{1}{2}\boldsymbol{\alpha}(t)\boldsymbol{\sigma}, \hspace{1.5cm} \boldsymbol{\alpha}(t) = \begin{bmatrix} \alpha_{x}(t), & \alpha_{y}(t), &\alpha_{z}(t) \end{bmatrix}, \hspace{1.5cm} \boldsymbol{\sigma} = \begin{bmatrix} \sigma_{x} \\ \sigma_{y} \\ \sigma_{z} \end{bmatrix} \end{align}\]


\[\begin{align} \alpha_{x}(t) &&=&&I(t) &&=&&\Omega(t) \cos(\phi(t)), \\ \alpha_{y}(t) &&=&&Q(t) &&=&&\Omega(t) \sin(\phi(t)), \\ \alpha_{z}(t) &&=&& \Delta(t) &&=&& \omega_{0}-\omega_\text{LO}(t) \end{align}\]

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

\[\begin{align} \alpha_{x} & =\Omega\cos(\phi)\\ \alpha_{y} & = \Omega\sin(\phi)\\ \alpha_{z} &= \alpha_{z} \end{align}\]


\[\begin{align} \Omega = \sqrt{\alpha_{x}^2+\alpha_{y}^2}, \hspace{1cm} \alpha_{z} = \Delta. \end{align}\]

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.


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:

\[\begin{align} \Omega_{i,new} & = \Omega_{i,old} \Omega_{max,new} / \Omega_{max,old} \\ \phi_{i,new} & = \phi_{i,old} \\ \Delta_{i,new} & = \Delta_{i,old} \\ \tau_{i,new} & = \tau_{i,old} \Omega_{max,old} / \Omega_{max,new} \end{align}\]

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:

\[U_j=\exp \left( \frac{-i}{2}\left(\omega_j \cos \phi_j \sigma_x+\omega_j \sin \phi_j \sigma_y+\delta_j\sigma_z\right) \right),\]

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,

\[\begin{align} \text{DDS}: && \left[ \begin{array}{c|ccc} t_{0} & \omega_0 & \phi_0 & \delta_0\\ t_{1} & \omega_1 & \phi_1 & \delta_1\\ \vdots & \vdots & \vdots & \vdots\\ t_{n} & \omega_n & \phi_n & \delta_n\\ t_{n+1} & \omega_{n+1} & \phi_{n+1} & \delta_{n+1}\\ \end{array} \right]. \end{align}\]