Execution and estimation¶
- simple_execute(circuit: maestro.circuits.QuantumCircuit, config: maestro.SimulatorConfig = SimulatorConfig(), shots: int = 1024) dict¶
- simple_execute(qasm_circuit: str, config: maestro.SimulatorConfig = SimulatorConfig(), shots: int = 1024) dict
- simple_estimate(circuit: maestro.circuits.QuantumCircuit, observables: object, config: maestro.SimulatorConfig = SimulatorConfig()) dict¶
- simple_estimate(qasm_circuit: str, observables: object, config: maestro.SimulatorConfig = SimulatorConfig()) dict
- get_statevector(circuit: maestro.circuits.QuantumCircuit, config: maestro.SimulatorConfig = SimulatorConfig()) list[complex]¶
Get the full statevector (complex amplitudes) after executing a circuit.
- get_probabilities(circuit: maestro.circuits.QuantumCircuit, config: maestro.SimulatorConfig = SimulatorConfig()) list¶
Get the full probability distribution after executing a circuit.
- state_probability(circuit: maestro.circuits.QuantumCircuit, target_state: str) dict¶
- state_probability(qasm_circuit: str, target_state: str) dict
Overloaded function.
state_probability(circuit: maestro.circuits.QuantumCircuit, target_state: str) -> dict
Compute the probability of a specific output state using the Pauli path integral simulator.
This is the path integral’s key advantage: it computes a single amplitude
<target_state|U|0...0>without building the full statevector, making it efficient for large circuits with few branching gates.- Parameters:
circuit – A QuantumCircuit (no measurements needed).
target_state – A bitstring like ‘10001001’ (qubit 0 is leftmost).
- Returns:
dict with ‘probability’, ‘amplitude’, ‘target_state’, ‘time_taken’.
state_probability(qasm_circuit: str, target_state: str) -> dict
Compute the probability of a specific output state from a QASM circuit using the Pauli path integral simulator.
- inner_product(circuit_1: maestro.circuits.QuantumCircuit, circuit_2: maestro.circuits.QuantumCircuit, config: maestro.SimulatorConfig = SimulatorConfig()) complex¶
Compute the inner product
<psi_1|psi_2> = <0|U1^dag U2|0>between two circuits’ output states, using ProjectOnZero.
- mirror_fidelity(circuit: maestro.circuits.QuantumCircuit, config: maestro.SimulatorConfig = SimulatorConfig(), shots: int = 1024, full_amplitude: bool = False, observables: object | None = None) object¶
Compute mirror fidelity: run a circuit forward then its adjoint in reverse, returning
P(|0...0>). Uses shot-based sampling by default. Set full_amplitude=True for exact statevector computation (small circuits only). Pass observables (a Pauli string, ‘;’-separated string or list) to instead return the expectation of each observable on the mirror circuit: a float for a single string, otherwise a list.
- incremental_evolve(init_circuit: maestro.circuits.QuantumCircuit, trotter_step: maestro.circuits.QuantumCircuit, measure_at_steps: collections.abc.Sequence[int], observables: object, config: maestro.SimulatorConfig = SimulatorConfig()) dict¶
Incremental time evolution with persistent simulator state.
Creates a single simulator, executes init_circuit once, then applies trotter_step incrementally. At each step in measure_at_steps, computes expectation values for the given observables without re-simulating from scratch. Cost: O(total_steps) instead of O(sum of step indices).
- Parameters:
init_circuit – Circuit preparing the initial state.
trotter_step – Circuit for one Trotter step.
measure_at_steps – List of step indices at which to measure.
observables – Pauli strings to measure (list or ‘;’-separated).
config – SimulatorConfig for backend selection.
- Returns:
dict with ‘expectation_values’ (list of lists), ‘steps’, ‘time_taken’.