1
$\begingroup$

I am trying to implement the method in the following paper: Exponential Quantum Speedup in Simulating Coupled Classical Oscillators using Qiskit.

All is good until I call evolve on TrotterQRTE. It is expecting a (Sparse)PauliOp but I want top use an Operator as this can be created from a matrix much more generically.

Is there a way to convert an Operator to a (Sparse)PauliOp, or use TrotterQRTE in a different way?

For simplicity I am currently using the following Hamiltonian: $$ \mathcal{H}= \begin{pmatrix} 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\\ 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0 \end{pmatrix} $$ But it is not necessarily this simple.

$\endgroup$

1 Answer 1

1
$\begingroup$

You can use SparsePauliOp.from_operator() method to construct a SparsePauliOp from an Operator:

from qiskit.quantum_info import SparsePauliOp

H = [
    [0, 0, 1, 0],
    [0, 0, 0, 1],
    [1, 0, 0, 0],
    [0, 1, 0, 0],
]

op = SparsePauliOp.from_operator(H)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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