Low-level simulator control

Direct access to simulator handles and the QASM parser. Most code should use QuantumCircuit and the functions in Execution and estimation instead.

class Maestro(*args, **kwargs)
create_simulator(self, sim_type: maestro.SimulatorType = SimulatorType.QCSim, sim_exec_type: maestro.SimulationType = SimulationType.MatrixProductState) → int
destroy_simulator(self, arg: int, /) → None
get_simulator(self, arg: int, /) → maestro.Simulator
class Simulator
AllProbabilities(self) → list[float]
AllocateQubits(self, num_qubits: int) → int
Amplitude(self, outcome: int) → complex
ApplyCCX(self, control_qubit1: int, control_qubit2: int, target_qubit: int) → None
ApplyCH(self, control_qubit: int, target_qubit: int) → None
ApplyCP(self, control_qubit: int, target_qubit: int, theta: float) → None
ApplyCRx(self, control_qubit: int, target_qubit: int, theta: float) → None
ApplyCRy(self, control_qubit: int, target_qubit: int, theta: float) → None
ApplyCRz(self, control_qubit: int, target_qubit: int, theta: float) → None
ApplyCSX(self, control_qubit: int, target_qubit: int) → None
ApplyCSXDG(self, control_qubit: int, target_qubit: int) → None
ApplyCSwap(self, control_qubit: int, qubit1: int, qubit2: int) → None
ApplyCU(self, control_qubit: int, target_qubit: int, theta: float, phi: float, lambda_: float, gamma: float = 0.0) → None
ApplyCX(self, control_qubit: int, target_qubit: int) → None
ApplyCY(self, control_qubit: int, target_qubit: int) → None
ApplyCZ(self, control_qubit: int, target_qubit: int) → None
ApplyGenericOneQubitGate(self, qubit0: int, matrix: collections.abc.Sequence[collections.abc.Sequence[complex]]) → None

Apply a 2x2 matrix; the first target is the least-significant local bit.

ApplyGenericThreeQubitGate(self, qubit0: int, qubit1: int, qubit2: int, matrix: collections.abc.Sequence[collections.abc.Sequence[complex]]) → None

Apply a 8x8 matrix; the first target is the least-significant local bit.

ApplyGenericTwoQubitGate(self, qubit0: int, qubit1: int, matrix: collections.abc.Sequence[collections.abc.Sequence[complex]]) → None

Apply a 4x4 matrix; the first target is the least-significant local bit.

ApplyH(self, qubit: int) → None
ApplyK(self, qubit: int) → None
ApplyP(self, qubit: int, theta: float) → None
ApplyReset(self, qubits: collections.abc.Sequence[int]) → None
ApplyRx(self, qubit: int, theta: float) → None
ApplyRy(self, qubit: int, theta: float) → None
ApplyRz(self, qubit: int, theta: float) → None
ApplyS(self, qubit: int) → None
ApplySDG(self, qubit: int) → None
ApplySX(self, qubit: int) → None
ApplySXDG(self, qubit: int) → None
ApplySwap(self, qubit1: int, qubit2: int) → None
ApplyT(self, qubit: int) → None
ApplyTDG(self, qubit: int) → None
ApplyU(self, qubit: int, theta: float, phi: float, lambda_: float, gamma: float = 0.0) → None
ApplyX(self, qubit: int) → None
ApplyY(self, qubit: int) → None
ApplyZ(self, qubit: int) → None
Clear(self) → None
ClearSimulator(self) → None
Configure(self, key: str, value: str) → None
ConfigureSimulator(self, key: str, value: str) → None
ExpectationValueOperators(self, qubits: collections.abc.Sequence[int], matrices: collections.abc.Sequence[numpy.ndarray[dtype=complex128, shape=(*, *), order='F']]) → complex
ExpectationValues(self, paulis: collections.abc.Sequence[str]) → list[float]

Evaluate Pauli strings together on the current state, in input order.

ExpectationValuesComplex(self, paulis: collections.abc.Sequence[str], normalized: bool = True) → list[complex]
Flush(self) → None
FlushSimulator(self) → None
GetConfiguration(self, key: str) → str
GetGateFusionMaxQubits(self) → int
GetGateFusionStatistics(self) → maestro.GateFusionStatistics
GetMultithreading(self) → bool
GetNumberOfQubits(self) → int
GetSimulationType(self) → maestro.SimulationType
GetSimulatorType(self) → maestro.SimulatorType
GetStateVector(self) → list[complex]
Initialize(self) → None
InitializeSimulator(self) → None
IsGateFusionEnabled(self) → bool
IsQcsim(self) → bool
Measure(self, qubits: collections.abc.Sequence[int]) → int

Measure and collapse the selected qubits; the first listed qubit is the least-significant result bit.

MeasureMany(self, qubits: collections.abc.Sequence[int]) → list[bool]
MeasureNoCollapse(self) → int
MeasureNoCollapseMany(self) → list[bool]
Probabilities(self, outcomes: collections.abc.Sequence[int]) → list[float]

Return probabilities for the given basis-state indices.

Probability(self, outcome: int) → float
Reset(self) → None
ResetSimulator(self) → None
RestoreInternalDestructiveSavedState(self) → None
RestoreState(self) → None
SampleCounts(self, qubits: collections.abc.Sequence[int], shots: int = 1000) → dict[int, int]

Sample without collapsing the state, returning {integer_outcome: count}; the first listed qubit is the least-significant result bit.

SampleCountsMany(self, qubits: collections.abc.Sequence[int], shots: int = 1000) → dict
SaveState(self) → None
SaveStateToInternalDestructive(self) → None
SetMultithreading(self, multithreading: bool = True) → None
apply_operator(self, qubits: collections.abc.Sequence[int], matrix: numpy.ndarray[dtype=complex128, shape=(*, *), order='F'], normalize: bool = False) → None
density_matrix_element_bits(self, row: collections.abc.Sequence[bool], col: collections.abc.Sequence[bool]) → complex
density_matrix_hermiticity_residual(self) → float
density_matrix_overlap(self, other: Simulators::IState) → complex
density_matrix_purity(self) → float
density_matrix_trace(self) → complex
density_matrix_trace_of_square(self) → complex
expectation_value_complex(self, pauli: str, normalized: bool = True) → complex
expectation_value_operators(self, qubits: collections.abc.Sequence[int], matrices: collections.abc.Sequence[numpy.ndarray[dtype=complex128, shape=(*, *), order='F']]) → complex

MPS expectation of ordered one-qubit operators; repeated targets are allowed.

expectation_values(self, paulis: collections.abc.Sequence[str]) → list[float]
expectation_values_complex(self, paulis: collections.abc.Sequence[str], normalized: bool = True) → list[complex]

Batch MPO expectations; normalized=False returns raw traces.

fidelity_with_statevector(self, statevector: numpy.ndarray[dtype=complex128, shape=(*), order='C']) → float
get_density_matrix(self, normalized: bool = True) → numpy.ndarray[dtype=complex128, shape=(*, *), order='F']
get_statevector(self) → list[complex]

Full pure-state amplitudes in logical basis order (q0 is the low bit).

hermitize_density_matrix(self) → None
is_density_matrix_hermitian(self, eps: float = 1e-10) → bool
move_at_beginning_of_chain(self, qubits: collections.abc.Sequence[int]) → None
partial_trace(self, qubits: collections.abc.Sequence[int]) → numpy.ndarray[dtype=complex128, shape=(*, *), order='F']
probability_bits(self, bits: collections.abc.Sequence[bool]) → float
recanonicalize(self) → None
restore_density_matrix_trace(self) → None
set_seed(self, seed: int) → None
trim(self) → None
class GateFusionStatistics
property backendGates

(self) -> int

property fusedBlocks

(self) -> int

property submittedGates

(self) -> int

class QasmToCirc(*args, **kwargs)
failed(self) → bool
get_error_message(self) → str
get_inputs(self) → list[str]

The names declared by QASM3 input statements, in declaration order.

parse_and_translate(self, qasm_str: str, params: collections.abc.Mapping[str, float] = {}) → maestro.circuits.QuantumCircuit

Parse an OpenQASM string and translate it into a circuit.

Parameters:
  • qasm_str – The QASM program text.

  • params – Optional dict binding QASM3 input declarations (str -> float) at parse time.