qdk_chemistry.utils.time_evolution module
Utility helpers for constructing controlled time-evolution circuits.
- class qdk_chemistry.utils.time_evolution.PauliEvolutionTerm(pauli_map, coefficient)[source]
Bases:
objectContainer for a Pauli string and its real coefficient.
- qdk_chemistry.utils.time_evolution.append_controlled_time_evolution(circuit, control_qubit, system_qubits, terms, *, time, power=1)[source]
Append the controlled unitary
(exp(-i H time))**power.- Return type:
- Parameters:
circuit (QuantumCircuit) – Circuit being extended.
control_qubit (Qubit | int) – Index of the single ancilla control qubit.
system_qubits (Sequence[Qubit | int]) – Ordered system qubits targeted by the evolution.
terms (Iterable[PauliEvolutionTerm]) – Iterable of Pauli decomposition entries for the Hamiltonian.
time (float) – Evolution time
tfor a single application ofU.power (int) – Number of repeated applications (
Uraised topower).
- Raises:
ValueError – If
poweris less than 1.
- qdk_chemistry.utils.time_evolution.controlled_pauli_rotation(circuit, control_qubit, system_qubits, term, *, angle)[source]
Append a controlled
exp(-i angle * P)tocircuit.- Return type:
- Parameters:
circuit (QuantumCircuit) – Quantum circuit receiving the controlled rotation.
control_qubit (Qubit | int) – Index of the ancilla qubit providing the control.
system_qubits (Sequence[Qubit | int]) – Ordered collection of system qubit indices.
term (PauliEvolutionTerm) – Pauli term describing the rotation axis.
angle (float) – Rotation angle before the factor of two applied by CRZ.
- Returns:
The quantum circuit with the controlled rotation appended.
- qdk_chemistry.utils.time_evolution.extract_terms_from_hamiltonian(hamiltonian)[source]
Compute the cached Pauli decomposition for a
qdk_chemistry.data.QubitHamiltonian.- Return type:
- Parameters:
hamiltonian (QubitHamiltonian) – Hamiltonian whose Pauli terms are required.
- Returns:
List of
PauliEvolutionTermentries representing the Hamiltonian.
- qdk_chemistry.utils.time_evolution.pauli_evolution_terms(pauli_op, *, atol=1e-12)[source]
Convert a
SparsePauliOpinto rotation data for time evolution.- Return type:
- Parameters:
pauli_op (
SparsePauliOp) – Operator to decompose.atol (float) –
Absolute tolerance used to discard negligible coefficients
and to detect unwanted imaginary components.
- Returns:
Ordered list of
PauliEvolutionTermentries describing each non-identity component ofpauli_op.- Raises:
ValueError – If a coefficient has an imaginary part whose magnitude exceeds
atol.