OpenFermion icon indicating copy to clipboard operation
OpenFermion copied to clipboard

get_sparse_operator fails on non-simplified QubitOperators

Open jagunther opened this issue 1 year ago • 1 comments

Hi,

I noticed that get_sparse_operator() assumes that Paulistrings in a QubitOperator are simplified, i.e. there should be no Paulis within a Paulistring acting on the same tensor-factor. Normally when initialising a QubitOperator the simplification is done automatically, however, the Symmetry-conserving Bravyi-Kitaev transform does not do this. Below is a small example:

from openfermion import (
    get_sparse_operator,
    FermionOperator,
    symmetry_conserving_bravyi_kitaev,
)

fermion_op = FermionOperator("0^ 1^")
qubit_op = symmetry_conserving_bravyi_kitaev(fermion_op, 4, 2)
print(qubit_op)

# throws error
get_sparse_operator(qubit_op)

jagunther avatar Apr 30 '24 07:04 jagunther

Hey @jagunther If no one is working on this issue I would like to take it up.

noobyogi0010 avatar Jan 11 '25 17:01 noobyogi0010