Skip to content

Applying Jordan-Wigner to FermionOperator vs. InteractionOperator #479

@max-radin

Description

@max-radin

In some cases the result of a Jordan-Wigner transform applied to an InteractionOperator is different if it is converted to a FermionOperator first, as shown in the code below. It seems like jordan_wigner_interaction_op only gives the correct result for Hermitian operators.

from openfermion.ops import InteractionOperator
from openfermion.transforms import get_fermion_operator, jordan_wigner
import numpy as np

N = 4
kappa = np.zeros((N, N))
kappa[0,3] = 2.0
op = InteractionOperator(0., -kappa, np.zeros((N, N, N, N)))

qubit_op1 = jordan_wigner(op)
print(qubit_op1)
# -0.5 [X0 Z1 Z2 X3] +
# -0.5 [Y0 Z1 Z2 Y3]

qubit_op2 = jordan_wigner(get_fermion_operator(op))
print(qubit_op2)
# (-0.5+0j) [X0 Z1 Z2 X3] +
# -0.5j [X0 Z1 Z2 Y3] +
# 0.5j [Y0 Z1 Z2 X3] +
# (-0.5+0j) [Y0 Z1 Z2 Y3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/docsInvolves documentation, notebooks, README files, and similarhelp wantedpriority/p2Medium priority
    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions