Skip to content

CNOT with interacting qubits

Digital-analog quantum computing focuses on using single qubit digital gates combined with more complex and device-dependent analog interactions to represent quantum programs. This paradigm has been shown to be universal for quantum computation1. However, while this approach may have advantages when adapting quantum programs to real devices, known quantum algorithms are very often expressed in a fully digital paradigm. As such, it is also important to have concrete ways to transform from one paradigm to another.

This tutorial will exemplify the DAQC transformation starting with the representation of a simple digital CNOT using the universality of the Ising Hamiltonian2.

CNOT with CPHASE

Let's look at a single example of how the digital-analog transformation can be used to perform a CNOT on two qubits inside a register of globally interacting qubits.

First, note that the CNOT can be decomposed with two Hadamard and a CPHASE gate with \(\phi=\pi\):

import torch
from qadence import chain, sample, product_state

from qadence.draw import display
from qadence import X, I, Z, H, N, CPHASE, CNOT, HamEvo, PI

n_qubits = 2

# CNOT gate
cnot_gate = CNOT(0, 1)

# CNOT decomposed
phi = PI
cnot_decomp = chain(H(1), CPHASE(0, 1, phi), H(1))

init_state = product_state("10")
sample from CNOT gate and 100 shots = [OrderedCounter({'11': 100})]
sample from decomposed CNOT gate and 100 shots = [OrderedCounter({'11': 100})]

The CPHASE matrix is diagonal, and can be implemented by exponentiating an Ising-like Hamiltonian, or generator,

\[\text{CPHASE}(i,j,\phi)=\text{exp}\left(-i\phi \mathcal{H}_\text{CP}(i, j)\right)\]
\[\begin{aligned} \mathcal{H}_\text{CP}&=-\frac{1}{4}(I_i-Z_i)(I_j-Z_j)\\ &=-N_iN_j \end{aligned}\]

where the number operator \(N_i = \frac{1}{2}(I_i-Z_i)=\hat{n}_i\) is used, leading to an Ising-like interaction \(\hat{n}_i\hat{n}_j\) realisable in neutral-atom systems. Let's rebuild the CNOT using this evolution.

from qadence import kron, block_to_tensor

# Hamiltonian for the CPHASE gate
h_cphase = (-1.0) * kron(N(0), N(1))

# Exponentiating and time-evolving the Hamiltonian until t=phi.
cphase_evo = HamEvo(h_cphase, phi)

# Check that we have the CPHASE gate:
cphase_matrix = block_to_tensor(CPHASE(0, 1, phi))
cphase_evo_matrix = block_to_tensor(cphase_evo)
cphase_matrix == cphase_evo_matrix: True

Now that the CPHASE generator is checked, it can be applied to the CNOT:

# CNOT with Hamiltonian Evolution
cnot_evo = chain(
    H(1),
    cphase_evo,
    H(1)
)

# Initialize state to check CNOTs sample outcomes.
init_state = product_state("10")
sample cnot_gate = [OrderedCounter({'11': 100})]
sample cnot_evo = [OrderedCounter({'11': 100})]

Thus, a CNOT gate can be created by combining a few single-qubit gates together with a two-qubit Ising interaction between the control and the target qubit which is the essence of the Ising transform proposed in the seminal DAQC paper2 for \(ZZ\) interactions. In Qadence, both \(ZZ\) and \(NN\) interactions are supported.

CNOT in an interacting system of three qubits

Consider a simple experimental setup with \(n=3\) interacting qubits laid out in a triangular grid. For the sake of simplicity, all qubits interact with each other with an \(NN\)-Ising interaction of constant strength \(g_\text{int}\). The Hamiltonian for the system can be written by summing interaction terms over all pairs:

\[\mathcal{H}_\text{sys}=\sum_{i=0}^{n}\sum_{j=0}^{i-1}g_\text{int}N_iN_j,\]

which in this case leads to only three interaction terms,

\[\mathcal{H}_\text{sys}=g_\text{int}(N_0N_1+N_1N_2+N_0N_2)\]

This generator can be easily built in Qadence:

from qadence import add, kron
n_qubits = 3

# Interaction strength.
g_int = 1.0

# Build a list of interactions.
interaction_list = []
for i in range(n_qubits):
    for j in range(i):
        interaction_list.append(g_int * kron(N(i), N(j)))

h_sys = add(*interaction_list)
h_sys = AddBlock(0,1,2)
├── [mul: 1.000] 
   └── KronBlock(0,1)
       ├── N(1)
       └── N(0)
├── [mul: 1.000] 
   └── KronBlock(0,2)
       ├── N(2)
       └── N(0)
└── [mul: 1.000] 
    └── KronBlock(1,2)
        ├── N(2)
        └── N(1)

Now let's consider that the experimental system is fixed, and qubits can not be isolated one from another. The options are:

  • Turn on or off the global system Hamiltonian.
  • Perform local single-qubit rotations.

To perform a fully digital CNOT(0,1), the interacting control on qubit 0 and target on qubit 1 must be isolated from the third one to implement the gate directly. While this can be achieved for a three-qubit system, it becomes experimentally untractable when scaling the qubit count.

However, this is not the case within the digital-analog paradigm. In fact, the two qubit Ising interaction required for the CNOT can be represented with a combination of the global system Hamiltonian and a specific set of single-qubit rotations. Full details about this transformation are to be found in the DAQC paper2 but a more succint yet in-depth description takes place in the next section. It is conveniently available in Qadence by calling the daqc_transform function.

In the most general sense, the daqc_transform function will return a circuit that represents the evolution of a target Hamiltonian \(\mathcal{H}_\text{target}\) (here the unitary of the gate) until a specified time \(t_f\) by using only the evolution of a build Hamiltonian \(\mathcal{H}_\text{build}\) (here \(\mathcal{H}_\text{sys}\)) together with local \(X\)-gates. In Qadence, daqc_transform is applicable for \(\mathcal{H}_\text{target}\) and \(\mathcal{H}_\text{build}\) composed only of \(ZZ\)- or \(NN\)-interactions. These generators are parsed by the daqc_transform function and the appropriate type is automatically determined together with the appropriate single-qubit detunings and global phases.

Let's apply it for the CNOT implementation:

from qadence import daqc_transform, Strategy

# Settings for the target CNOT operation
i = 0  # Control qubit
j = 1  # Target qubit
k = 2  # The extra qubit

# Define the target CNOT operation
# by composing with identity on the extra qubit.
cnot_target = kron(CNOT(i, j), I(k))

# The two-qubit NN-Ising interaction term for the CPHASE
h_int = (-1.0) * kron(N(i), N(j))

# Transforming the two-qubit Ising interaction using only our system Hamiltonian
transformed_ising = daqc_transform(
    n_qubits=3,        # Total number of qubits in the transformation
    gen_target=h_int,  # The target Ising generator
    t_f=PI,            # The target evolution time
    gen_build=h_sys,   # The building block Ising generator to be used
    strategy=Strategy.SDAQC,   # Currently only sDAQC is implemented
    ignore_global_phases=False  # Global phases from mapping between Z and N
)

# display(transformed_ising)
%3 cluster_5fad94359df94351bcc893b018803b2c cluster_bde70ad928524d7397e54d218ce143a0 cluster_e146ddfdadb945cca21805f17734942b cluster_25511897718c4bfe9dae03f86cf360c9 cluster_8c9f81bc719e415eab7c56e60c55d241 cluster_1e887a5d1ce84a2f85434f9260b472ab cluster_8f8b32afa72d4857bc6e43ce13a2aae4 2e772e98915e4fc2bc1928251ee37e7a 0 3402b99f77e44bd1a021d88ae21b0c7b HamEvo 2e772e98915e4fc2bc1928251ee37e7a--3402b99f77e44bd1a021d88ae21b0c7b 4336ad5a1b824d4b9182213f569d38f5 1 456c519575984a72a9d5df8ff4626891 HamEvo 3402b99f77e44bd1a021d88ae21b0c7b--456c519575984a72a9d5df8ff4626891 ed799ca8c4eb47f1a8b25b72a0947c4e HamEvo 456c519575984a72a9d5df8ff4626891--ed799ca8c4eb47f1a8b25b72a0947c4e 8aafebccc0f447db877a2f97a2c6b008 X ed799ca8c4eb47f1a8b25b72a0947c4e--8aafebccc0f447db877a2f97a2c6b008 f16bc0f696e548528cdb21c4a41a4165 HamEvo 8aafebccc0f447db877a2f97a2c6b008--f16bc0f696e548528cdb21c4a41a4165 1e0e3031413b418187a1a41cd39e97f7 HamEvo f16bc0f696e548528cdb21c4a41a4165--1e0e3031413b418187a1a41cd39e97f7 c0adf29188ea4c47940d98cab876dd8d X 1e0e3031413b418187a1a41cd39e97f7--c0adf29188ea4c47940d98cab876dd8d 0b51ec0017304076aad9ecd2d218d1cc c0adf29188ea4c47940d98cab876dd8d--0b51ec0017304076aad9ecd2d218d1cc 0db8e24d83bc464f893fb7ece3a003c6 HamEvo 0b51ec0017304076aad9ecd2d218d1cc--0db8e24d83bc464f893fb7ece3a003c6 1e840f438ceb4d4c8d272b2ed0b6e919 HamEvo 0db8e24d83bc464f893fb7ece3a003c6--1e840f438ceb4d4c8d272b2ed0b6e919 1d231501bd6e455089a7cad92f35cfeb 1e840f438ceb4d4c8d272b2ed0b6e919--1d231501bd6e455089a7cad92f35cfeb 93ee6234afd441149ce882915fa1723d 1d231501bd6e455089a7cad92f35cfeb--93ee6234afd441149ce882915fa1723d 64a332e85f0f4608a879425420dd12a4 990cb321af4844e2b4fbb5759113309c t = -3.14 4336ad5a1b824d4b9182213f569d38f5--990cb321af4844e2b4fbb5759113309c a5d7513e1c074d779d1ff7b19e7a0bed 2 939abbf9a850454a99b782413c9fc424 t = 3.142 990cb321af4844e2b4fbb5759113309c--939abbf9a850454a99b782413c9fc424 37c6d8762fb340a688eb01ba9d600c28 t = -3.14 939abbf9a850454a99b782413c9fc424--37c6d8762fb340a688eb01ba9d600c28 7e8bab39a7c74377b633283831c10a47 37c6d8762fb340a688eb01ba9d600c28--7e8bab39a7c74377b633283831c10a47 b610248b81d6400c9f34860b3787f193 t = 1.571 7e8bab39a7c74377b633283831c10a47--b610248b81d6400c9f34860b3787f193 1a14aface8324611aac79bc5a7f994f6 t = 1.571 b610248b81d6400c9f34860b3787f193--1a14aface8324611aac79bc5a7f994f6 26f08c4e4a394ee89ff856e98183e248 1a14aface8324611aac79bc5a7f994f6--26f08c4e4a394ee89ff856e98183e248 e37e26d90ca8458f8c313580475a897d X 26f08c4e4a394ee89ff856e98183e248--e37e26d90ca8458f8c313580475a897d b8c2479fd43d46e6abf97123a3c8f7c3 t = 1.571 e37e26d90ca8458f8c313580475a897d--b8c2479fd43d46e6abf97123a3c8f7c3 99e2ff610aa44b4c9aaa511906c5160b t = 1.571 b8c2479fd43d46e6abf97123a3c8f7c3--99e2ff610aa44b4c9aaa511906c5160b a6df931141a041f9b609beed945f36fb X 99e2ff610aa44b4c9aaa511906c5160b--a6df931141a041f9b609beed945f36fb a6df931141a041f9b609beed945f36fb--64a332e85f0f4608a879425420dd12a4 7814a234593a432c8b8b225ec70ad5d7 69bc6e48e9684c2284bcd4d9dec7960d a5d7513e1c074d779d1ff7b19e7a0bed--69bc6e48e9684c2284bcd4d9dec7960d 539c43ff82d14d398003f9d5b45325cf 69bc6e48e9684c2284bcd4d9dec7960d--539c43ff82d14d398003f9d5b45325cf 970306477f854c2c91914a6b9df732f3 539c43ff82d14d398003f9d5b45325cf--970306477f854c2c91914a6b9df732f3 8bc30dc891ce4f2697906ab28084a979 X 970306477f854c2c91914a6b9df732f3--8bc30dc891ce4f2697906ab28084a979 a893f4e123ad4ba98589d8b6e462c825 8bc30dc891ce4f2697906ab28084a979--a893f4e123ad4ba98589d8b6e462c825 14c05f29833e47379e08429ce5a682a1 a893f4e123ad4ba98589d8b6e462c825--14c05f29833e47379e08429ce5a682a1 ca9b2f5ecb4145ed8c6896ee83c85bb9 X 14c05f29833e47379e08429ce5a682a1--ca9b2f5ecb4145ed8c6896ee83c85bb9 1bba260b0deb4f83ac69a03aafe09db2 X ca9b2f5ecb4145ed8c6896ee83c85bb9--1bba260b0deb4f83ac69a03aafe09db2 5f1db51834eb4baf99d25e8fd3c6b145 1bba260b0deb4f83ac69a03aafe09db2--5f1db51834eb4baf99d25e8fd3c6b145 391c7a78a75d430692a206f88a0f674d 5f1db51834eb4baf99d25e8fd3c6b145--391c7a78a75d430692a206f88a0f674d 2ca88098d31a4bb2b1ae7fa7713aa1b1 X 391c7a78a75d430692a206f88a0f674d--2ca88098d31a4bb2b1ae7fa7713aa1b1 2ca88098d31a4bb2b1ae7fa7713aa1b1--7814a234593a432c8b8b225ec70ad5d7

The output circuit displays three groups of system Hamiltonian evolutions which account for global-phases and single-qubit detunings related to the mapping between the \(Z\) and \(N\) operators. Optionally, global phases can be ignored.

In general, the mapping of a \(n\)-qubit Ising Hamiltonian to another will require at most \(n(n-1)\) evolutions. The transformed circuit performs these evolutions for specific times that are computed from the solution of a linear system of equations involving the set of interactions in the target and build Hamiltonians.

In this case, the mapping is exact when using the step-wise DAQC strategy (Strategy.SDAQC) available in Qadence. In banged DAQC (Strategy.BDAQC) the mapping is approximate, but easier to implement on a physical device with always-on interactions such as neutral-atom systems.

Just as before, the transformed Ising circuit can be checked to exactly recover the CPHASE gate:

# CPHASE on (i, j), Identity on third qubit:
cphase_matrix = block_to_tensor(kron(CPHASE(i, j, phi), I(k)))

# CPHASE using the transformed circuit:
cphase_evo_matrix = block_to_tensor(transformed_ising)

# Check that it implements the CPHASE.
# Will fail if global phases are ignored.
cphase_matrix == cphase_evo_matrix : True

The CNOT gate can now finally be built:

from qadence import equivalent_state, run, sample

cnot_daqc = chain(
    H(j),
    transformed_ising,
    H(j)
)

# And finally apply the CNOT on a specific 3-qubit initial state:
init_state = product_state("101")

# Check we get an equivalent wavefunction
wf_cnot = run(n_qubits, block=cnot_target, state=init_state)
wf_daqc = run(n_qubits, block=cnot_daqc, state=init_state)

# Visualize the CNOT bit-flip in samples.
wf_cnot == wf_dacq : True
sample cnot_target = [OrderedCounter({'111': 100})]
sample cnot_dacq = [OrderedCounter({'111': 100})]

As one can see, a CNOT operation has been succesfully implemented on the desired target qubits by using only the global system as the building block Hamiltonian and single-qubit rotations. Decomposing a single digital gate into an Ising Hamiltonian serves as a proof of principle for the potential of this technique to represent universal quantum computation.

Technical details on the DAQC transformation

  • The mapping between target generator and final circuit is performed by solving a linear system of size \(n(n-1)\) where \(n\) is the number of qubits, so it can be computed efficiently (i.e., with a polynomial cost in the number of qubits).
  • The linear system to be solved is actually not invertible for \(n=4\) qubits. This is very specific edge case requiring a workaround, that is currently not yet implemented.
  • As mentioned, the final circuit has at most \(n(n-1)\) slices, so there is at most a quadratic overhead in circuit depth.

Finally, and most important to its usage:

  • The target Hamiltonian should be sufficiently represented in the building block Hamiltonian.

To illustrate this point, consider the following target and build Hamiltonians:

# Interaction between qubits 0 and 1
gen_target = 1.0 * (Z(0) @ Z(1))

# Fixed interaction between qubits 1 and 2, and customizable between 0 and 1
def gen_build(g_int):
    return g_int * (Z(0) @ Z(1)) + 1.0 * (Z(1) @ Z(2))

And now we perform the DAQC transform by setting g_int=1.0, exactly matching the target Hamiltonian:

transformed_ising = daqc_transform(
    n_qubits=3,
    gen_target=gen_target,
    t_f=1.0,
    gen_build=gen_build(g_int=1.0),
)

# display(transformed_ising)
%3 cluster_55c15d6915af4202842e53d401fefdec cluster_83b6fdb7b59c4d4f972cdc3517baf1e5 08bcb1ca7ca34a48a8637c42a10bafeb 0 6fec83b689c645cf8353826b7a5ef3ce X 08bcb1ca7ca34a48a8637c42a10bafeb--6fec83b689c645cf8353826b7a5ef3ce a3064ad11c404838a2cd39a203c6f8f8 1 1bb897c580cf4b7c89c3ac5e2e8df426 HamEvo 6fec83b689c645cf8353826b7a5ef3ce--1bb897c580cf4b7c89c3ac5e2e8df426 4091a14fc1934fb0a809087157bf5bce X 1bb897c580cf4b7c89c3ac5e2e8df426--4091a14fc1934fb0a809087157bf5bce f4257259896b41dbaaa8c65ab1b3543d 4091a14fc1934fb0a809087157bf5bce--f4257259896b41dbaaa8c65ab1b3543d a10aae74a3dd4132a5971d31455b755d HamEvo f4257259896b41dbaaa8c65ab1b3543d--a10aae74a3dd4132a5971d31455b755d 2fb4fd87269b4c66a3e94834e7d6dbec a10aae74a3dd4132a5971d31455b755d--2fb4fd87269b4c66a3e94834e7d6dbec dcf113bcf5d947c9a92eb575b867b917 2fb4fd87269b4c66a3e94834e7d6dbec--dcf113bcf5d947c9a92eb575b867b917 2bc17196cd144bd5b40abd139f972fab bb8283f517e44c2d9860aef3f437f965 a3064ad11c404838a2cd39a203c6f8f8--bb8283f517e44c2d9860aef3f437f965 beacc9c66f314b23bbc6b3993332abc5 2 b364c8d1df604b4f8a63376efe59875e t = -0.50 bb8283f517e44c2d9860aef3f437f965--b364c8d1df604b4f8a63376efe59875e ed3e4d80b7804c9abb805e49406bb47e b364c8d1df604b4f8a63376efe59875e--ed3e4d80b7804c9abb805e49406bb47e 43a6a4ad51b84bf39b398b286f56bead X ed3e4d80b7804c9abb805e49406bb47e--43a6a4ad51b84bf39b398b286f56bead 269093c6f6c24b2faf6efcc38e766f2f t = -0.50 43a6a4ad51b84bf39b398b286f56bead--269093c6f6c24b2faf6efcc38e766f2f 7064cb34dbd848e9bfda1d1b8c5062d3 X 269093c6f6c24b2faf6efcc38e766f2f--7064cb34dbd848e9bfda1d1b8c5062d3 7064cb34dbd848e9bfda1d1b8c5062d3--2bc17196cd144bd5b40abd139f972fab e13836ec24834ee18fe04c0f0344341f c9aecce4f0db42da9e85bf66e431101e X beacc9c66f314b23bbc6b3993332abc5--c9aecce4f0db42da9e85bf66e431101e 69bd736cb99b44f48de52ba62ba9b6b7 c9aecce4f0db42da9e85bf66e431101e--69bd736cb99b44f48de52ba62ba9b6b7 b019d3310c67488b853dd7b937bdc3bb X 69bd736cb99b44f48de52ba62ba9b6b7--b019d3310c67488b853dd7b937bdc3bb fddcf4cff8324f2e9276c675ecec8904 X b019d3310c67488b853dd7b937bdc3bb--fddcf4cff8324f2e9276c675ecec8904 ced6e05465c1433a855d5ee3964b3f1b fddcf4cff8324f2e9276c675ecec8904--ced6e05465c1433a855d5ee3964b3f1b 0bef6f0abbf54a35b83b6a6782a1fba3 X ced6e05465c1433a855d5ee3964b3f1b--0bef6f0abbf54a35b83b6a6782a1fba3 0bef6f0abbf54a35b83b6a6782a1fba3--e13836ec24834ee18fe04c0f0344341f

Now, if the interaction between qubits 0 and 1 is weakened in the build Hamiltonian:

transformed_ising = daqc_transform(
    n_qubits=3,
    gen_target=gen_target,
    t_f=1.0,
    gen_build=gen_build(g_int=0.001),
)

# display(transformed_ising)
%3 cluster_873ac5dc5cf94752b3495c14049543ee cluster_6262856b90274567983aa9970ab7f48c 9e0543aa658f4876870afd3fcabcee81 0 eb3fed2fd1674ac8bfd9e59863313624 X 9e0543aa658f4876870afd3fcabcee81--eb3fed2fd1674ac8bfd9e59863313624 6992ebe36ea247d296796feea93e2cec 1 e336964b7507459da06c9084f86dfd02 HamEvo eb3fed2fd1674ac8bfd9e59863313624--e336964b7507459da06c9084f86dfd02 5c24bdc23ec34cd3a143c563ff1da917 X e336964b7507459da06c9084f86dfd02--5c24bdc23ec34cd3a143c563ff1da917 57c49e799a2d41fd85fcfa8961e64558 5c24bdc23ec34cd3a143c563ff1da917--57c49e799a2d41fd85fcfa8961e64558 a8c4a36e9a36416db972c4eb0df2cf64 HamEvo 57c49e799a2d41fd85fcfa8961e64558--a8c4a36e9a36416db972c4eb0df2cf64 0e1b088ebf674a2bb8e7f8f928c582ab a8c4a36e9a36416db972c4eb0df2cf64--0e1b088ebf674a2bb8e7f8f928c582ab 4e19a9d2c4bd4cd48566e33a9d4bd1b3 0e1b088ebf674a2bb8e7f8f928c582ab--4e19a9d2c4bd4cd48566e33a9d4bd1b3 7031df51166242f2bf4c4afa87994a34 22dfe87af9c8429ebbac395741b92213 6992ebe36ea247d296796feea93e2cec--22dfe87af9c8429ebbac395741b92213 0a99a80750134705b15a262a35c7c9a5 2 07307c530fd04d0a87141d97927b0bc0 t = -500. 22dfe87af9c8429ebbac395741b92213--07307c530fd04d0a87141d97927b0bc0 77c5da97a5564c878c837f59f95e7a94 07307c530fd04d0a87141d97927b0bc0--77c5da97a5564c878c837f59f95e7a94 8721f0ad8e954560b46aee833261ce4d X 77c5da97a5564c878c837f59f95e7a94--8721f0ad8e954560b46aee833261ce4d 8309cf28121f46ffbf9e73cdaa151bbd t = -500. 8721f0ad8e954560b46aee833261ce4d--8309cf28121f46ffbf9e73cdaa151bbd 0e27fb389611403999798e4eeea67ebb X 8309cf28121f46ffbf9e73cdaa151bbd--0e27fb389611403999798e4eeea67ebb 0e27fb389611403999798e4eeea67ebb--7031df51166242f2bf4c4afa87994a34 d99a15de398b4387bdcb36c73c08ae38 5a75a04f4a8c4d00958181622d628105 X 0a99a80750134705b15a262a35c7c9a5--5a75a04f4a8c4d00958181622d628105 b04085152e1e4fd2af89689c0ffe12b3 5a75a04f4a8c4d00958181622d628105--b04085152e1e4fd2af89689c0ffe12b3 bdf4e3ea37334b63b87d067d4b0de6c6 X b04085152e1e4fd2af89689c0ffe12b3--bdf4e3ea37334b63b87d067d4b0de6c6 1a7a48cdbb2b479290f7dc03dc3d9922 X bdf4e3ea37334b63b87d067d4b0de6c6--1a7a48cdbb2b479290f7dc03dc3d9922 b3e71a1ab78c49c393f77085b3c9d2ae 1a7a48cdbb2b479290f7dc03dc3d9922--b3e71a1ab78c49c393f77085b3c9d2ae 65791c4c3f3744b7a8032f9517374d7e X b3e71a1ab78c49c393f77085b3c9d2ae--65791c4c3f3744b7a8032f9517374d7e 65791c4c3f3744b7a8032f9517374d7e--d99a15de398b4387bdcb36c73c08ae38

The times slices using the build Hamiltonian need now to evolve for much longer to represent the same interaction since it is not sufficiently represented in the building block Hamiltonian.

In the limit where that interaction is not present, the transform will not work:

try:
    transformed_ising = daqc_transform(
        n_qubits=3,
        gen_target=gen_target,
        t_f=1.0,
        gen_build=gen_build(g_int = 0.0),
    )
except ValueError as error:
    print("Error:", error)
Error: Incompatible interactions between target and build Hamiltonians.

References