1 Introduction

The ability to manipulate the dynamics of a given complex quantum system is one of the fundamental issues of the quantum information science. It has been an implicit goal in many fields of science such as quantum physics, chemistry, or implementations of quantum information processing [13]. The usage of experimentally controllable quantum systems to perform computational task is a very promising perspective. Such usage is possible only if a system is controllable. Thus, the controllability of a given quantum system is an important issue of the quantum information science, since it concerns whether it is possible to drive a quantum system into a previously fixed state.

When manipulating quantum systems, a coherent control strategy is a widely used method. In this case, the application of semiclassical potentials, in a fashion that preserves quantum coherence, is used to manipulate quantum states. If a given system is controllable, it is interesting to obtain control sequence that drives a system to a desired state and simultaneously minimize the value of the disturbance caused by imperfections of practical implementation. In the realistic implementations of quantum control systems, there can be various factors which disturb the evolution [4]. One of the main issues in this context is decoherence—the fact that the systems are very sensitive to the presence of the environment, which often destroys the main feature of the quantum dynamics. Other disturbance can be a result of the restriction on the frequency spectrum of acceptable control parameters [5]. In the case of such systems, it is not accurate to apply piecewise-constant controls. In an experimental setup that utilizes an external magnetic field [6, 7], such restrictions come into play and cannot be neglected.

In many situations, the interaction with the control fields causes an undesirable coupling with the environment, which can lead to a destruction of the interesting features of the system [8]. In such situations, it is reasonable to seek a control field with minimal total influence on a system. Depending on a type of interaction with an environment, the influence differs. In this article, we consider an interaction that is proportional to the magnitude of a control field. To minimize the influence of an environment in such case, when the control field performs the desired evolution, the \(L_1\) norm should be minimized.

A different dynamical method for beating decoherence in open quantum systems is dynamical decoupling [912]. In this case, additional perturbation on a system is added, which protects the evolution against the effects of the environment influence at the same time driving the system to the desired state. In our case, the interaction with the environment is in strict relation to the control strategy, since it emerges only if the control pulses are applied. On the other hand, in a typical dynamical decoupling scheme, the coupling to the environment is constant, given by some Hamiltonian \(H_{SE}\) acting on the system and environment. Another approach to robust quantum control is quantum sliding mode control [13]. This model combines unitary control and periodic projective measurements. First, the initial state is driven into a sliding mode and then a periodic projective measurement is performed. Finally, there is risk-sensitive quantum control [14, 15] that is a robust control method with a feedback loop.

The paper is organized as follows. In Sect. 2, we introduce the model used for simulations. Section 3 describes the simulation setup. In Sect. 4, we show results of numerical simulations, and in Sect. 5, we draw the final conclusions.

2 Our model

To demonstrate a method of obtaining piecewise-constant controls, which have minimal energy, we will consider an isotropic Heisenberg spin-\(1/2\) chain of a finite length \(N\). The control will be performed on the first spin only. The total Hamiltonian of the aforementioned quantum control system is given by

$$\begin{aligned} H(t) = H_0 + H_c(t), \end{aligned}$$
(1)

where

$$\begin{aligned} H_0=J\sum \limits _{i=1}^{N-1}\left( S_x^iS_x^{i+1}+S_y^iS_y^{i+1}+S_z^iS_z^{i+1}\right) \!, \end{aligned}$$
(2)

is a drift part given by the Heisenberg Hamiltonian. The control is performed only on a first spin and is Zeeman like, i.e.,

$$\begin{aligned} H_c(t) = h_x(t)S_x^1 + h_y(t)S_y^1. \end{aligned}$$
(3)

In the above, \(S_k^i\) denotes \(k^{\text {th}}\) Pauli matrix which acts on the spin \(i\). Time dependent control parameters \(h_x(t)\) and \(h_y(t)\) are chosen to be piecewise constant. Furthermore, as opposed to [16], we do not restrict the control fields to be alternating with \(x\) and \(y\), i.e., they can be applied simultaneously (see e.g., [17] for similar approach). For notational convenience, we set \(\hbar = 1\); and after this, rescaling frequencies and control field amplitudes can be expressed in units of the coupling strength \(J\); and on the other hand, all times can be expressed in units of \(1/J\) [16].

The system described above is operator controllable, as it was shown in [18] and follows from a controllability condition using a graph infection property introduced in the same article. The controllability of the described system can be also deduced from a more general condition utilizing the notion of hypergraphs [19].

Since the interest here is focused on operator control sequence, a quality of a control will be measured with the use of gate fidelity,

$$\begin{aligned} F = \frac{1}{2^N}\left| \mathrm {Tr}(U_T^\dagger U(h))\right| \!, \end{aligned}$$
(4)

where \(U_T\) is the target quantum operation, and \(U(h)\) is an operation achieved by control parameters \(h\). We choose gate fidelity as it neglects global phases.

In the case of disturbed system, we will measure the quality of the control by a trace distance between Choi–Jamiołkowski states, which gives an estimation of a diamond norm.

In many situations, the interaction with the control fields causes an undesirable coupling with the environment, which can lead to a destruction of the interesting features of the system. We will consider a general model described by

$$\begin{aligned} H(t) = H_0 + H_\mathrm {c}(t)+ \gamma (|h_x| + |h_y|) H_1, \end{aligned}$$
(5)

where \(H_1\) denotes a general Hamiltonian responsible for a coupling with an environment, and the interaction is proportional to the magnitude of a control field. To minimize the influence of an environment in this model, we introduce an additional constrain on the control pulses, namely we wish to minimize the \(L_1\) norm of control pulses

$$\begin{aligned} \Vert h_k\Vert _1 = \sum \limits _{i=1}^n|h_k^i|, \end{aligned}$$
(6)

where \(k \in \{x,y\}\) and \(n\) are the total number of control pulses. In order to make this quantity comparable with fidelity, we impose bounds on the maximal amplitude of the control pulses. To accommodate this, we introduce the following penalty

$$\begin{aligned} P = \frac{\sum \nolimits _{i=1}^n |h_k^i|}{nb}, \end{aligned}$$
(7)

where \(b\) is the bound on the control pulse amplitude. This leads to the following functional we wish to minimize

$$\begin{aligned} G = (1 - \mu ) P - \mu F, \end{aligned}$$
(8)

where \(\mu \) is a weight assigned to fidelity.

To optimize the control pulses, we utilize the BFGS algorithm [20]. In order to use this method effectively, we need to calculate the explicit form of derivatives of Eq. (6). We propose the following functions to be used as the derivative of the absolute value:

  • The signum function:

    $$\begin{aligned} \frac{\mathrm {d}|x|}{\mathrm {d}x} = \mathrm {sgn}(x). \end{aligned}$$
    (9)
  • A fractional derivative:

    $$\begin{aligned} \frac{\mathrm {d}^\alpha |x|}{\mathrm {d}x^\alpha } = \pm \frac{\Gamma (2)}{\Gamma (2-\alpha )}x^{1-\alpha }, \end{aligned}$$
    (10)

    where \(\Gamma (x)=(x-1)!\) and we set \(\alpha =0.99\).

  • Rescaled Fermi–Dirac distribution

    $$\begin{aligned} \frac{\mathrm {d}|x|}{\mathrm {d}x} \approx 2 \left( \frac{-1}{\exp \left( \frac{x}{kT}\right) + 1} + 0.5\right) \!, \end{aligned}$$
    (11)

    where we set \(kT = 0.01\).

The signum function is the natural conclusion when one thinks about the derivative of the \(L_1\) norm as it penalizes any nonzero control pulses in the control scheme. To further out studies, we introduce two approximations of the derivative of the \(L_1\) norm. The first one utilizes the idea of fractional derivatives [21]. This allows us to achieve a continuous function, which quickly increases from 0 to 1 for positive values of the argument and decreases from 0 to \(-\)1 for negative values. Although continuous, the function has the drawback that control pulses with lower magnitude are less penalized. The penalty can be adjusted by using the parameter \(\alpha \)

The last proposed approximation is a rescaled Fermi–Dirac distribution [22]. The distribution is given by

$$\begin{aligned} f(x) = \frac{1}{\exp \left( \frac{x - E_f}{kT}\right) + 1}, \end{aligned}$$
(12)

where \(E_f\) is the Fermi energy level. The usage is justified, as for \(T=0\) the function is given as

$$\begin{aligned} f(E) = \left\{ \begin{array}{rcl} 1 &{} \quad \mathrm{if } &{} E<E_f,\\ 0 &{} \quad \mathrm{if } &{} E>E_f, \end{array}\right. \end{aligned}$$
(13)

We rescale this function in the following manner: First, we set \(E_f = 0\). Next, in order to obtain behavior similar to the signum function, we translate and rescale the function, so that \(f(x) = -1\) for \(x \ll 0\) and \(f(x) = 1\) for \(x \gg 0\). After these operations we obtain

$$\begin{aligned} f(x) = 2 \left( \frac{-1}{\exp \left( \frac{x}{kT}\right) + 1} + 0.5\right) , \end{aligned}$$
(14)

From our point of view, the function has properties similar to the fractional derivative and the penalty for low magnitude pulses can be adjusted by using the “temperature” \(T\). A comparison of these approximations is shown in Fig. 1.

Fig. 1
figure 1

Comparison of different derivative approximations

3 Simulation setup

To demonstrate the beneficialness of our approach, we study three- and four-qubit spin chains. The control field is applied to the first qubit only. Our target gates are:

(15)

the negation of the last qubit of the chain, and

(16)

swapping the states between the last two qubits. This set of gates is universal in quantum computation.

We provide an explicit example in which we set the duration of the control pulse to \(\Delta t = 0.2\) and the total number of pulses in each direction to \(n=64\) for the three-qubit chain and \(n=256\) in the four-qubit case, although the presented method may be applied for arbitrary values of \(\Delta t\) and \(n\). The weight of fidelity in Eq. (8) is set to \(\mu =0.2\) in the three-qubit scenario and to \(\mu =0.4\) in the four-qubit scenario.

4 Results

We show examples of control sequences obtained by using our method in Figs. 2 and 3. They depict results obtained for the three-qubit NOT gate optimization and four-qubit SWAP gate optimization, respectively. In the three-qubit scenario, we find, as expected, a control sequence that equal to zero most of the time with irregular, high amplitude pulses. A similar case can be made for the swap gate in the four-qubit scenario. The main difference is that in this case, the high amplitude pulses are surrounded by groups of weaker pulses. The results shown here are for the fractional derivative approximation. Simulations for other approximation yield nearly identical results.

Fig. 2
figure 2

Example control sequences \(h_x\) and \(h_y\) for the NOT gate in the three-qubit scenario

Fig. 3
figure 3

Example control sequences \(h_x\) and \(h_y\) for the SWAP gate in the four-qubit scenario

The fidelity obtained in both cases is \(F > 0.99\), and the value of \(P\) has the order of \(10^{-2}\).

Finally, we show the evolution of each qubit’s state. Let the qubits be in the state \(|\psi \rangle _0=|000\rangle \) in the case of the three-qubit scenario. Figure 4 shows the time evolution of the target qubit in this setup. The final state of the chain is \(\psi _f=|001\rangle \). Note that the evolution is smooth, no signs of control pulses are visible in the qubit’s trajectory. In the four-qubit scenario the time evolution of the target qubits is shown in Figs. 5 and 6. Let the initial state of the chain be equal to \(|\phi _0\rangle = |0010\rangle \). The final state of the chain is \(|\phi \rangle = |0001\rangle \). In this case, the figures show that the transition is performed along the shortest path possible. Also, note that the evolution is quite smooth, and the application of each control pulse is not visible in these figures.

Fig. 4
figure 4

Time evolution of the target qubit of a three-qubit chain from the state \(|000\rangle \) to the state \(|001\rangle \) under the operator implemented by optimized control sequences

Fig. 5
figure 5

Time evolution of the third qubit of a four-qubit chain from the state \(|0010\rangle \) to the state \(|0001\rangle \) under the operator implemented by optimized control sequences

Fig. 6
figure 6

Time evolution of the fourth qubit of a four-qubit chain from the state \(|0010\rangle \) to the state \(|0001\rangle \) under the operator implemented by optimized control sequences

In order to demonstrate the advantages of our approach, we perform additional simulations, where we put \(\mu =1\) in Eq. (8). This is the unconstrained problem of finding optimal control pulses. Next, we introduce an interaction with an environment, proportional to \(|h_x| + |h_y|\). We model the interaction with the environment by adding a qubit to the chain. The Hamiltonian for this case is

$$\begin{aligned} H_\mathrm {graph}(t)&= H_0 + H_\mathrm {c}(t)+ \gamma (|h_x| + |h_y|) \nonumber \\&\quad \times \sum \limits _{i=1}^N\left( S_x^iS_x^{N+1}+S_y^iS_y^{N+1}+S_z^i S_z^{N+1}\right) \!. \end{aligned}$$
(17)

In order to compare the evolution with the additional qubit with a given \(U_T\), we use the following scheme. For a quantum channel \(\Phi \), let us write \(J(\Phi )\) to denote the associated state:

$$\begin{aligned} J(\Phi ) = \frac{1}{n} \sum \limits _{1\le i,j \le n} \Phi (|i \rangle \langle j|) \otimes |i \rangle \langle j|. \end{aligned}$$
(18)

Here, we are assuming that the channel maps \(n\times n\) complex matrices into \(m\times m\) complex matrices. The matrix \(J(\Phi )\) is sometimes called the Choi–Jamiołkowski representation of \(\Phi \). For quantum channels \(\Phi _0\) and \(\Phi _1\), we may define the “diamond norm distance” between them as

(19)

where denotes the identity channel from the set of \(k \times k\) complex matrices to itself; \(\Vert \cdot \Vert _1\) denotes the trace norm; and the supremum is taken over all \(k \ge 1\) and all density matrices \(\rho \) from the set of \(nk \times nk\) complex matrices. The supremum always happens to be achieved for some choice of \(k\le n\) and some rank 1 density matrix \(\rho \). A coarse bound for the diamond norm defined in Eq. (19) is known [23]

$$\begin{aligned} \frac{1}{n} \Vert \Phi _0 - \Phi _1 \Vert _{\Diamond } \le \Vert J(\Phi _0) - J(\Phi _1) \Vert _1 \le \Vert \Phi _0 - \Phi _1 \Vert _{\Diamond }. \end{aligned}$$
(20)

Therefore, to compare the target operations with and without the additional qubit, we study the \(L_1\) of the difference of the Jamiołkowski matrices of the respective quantum channels \(\Vert J(\Phi _0) - J(\Phi _1) \Vert _1\). The results for different target operations are summarized in Table 1. We show results obtained for Fermi–Dirac approximation of the derivative. As stated in the table, the bigger the system under consideration is the greater is the gain from using our method.

Table 1 Summary of the value of Eq. (20) for the studied cases

5 Conclusions

In this work, we introduced a method of obtaining a piecewise-constant control field for a quantum system with an additional constrain of minimizing the \(L_1\) norm. To demonstrate the beneficialness of our approach, we have shown results obtained for a spin chain, on which we implemented two quantum operations: negation of the last qubit of the chain and swapping the states of the two last qubits of the chain. Our results show that it is possible to obtain control fields which have minimal energy and still give a high fidelity of the quantum operation. Our method may be used in situations where the interaction with the control field causes additional coupling to the environment. As our method allows one to minimize the number of control pulses, it also minimizes the amount of coupling to the environment. It is important to note that our model differs from known in the literature dynamical decoupling, in which additional perturbation on a system is added, which protects the evolution against the effects of the environment influence. In our case the interaction with the environment is related to the control strategy, and it emerges only if the control is applied. Our model allows to optimize high fidelity control pulses for the cases with and without external environment, as shown in Table 1 as long as the coupling is induced by the control pulses themselves. Other possible usage of our method includes systems, in which it is possible to use rare, but high value of control pulses, for example, superconducting magnets with high impulse current.