monoprop

qiskit_conversion

Module to convert qiskit objects.

attributePAULI_EVOLUTION_EQUIVALENT
= {'rx', 'ry', 'rz', 'rxx', 'ryy', 'rzz', 'rxy', 'rxz', 'ryz'}
attributeVALID_PAULI_GATES
= PAULI_EVOLUTION_EQUIVALENT.union({'PauliEvolution'})
funcfrom_qiskit_operator(qiskit_op, *, atol=1e-08, force_real=False) -> PauliOperator

Convert a Qiskit operator to a PauliOperator.

paramqiskit_opSparsePauliOp

A qiskit Pauli operator.

paramatolfloat
= 1e-08

Absolute tolerance for the simplify() run first, which drops smaller terms.

paramforce_realbool
= False

Cast the coefficients to real, raising if any is not numerically real.

Returns

monoprop.pauli.PauliOperator
functo_qiskit_operator(pauli_dict) -> SparsePauliOp

Convert a dictionary of Pauli strings with their coefficients to a Qiskit operator.

parampauli_dictdict[str, complex] | dict[str, float]

Pauli strings in monoprop order (leftmost letter on qubit 0); each key is reversed into qiskit's little-endian label order.

Returns

qiskit.quantum_info.SparsePauliOp
funcfrom_qiskit_circuit(circuit, initial_state) -> Circuit

Convert a Qiskit circuit to a Circuit.

The qiskit circuit must hold only PauliEvolutionGates (or the equivalent rotations in PAULI_EVOLUTION_EQUIVALENT) with commuting operators; barriers are ignored. Each gate becomes one ExpGate driven by its own angle (the identity parameter mapping), with the generator's coefficients negated so the angles carry through unchanged (see _negated).

paramcircuitQuantumCircuit
paraminitial_statelist[int]

Returns

monoprop.circuit.Circuit
functo_qiskit_circuit(circuit, num_qubits) -> QuantumCircuit

Convert a Circuit to a Qiskit circuit.

The result holds only PauliEvolutionGates. Each gate's evolution time is taken from the circuit's parameters via its parameter mapping, and each generator's coefficients are negated to turn monoprop's exp(+i theta H) back into qiskit's exp(-i t H) (see _negated). Pass the observable's num_qubits as the width of the result.

paramcircuitCircuit
paramnum_qubitsint

Returns

qiskit.QuantumCircuit