Open
Description
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)