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', 'pauli_product_rotation'})funcfrom_qiskit_operator(qiskit_op, *, atol=1e-08) -> PauliOperatorConvert a Qiskit operator to a PauliOperator.
Requires the operator to be Hermitian
paramqiskit_opSparsePauliOp | SparseObservable | QiskitPauliA qiskit Pauli operator, a SparseObservable, or a single Pauli, which
carries one term and so skips the simplify(). A SparseObservable is expanded
into a SparsePauliOp first (see SparsePauliOp.from_sparse_observable), which is
exponential in its number of single-qubit projector terms.
paramatolfloat= 1e-08Absolute tolerance for the simplify() run first, which drops smaller terms.
Returns
monoprop.pauli.PauliOperatorA PauliOperator instance representing the given operator.
functo_qiskit_operator(pauli_operator, num_qubits=None) -> SparsePauliOpConvert a PauliOperator to a Qiskit SparsePauliOp.
parampauli_operatorPauliOperatorA PauliOperator instance.
paramnum_qubitsint | None= NoneNumber of qubits in the system. If None, it will be inferred from the PauliOperator.
Returns
qiskit.quantum_info.SparsePauliOpThe Qiskit operator.
funcfrom_qiskit_circuit(circuit, initial_state) -> CircuitConvert a Qiskit circuit to a Circuit.
The qiskit circuit must hold only PauliEvolutionGates, PauliProductRotationGates, 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). Constant factors from a gate's own definition (e.g. the
1/2 in R_P(theta) = exp(-i theta P / 2)) go on the generator, never on parameter, so
parameter always matches the angle the qiskit gate was built with.
paramcircuitQuantumCircuitparaminitial_statelist[int]Returns
monoprop.circuit.Circuitfuncto_qiskit_circuit(circuit, num_qubits) -> QuantumCircuitConvert 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.
paramcircuitCircuitA Circuit representing the given circuit.
paramnum_qubitsintTotal number of qubits. Must match circuit.system_size.
Returns
qiskit.QuantumCircuitA qiskit quantum circuit.