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 = [Counter({'11': 100})]
sample from decomposed CNOT gate and 100 shots = [Counter({'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 = [Counter({'11': 100})]
sample cnot_evo = [Counter({'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.00000000000000] 
   └── KronBlock(0,1)
       ├── N(1)
       └── N(0)
├── [mul: 1.00000000000000] 
   └── KronBlock(0,2)
       ├── N(2)
       └── N(0)
└── [mul: 1.00000000000000] 
    └── 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_449aff1a1b0b43f6aa93472172cd6d80 cluster_6a5068d6e7eb4895b2c9114578471944 cluster_7021f87a693e4da28b242d41ea0dd320 cluster_7d4dc2c1a3b8422dbc1dd57a35e4a3f5 cluster_b086620f1dfd4ad0b5c663a017388553 cluster_02d15647eb7b4c82867c20b88edbc093 cluster_982e19691aec43a694b4bcb2bddb9c2d 0fddfec191144e859964fb513a54570d 0 1dd4276714e6417e841c382eb0ff9a33 HamEvo 0fddfec191144e859964fb513a54570d--1dd4276714e6417e841c382eb0ff9a33 82405d0194924bd58ba5c4e0413b3cb8 1 25c5cd21be6d416896c955eac7034ba7 HamEvo 1dd4276714e6417e841c382eb0ff9a33--25c5cd21be6d416896c955eac7034ba7 b8f66b7d3a9b47a8b01362167c82cd71 HamEvo 25c5cd21be6d416896c955eac7034ba7--b8f66b7d3a9b47a8b01362167c82cd71 eec0015cfdce45c5917c6d1b735a9c65 X b8f66b7d3a9b47a8b01362167c82cd71--eec0015cfdce45c5917c6d1b735a9c65 43e2aeb639f84c76bc7d813a32b241e3 HamEvo eec0015cfdce45c5917c6d1b735a9c65--43e2aeb639f84c76bc7d813a32b241e3 c13a688318ae4f0081321a1dc125a6a0 HamEvo 43e2aeb639f84c76bc7d813a32b241e3--c13a688318ae4f0081321a1dc125a6a0 fe0bb0eb260c40f3addf6c6eb1e806a1 X c13a688318ae4f0081321a1dc125a6a0--fe0bb0eb260c40f3addf6c6eb1e806a1 e9e9f1ea39bc43bfa5add8c63b8bff47 fe0bb0eb260c40f3addf6c6eb1e806a1--e9e9f1ea39bc43bfa5add8c63b8bff47 7fafdeb593f74af0a007edc58b1aea08 HamEvo e9e9f1ea39bc43bfa5add8c63b8bff47--7fafdeb593f74af0a007edc58b1aea08 3b53d79ce5ea4732b5149d72dcfc85fc HamEvo 7fafdeb593f74af0a007edc58b1aea08--3b53d79ce5ea4732b5149d72dcfc85fc 3d02e308ec3542f9be867cfdb99a63c9 3b53d79ce5ea4732b5149d72dcfc85fc--3d02e308ec3542f9be867cfdb99a63c9 0773520ae2ca43f4ae1101bbc081a782 3d02e308ec3542f9be867cfdb99a63c9--0773520ae2ca43f4ae1101bbc081a782 720e9365aada4d5e9319b7fcc37467c7 d32b5a566fd74868980b423b5ab2a8e1 t = -3.142 82405d0194924bd58ba5c4e0413b3cb8--d32b5a566fd74868980b423b5ab2a8e1 c004b053614a47d9992f978dcee049b8 2 34395e135ed8440e983eb345b6881e39 t = 3.142 d32b5a566fd74868980b423b5ab2a8e1--34395e135ed8440e983eb345b6881e39 0c4dec7646ad4dac895088ae3f673012 t = -3.142 34395e135ed8440e983eb345b6881e39--0c4dec7646ad4dac895088ae3f673012 22af938abe20405c9b6a50acb2fb255f 0c4dec7646ad4dac895088ae3f673012--22af938abe20405c9b6a50acb2fb255f e38b7e1ac8354aef8452f29aa6d30257 t = 1.571 22af938abe20405c9b6a50acb2fb255f--e38b7e1ac8354aef8452f29aa6d30257 81bc051a45014b44a8a20ca285fe594d t = 1.571 e38b7e1ac8354aef8452f29aa6d30257--81bc051a45014b44a8a20ca285fe594d 5701100995f4454ab30a2852292fdb7c 81bc051a45014b44a8a20ca285fe594d--5701100995f4454ab30a2852292fdb7c a8b84c76e14c48b5b9252587854cc2b7 X 5701100995f4454ab30a2852292fdb7c--a8b84c76e14c48b5b9252587854cc2b7 256a1754039c44a3b0bc305498a2d326 t = 1.571 a8b84c76e14c48b5b9252587854cc2b7--256a1754039c44a3b0bc305498a2d326 ab3416434e8a438cbe7e0c983a3afa18 t = 1.571 256a1754039c44a3b0bc305498a2d326--ab3416434e8a438cbe7e0c983a3afa18 f48b1c68180945189291967740a8879c X ab3416434e8a438cbe7e0c983a3afa18--f48b1c68180945189291967740a8879c f48b1c68180945189291967740a8879c--720e9365aada4d5e9319b7fcc37467c7 f99e7d9834694adc97be279369d1b03d 5e826980fea9441b8387540de02b788f c004b053614a47d9992f978dcee049b8--5e826980fea9441b8387540de02b788f d6ebbb9f59504a09994d69762ab0875b 5e826980fea9441b8387540de02b788f--d6ebbb9f59504a09994d69762ab0875b 0f9d4dc5062647e284286fe2bc7e0a63 d6ebbb9f59504a09994d69762ab0875b--0f9d4dc5062647e284286fe2bc7e0a63 2c9678137d6648f18ab9ba8f31806b0d X 0f9d4dc5062647e284286fe2bc7e0a63--2c9678137d6648f18ab9ba8f31806b0d c003d1aff28248a38c4d43745680ee83 2c9678137d6648f18ab9ba8f31806b0d--c003d1aff28248a38c4d43745680ee83 3c06e15c59d14cfea6f64ddd962e7ccc c003d1aff28248a38c4d43745680ee83--3c06e15c59d14cfea6f64ddd962e7ccc df0d0daebe0345d8b0840667f44dc15a X 3c06e15c59d14cfea6f64ddd962e7ccc--df0d0daebe0345d8b0840667f44dc15a 4108b6c51e6440148948c8bf9a378115 X df0d0daebe0345d8b0840667f44dc15a--4108b6c51e6440148948c8bf9a378115 f65939422502492ba0ebb02a0681169a 4108b6c51e6440148948c8bf9a378115--f65939422502492ba0ebb02a0681169a 30d416e9b02b43bf977f1501290b5fe7 f65939422502492ba0ebb02a0681169a--30d416e9b02b43bf977f1501290b5fe7 0c8275278d964e8aad5f97915e271b94 X 30d416e9b02b43bf977f1501290b5fe7--0c8275278d964e8aad5f97915e271b94 0c8275278d964e8aad5f97915e271b94--f99e7d9834694adc97be279369d1b03d

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 = [Counter({'111': 100})]
sample cnot_dacq = [Counter({'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_3353798815944bb7acc8c4c68d49addb cluster_ba2d3b694e4941728d00ca248a7213af ddaf9e1f6bbb40538b1118423a56f1ae 0 82ed6e8e7d8f4650873b60e315735a08 X ddaf9e1f6bbb40538b1118423a56f1ae--82ed6e8e7d8f4650873b60e315735a08 1a443b59410d4942a713aea1eb3bbc58 1 81ce4ee19af84c94aef7b51b305e5a58 HamEvo 82ed6e8e7d8f4650873b60e315735a08--81ce4ee19af84c94aef7b51b305e5a58 7ecaa3d13c9a49d4ae8b502a1060d92f X 81ce4ee19af84c94aef7b51b305e5a58--7ecaa3d13c9a49d4ae8b502a1060d92f 0d530e2df2204e46b67a82ba18b1bf55 7ecaa3d13c9a49d4ae8b502a1060d92f--0d530e2df2204e46b67a82ba18b1bf55 7da79e1116a547488d09461b68ef881e HamEvo 0d530e2df2204e46b67a82ba18b1bf55--7da79e1116a547488d09461b68ef881e 4f397721dc6f42589c2b421f36146e2b 7da79e1116a547488d09461b68ef881e--4f397721dc6f42589c2b421f36146e2b 715048075b5f4405828f6682f4f5bcf6 4f397721dc6f42589c2b421f36146e2b--715048075b5f4405828f6682f4f5bcf6 ca1649b98a424643ac3bdef912b37c97 0feebdcb73bb43eaac917d16a5202ea1 1a443b59410d4942a713aea1eb3bbc58--0feebdcb73bb43eaac917d16a5202ea1 2cb0e9a463de4ef88ac901b086fa1c6d 2 449ae8ad2f1f4052bbb93b23ddf5e8d9 t = -0.500 0feebdcb73bb43eaac917d16a5202ea1--449ae8ad2f1f4052bbb93b23ddf5e8d9 19b98ccec2ce490882736014ca52e5d2 449ae8ad2f1f4052bbb93b23ddf5e8d9--19b98ccec2ce490882736014ca52e5d2 138d6a3e8f9a4716bf34184b6eae7b32 X 19b98ccec2ce490882736014ca52e5d2--138d6a3e8f9a4716bf34184b6eae7b32 14c383cf404e4350a031b24cb610eaf1 t = -0.500 138d6a3e8f9a4716bf34184b6eae7b32--14c383cf404e4350a031b24cb610eaf1 079da6ade8f845eebf3fddee0facd7b1 X 14c383cf404e4350a031b24cb610eaf1--079da6ade8f845eebf3fddee0facd7b1 079da6ade8f845eebf3fddee0facd7b1--ca1649b98a424643ac3bdef912b37c97 c0633f68a1ba4c728be736178490b9c1 41c021f08dac412cbac9e880e8b75b02 X 2cb0e9a463de4ef88ac901b086fa1c6d--41c021f08dac412cbac9e880e8b75b02 3e811de6e004498093ba6487c89eee5d 41c021f08dac412cbac9e880e8b75b02--3e811de6e004498093ba6487c89eee5d ab118e97dd34478b98be608803a8c5d6 X 3e811de6e004498093ba6487c89eee5d--ab118e97dd34478b98be608803a8c5d6 dc81f82e643c4f1f89640173b1c8166c X ab118e97dd34478b98be608803a8c5d6--dc81f82e643c4f1f89640173b1c8166c f8e46edf057c473cb5ddbd240f6eb1a0 dc81f82e643c4f1f89640173b1c8166c--f8e46edf057c473cb5ddbd240f6eb1a0 cf050d95e8d14ac1bbdaa864ebc2410e X f8e46edf057c473cb5ddbd240f6eb1a0--cf050d95e8d14ac1bbdaa864ebc2410e cf050d95e8d14ac1bbdaa864ebc2410e--c0633f68a1ba4c728be736178490b9c1

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_64ad45e308f44239afe649399d7caa77 cluster_9dee78bb7b80415e8a6b52e6eb2de483 0740831e05bc452d86d6f0c541bc36c1 0 3fb32cbf2d65473fbe8c2824d74e71fe X 0740831e05bc452d86d6f0c541bc36c1--3fb32cbf2d65473fbe8c2824d74e71fe 437e2b090caa4e2c80a2b0da9ba9d646 1 cb23d4b95f5f416ebae44d1fff821467 HamEvo 3fb32cbf2d65473fbe8c2824d74e71fe--cb23d4b95f5f416ebae44d1fff821467 23550e59bde6460d8e5d4488329068c0 X cb23d4b95f5f416ebae44d1fff821467--23550e59bde6460d8e5d4488329068c0 653cc4e47b144b278fadeb3551d06e7f 23550e59bde6460d8e5d4488329068c0--653cc4e47b144b278fadeb3551d06e7f 1b5460598af243e79372cd0e60fbecf5 HamEvo 653cc4e47b144b278fadeb3551d06e7f--1b5460598af243e79372cd0e60fbecf5 171233f579bd46689315d5d9b0105973 1b5460598af243e79372cd0e60fbecf5--171233f579bd46689315d5d9b0105973 9722266ec98d4f76882aab84cfa84891 171233f579bd46689315d5d9b0105973--9722266ec98d4f76882aab84cfa84891 746198ed20d8491fa9509eda7ac19711 b02d2a0145724a69b02a846b82157aba 437e2b090caa4e2c80a2b0da9ba9d646--b02d2a0145724a69b02a846b82157aba 0444b0b3401348cd9e4e25d503f94a39 2 00ffbdc94c0f4077b9e5a44bac64d5c3 t = -500.000000000000 b02d2a0145724a69b02a846b82157aba--00ffbdc94c0f4077b9e5a44bac64d5c3 1d39a842adce4e0388fe9c9fd3a7d6dc 00ffbdc94c0f4077b9e5a44bac64d5c3--1d39a842adce4e0388fe9c9fd3a7d6dc 3c6efd6901cb48518e1a0ad0864c248b X 1d39a842adce4e0388fe9c9fd3a7d6dc--3c6efd6901cb48518e1a0ad0864c248b e8c8003784154c92bd60271dad7aa352 t = -500.000000000000 3c6efd6901cb48518e1a0ad0864c248b--e8c8003784154c92bd60271dad7aa352 8f7f9859b6ad4380b3d1f024be9bee6a X e8c8003784154c92bd60271dad7aa352--8f7f9859b6ad4380b3d1f024be9bee6a 8f7f9859b6ad4380b3d1f024be9bee6a--746198ed20d8491fa9509eda7ac19711 49b181883f6e463da3f17401f4ab4ebd 07a64f98d9be43b3a59430a543766903 X 0444b0b3401348cd9e4e25d503f94a39--07a64f98d9be43b3a59430a543766903 9209cfcfcd2f41a4b2435c6c2afbd34c 07a64f98d9be43b3a59430a543766903--9209cfcfcd2f41a4b2435c6c2afbd34c 6d15ed23450b463296e8125b8245960d X 9209cfcfcd2f41a4b2435c6c2afbd34c--6d15ed23450b463296e8125b8245960d fecd6cd694134d4298a7c42bd971fa69 X 6d15ed23450b463296e8125b8245960d--fecd6cd694134d4298a7c42bd971fa69 f3fb7efc7ece418f99452e4fdfacb840 fecd6cd694134d4298a7c42bd971fa69--f3fb7efc7ece418f99452e4fdfacb840 11291d3bafa94c5b82121c7b371d0e32 X f3fb7efc7ece418f99452e4fdfacb840--11291d3bafa94c5b82121c7b371d0e32 11291d3bafa94c5b82121c7b371d0e32--49b181883f6e463da3f17401f4ab4ebd

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