Skip to content

Pauli and Fermion operators add Identity offset when there is a leading +/- sign character #547

@1tnguyen

Description

@1tnguyen

Test cases:

  1. Pauli
TEST(PauliOperatorTester, checkLeadingSignCharacter) {
    std::string src = "- 0.5 Z0 Z1 + 1.2 Z1 Z2";
    PauliOperator op(src);
    std::cout << op.toString() << "\n";
}

The printout contains an extra +1 offset: (1,0) + (-0.5,-0) Z0 Z1 + (1.2,0) Z1 Z2

  1. Fermion
TEST(FermionOperatorTester, checkLeadingSignCharacter) {
    std::string src = "+ 0.5 1^ 0 + 1.2 2^ 3";
    FermionOperator op(src);
    std::cout << op.toString() << "\n";
}

The printout contains an extra +1 offset: (1,0) + (0.5,0) 1^ 0 + (1.2,0) 2^ 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions