Pauli decomposed Hamiltonian as Diagonal U gate

While trying to implement a quantum circuit, I had to apply Hadamard gates to all qubits to achieve equal superposition. Done.

The next operation is decomposing the Hamiltonian into a sum of tensor products of Pauli matrices. and then applying it as a diagonal U gate?

I have derived the terms of the Pauli decomposition of the in the form (co-efficient, $$\\{X,Y,Z,I\\}^1$$, $$\\{X,Y,Z,I\\}^1$$) using pennylane.pauli_decompose(Hamiltonian_matrix)

How can I implement the diagonal U gate (preferably in Qiskit)?

Also, what is the equivalent function of pauli_decompose() in Qiskit?

• Maybe I got something wrong but I'm not sure about what you mean by "applying it as a diagonal U gate"; do you mean that you want to find some diagonal $U = B^{\dagger} \hat{H} B$ given your Hamiltonian $\hat{H}$ and the proper change of basis represented by $B$? Mar 15, 2023 at 11:05
• Apart from the comment above, the Qiskit function to decompose a matrix to Pauli terms is SparsePauliOp.from_operator(Hamiltonian_matrix) importing the SparsePauliOp class from the qiskit.quantum_info module. Mar 15, 2023 at 11:20