Skip to content

Consider extending createInlinePauliStrSum to accept + in-place of newline #670

@TysonRayJones

Description

@TysonRayJones

This enables avoiding the clunky multiline string literal nuisance when the PauliStrSum contains only a few operations. Eg.

// C++
createInlinePauliStrSum(R"(
    0.123 XX
    1.23i YY
    -1-6i IZ
)");

// C
createInlinePauliStrSum(
    "0.123 XX   \n"
    "1.23i YY   \n"
    "-1-6i IZ   \n"
);

// agnostic
createInlinePauliStrSum("0.123 XX \n 1.23i YY \n -1-6i IZ");

can become the more palatable

createInlinePauliStrSum("0.123 XX + 1.23i YY -1-6i IZ");

Beware that this cannot be done by retaining our existing parsing/regex/validation and simply prior substituting encountered + for \n. We would fail to include \n before negative coefficients, and mutilate scientific notation with positive exponents.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions