1
$\begingroup$

I am not sure if this is a trivial question and I am just stuck or this is worth posting. I have a Hamiltonian, which is written in terms of Pauli matrices, such as

H = 4.5$I$ - 16 $X_1$ - 16 $X_2$ - 3.5 $Z_1Z_4$ -3.5 $Z_1Z_2Z_3$

and I would like to write it as a CH gate in qiskit to find the energy of the ground state. The idea is to write the Hamiltonian into matrix form and write $\matrix{\mathbb{1}\ 0\\ 0\ H}$ as a matrix.

Then use the QuantumCircuit.unitary() command to encode it. My issue is that H is non-unitary, this can be seen by already my first term 4.5$I$, where $I$ is $\mathbb{1}$. Is there a simple trick of encoding my Hamiltonian in a quantum circuit on qiskit?

$\endgroup$
1
1
$\begingroup$

Would the Operator Flow feature be helpful?

https://qiskit.org/documentation/tutorials/operators/01_operator_flow.html

$\endgroup$
1
  • 1
    $\begingroup$ this works perfectly, it forces me to write each gate individually as CX gate but it is possible. Thank you $\endgroup$
    – Luca
    Jan 10 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.