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) -> PauliOperator

Convert a Qiskit operator to a PauliOperator.

Requires the operator to be Hermitian

paramqiskit_opSparsePauliOp

A qiskit Pauli operator.

paramatolfloat
= 1e-08

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

Returns

monoprop.pauli.PauliOperator

A PauliOperator instance representing the given operator.

functo_qiskit_operator(pauli_operator, num_qubits=None) -> SparsePauliOp

Convert a PauliOperator to a Qiskit SparsePauliOp.

parampauli_operatorPauliOperator

A PauliOperator instance.

paramnum_qubitsint | None
= None

Number of qubits in the system. If None, it will be inferred from the PauliOperator.

Returns

qiskit.quantum_info.SparsePauliOp

The Qiskit operator.

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