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_048df798082746d5bf32d8722d1bc9d8 cluster_5cf43df75c0e4a669badf25b9d2ccc67 cluster_3f3ede2e0c28487ab75f88e29248eab7 cluster_eb39c977790344879ff377b3b8c82f98 cluster_eda8df0fc06a40a8b6067fd85060e881 cluster_13d541c467ed4c0395a039d790131f6e cluster_b8152701e99d4cacbd9e2623036eafbc 9940b203a7fe436398c46ffe513b0480 0 f7c39dfdf1704a13a2ed9758caf982c8 HamEvo 9940b203a7fe436398c46ffe513b0480--f7c39dfdf1704a13a2ed9758caf982c8 f67781528ffe4574842e3251a30f70b1 1 f16ec09ab0304b9a94456a18fdcda6fe HamEvo f7c39dfdf1704a13a2ed9758caf982c8--f16ec09ab0304b9a94456a18fdcda6fe 15555de19f524a20bbec9a51365dade1 HamEvo f16ec09ab0304b9a94456a18fdcda6fe--15555de19f524a20bbec9a51365dade1 9c645b38c6604f88a7994e914de8d606 X 15555de19f524a20bbec9a51365dade1--9c645b38c6604f88a7994e914de8d606 0d4b24c44c954b4a9434f46dfd36e7aa HamEvo 9c645b38c6604f88a7994e914de8d606--0d4b24c44c954b4a9434f46dfd36e7aa 3a942b9896bd413b94b82d5f0a7f4666 HamEvo 0d4b24c44c954b4a9434f46dfd36e7aa--3a942b9896bd413b94b82d5f0a7f4666 78c1d93786614f598ccfdb85bb57eeab X 3a942b9896bd413b94b82d5f0a7f4666--78c1d93786614f598ccfdb85bb57eeab 1c59e4c8f9ce430bbd15a50a9858eeee 78c1d93786614f598ccfdb85bb57eeab--1c59e4c8f9ce430bbd15a50a9858eeee 754a2989ad58443d8c25d22888a2d0d0 HamEvo 1c59e4c8f9ce430bbd15a50a9858eeee--754a2989ad58443d8c25d22888a2d0d0 37bb74357cf14c6c8258ccad3fa3a489 HamEvo 754a2989ad58443d8c25d22888a2d0d0--37bb74357cf14c6c8258ccad3fa3a489 c8207dfe15d5432db916f21aa1d2b5ed 37bb74357cf14c6c8258ccad3fa3a489--c8207dfe15d5432db916f21aa1d2b5ed 082d98d5dd6748eb9e17e690ecbd207d c8207dfe15d5432db916f21aa1d2b5ed--082d98d5dd6748eb9e17e690ecbd207d 564cd3417de245a69b31a996e99e9ab6 e3cfbf7c91f2497da518fa00927bd93c t = -3.14 f67781528ffe4574842e3251a30f70b1--e3cfbf7c91f2497da518fa00927bd93c 81f51d69fa324cbe9a4b5437de024f3c 2 bca1c75df4af4cf4aaeeacb3747b6e32 t = 3.142 e3cfbf7c91f2497da518fa00927bd93c--bca1c75df4af4cf4aaeeacb3747b6e32 55c6313680cf4656ba06b157664fda26 t = -3.14 bca1c75df4af4cf4aaeeacb3747b6e32--55c6313680cf4656ba06b157664fda26 dbf8574d4cfb41b49c8e70d97d7b79d6 55c6313680cf4656ba06b157664fda26--dbf8574d4cfb41b49c8e70d97d7b79d6 00d718fbdd934650adf90544c5f5cea7 t = 1.571 dbf8574d4cfb41b49c8e70d97d7b79d6--00d718fbdd934650adf90544c5f5cea7 0d56a9d12ded47f1a1d9faa84e068c3b t = 1.571 00d718fbdd934650adf90544c5f5cea7--0d56a9d12ded47f1a1d9faa84e068c3b 4616b7afa03c489ab361251ab06dbb2a 0d56a9d12ded47f1a1d9faa84e068c3b--4616b7afa03c489ab361251ab06dbb2a 2d215a3c34e54d9ea2c822140cb1713a X 4616b7afa03c489ab361251ab06dbb2a--2d215a3c34e54d9ea2c822140cb1713a 161438eb9503471fa486bc5898fd5182 t = 1.571 2d215a3c34e54d9ea2c822140cb1713a--161438eb9503471fa486bc5898fd5182 708f3b9ea79240b5b7ed7aa978966a2b t = 1.571 161438eb9503471fa486bc5898fd5182--708f3b9ea79240b5b7ed7aa978966a2b 417aa72d19b3474c88ce56c93145dade X 708f3b9ea79240b5b7ed7aa978966a2b--417aa72d19b3474c88ce56c93145dade 417aa72d19b3474c88ce56c93145dade--564cd3417de245a69b31a996e99e9ab6 9a85e96805214ef3b6f3ac9115701de9 e39e82760ad547609bf6d0f16a4fb655 81f51d69fa324cbe9a4b5437de024f3c--e39e82760ad547609bf6d0f16a4fb655 577917f825224b63980b04489e3a4b2b e39e82760ad547609bf6d0f16a4fb655--577917f825224b63980b04489e3a4b2b 243f9d9e74f04fb5ac16c36e8a73f0e0 577917f825224b63980b04489e3a4b2b--243f9d9e74f04fb5ac16c36e8a73f0e0 0ec9215f030a4cb2a3b91e285d0191c9 X 243f9d9e74f04fb5ac16c36e8a73f0e0--0ec9215f030a4cb2a3b91e285d0191c9 0a251073ab11434c8de57ae56ca2a102 0ec9215f030a4cb2a3b91e285d0191c9--0a251073ab11434c8de57ae56ca2a102 bc9b6628b8254cc99c89c81cc68c8eda 0a251073ab11434c8de57ae56ca2a102--bc9b6628b8254cc99c89c81cc68c8eda d655cb2578dd417f80db3b8385c5ad54 X bc9b6628b8254cc99c89c81cc68c8eda--d655cb2578dd417f80db3b8385c5ad54 007a78764146403dacbc4c4cb2f85cda X d655cb2578dd417f80db3b8385c5ad54--007a78764146403dacbc4c4cb2f85cda 179de2223eb6431e8f777fe81ebdfcca 007a78764146403dacbc4c4cb2f85cda--179de2223eb6431e8f777fe81ebdfcca 500be0bcd32b417b998def460027fa55 179de2223eb6431e8f777fe81ebdfcca--500be0bcd32b417b998def460027fa55 851a0526a0594c5a97dafa4009e4fad3 X 500be0bcd32b417b998def460027fa55--851a0526a0594c5a97dafa4009e4fad3 851a0526a0594c5a97dafa4009e4fad3--9a85e96805214ef3b6f3ac9115701de9

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_b9af06ddff7d4fb08309f5440b3142f3 cluster_543134e9257e424fba9c4068d4e619ac f3cbfcc4600c48e1b6fcfde40c4ab030 0 3d7a24ee0ed84a119727ca4d2dc84af7 X f3cbfcc4600c48e1b6fcfde40c4ab030--3d7a24ee0ed84a119727ca4d2dc84af7 f809b37af327433bbf9133aaed80fef3 1 cc66b117f4ee4c46a8b6da49accdee6a HamEvo 3d7a24ee0ed84a119727ca4d2dc84af7--cc66b117f4ee4c46a8b6da49accdee6a 7358e206f00e4f129a18297cb37fceff X cc66b117f4ee4c46a8b6da49accdee6a--7358e206f00e4f129a18297cb37fceff eb5f2dc84e0d4b13928bb1de4f087721 7358e206f00e4f129a18297cb37fceff--eb5f2dc84e0d4b13928bb1de4f087721 de490c80581e44b6bf830b8f0a4cd485 HamEvo eb5f2dc84e0d4b13928bb1de4f087721--de490c80581e44b6bf830b8f0a4cd485 841370421d6a4a02b76b6cc0cb7d32fe de490c80581e44b6bf830b8f0a4cd485--841370421d6a4a02b76b6cc0cb7d32fe 7f6d8d8f4bf0441e9d883eaa982d81ec 841370421d6a4a02b76b6cc0cb7d32fe--7f6d8d8f4bf0441e9d883eaa982d81ec 034b8967d78c407a9b208f53631f168a 74e3bc4e59674b68b776215683c0a4e3 f809b37af327433bbf9133aaed80fef3--74e3bc4e59674b68b776215683c0a4e3 bb77b54a538a49fe85327c86df4d24bc 2 eba511a7f209466d985944736a708099 t = -0.50 74e3bc4e59674b68b776215683c0a4e3--eba511a7f209466d985944736a708099 f4c5bf6cf5b64a828e98f3bbdcad3004 eba511a7f209466d985944736a708099--f4c5bf6cf5b64a828e98f3bbdcad3004 f1c1e841073c4174befc33b8f2bbe55c X f4c5bf6cf5b64a828e98f3bbdcad3004--f1c1e841073c4174befc33b8f2bbe55c 0082b89cabd74035aa5e724bb81d8092 t = -0.50 f1c1e841073c4174befc33b8f2bbe55c--0082b89cabd74035aa5e724bb81d8092 ef8753dea5384c4fa1090184829da911 X 0082b89cabd74035aa5e724bb81d8092--ef8753dea5384c4fa1090184829da911 ef8753dea5384c4fa1090184829da911--034b8967d78c407a9b208f53631f168a 49353cebe9ac442b907680b6bbd6afe1 d962525a9ed147af829bb98bddae6c8a X bb77b54a538a49fe85327c86df4d24bc--d962525a9ed147af829bb98bddae6c8a dfc19c0ea2c74b988490689543d57753 d962525a9ed147af829bb98bddae6c8a--dfc19c0ea2c74b988490689543d57753 87ed3a529cdb442a9ac39f736357d108 X dfc19c0ea2c74b988490689543d57753--87ed3a529cdb442a9ac39f736357d108 840e2ff11519479db289ca03d3fb6296 X 87ed3a529cdb442a9ac39f736357d108--840e2ff11519479db289ca03d3fb6296 93586f8a173e44a08a7a1b9107b13b11 840e2ff11519479db289ca03d3fb6296--93586f8a173e44a08a7a1b9107b13b11 f3ca2286c09b422e80dbb53bcea48a66 X 93586f8a173e44a08a7a1b9107b13b11--f3ca2286c09b422e80dbb53bcea48a66 f3ca2286c09b422e80dbb53bcea48a66--49353cebe9ac442b907680b6bbd6afe1

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_67f7f74c5afb4b4baf0d0c5129eb7ff2 cluster_69fd93ec0b8641ff91b3e9d2d38ddea2 0cd6efcac5f84cc1befa6cec0cef9ab0 0 5d642adc8b5142daa7dd7aae225cdadf X 0cd6efcac5f84cc1befa6cec0cef9ab0--5d642adc8b5142daa7dd7aae225cdadf 086794984e07482d86d61772c5e8f903 1 7b86c98f6aee4c6f9eee65222f9c2ad7 HamEvo 5d642adc8b5142daa7dd7aae225cdadf--7b86c98f6aee4c6f9eee65222f9c2ad7 7903f4335ca64ada9f2ac3a286015e4a X 7b86c98f6aee4c6f9eee65222f9c2ad7--7903f4335ca64ada9f2ac3a286015e4a 1150626f84c44e508d6c8a9573f8330f 7903f4335ca64ada9f2ac3a286015e4a--1150626f84c44e508d6c8a9573f8330f c24ad31d04ec4bc2b7c50fbca7a58f4f HamEvo 1150626f84c44e508d6c8a9573f8330f--c24ad31d04ec4bc2b7c50fbca7a58f4f 1ee71f23a0934ced8bbfa0b69142c628 c24ad31d04ec4bc2b7c50fbca7a58f4f--1ee71f23a0934ced8bbfa0b69142c628 d4637e455ba4400ea58a136fde496e91 1ee71f23a0934ced8bbfa0b69142c628--d4637e455ba4400ea58a136fde496e91 90f5ad45e3e04866bc5f3e16a67edd57 4f99d3c12b0f43cc885764a01b611a3c 086794984e07482d86d61772c5e8f903--4f99d3c12b0f43cc885764a01b611a3c c87f68ae27db42d889b59a93002d4e1f 2 a7856d55dccc48bda912ac48a6601101 t = -500. 4f99d3c12b0f43cc885764a01b611a3c--a7856d55dccc48bda912ac48a6601101 8ad8aa3280f54ae8ad117b0ba51b3ade a7856d55dccc48bda912ac48a6601101--8ad8aa3280f54ae8ad117b0ba51b3ade a61b37aa66b3412c9af0f71e704c2b78 X 8ad8aa3280f54ae8ad117b0ba51b3ade--a61b37aa66b3412c9af0f71e704c2b78 0538eb886b894d418170de0e08fd73a9 t = -500. a61b37aa66b3412c9af0f71e704c2b78--0538eb886b894d418170de0e08fd73a9 ef56f013f8264bde8bfabe1627333798 X 0538eb886b894d418170de0e08fd73a9--ef56f013f8264bde8bfabe1627333798 ef56f013f8264bde8bfabe1627333798--90f5ad45e3e04866bc5f3e16a67edd57 c4bc55b0d78443ed84104c01fa930cec eb3555cecaba4c1c9b349d8b211022f5 X c87f68ae27db42d889b59a93002d4e1f--eb3555cecaba4c1c9b349d8b211022f5 25ad9e30f92f4374a056e5078d8e29d8 eb3555cecaba4c1c9b349d8b211022f5--25ad9e30f92f4374a056e5078d8e29d8 3ecf8c8a74c343adb26d86ac88d76926 X 25ad9e30f92f4374a056e5078d8e29d8--3ecf8c8a74c343adb26d86ac88d76926 c74ddb18bfde4243a85c3bf2223b790f X 3ecf8c8a74c343adb26d86ac88d76926--c74ddb18bfde4243a85c3bf2223b790f 519fa0fa180a475a919c8890aca28049 c74ddb18bfde4243a85c3bf2223b790f--519fa0fa180a475a919c8890aca28049 f23b3ba506d64160a823d867cae3ac87 X 519fa0fa180a475a919c8890aca28049--f23b3ba506d64160a823d867cae3ac87 f23b3ba506d64160a823d867cae3ac87--c4bc55b0d78443ed84104c01fa930cec

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