Usage
A short tour of the Python API. The Maestro reference docs cover everything else.
pip install qoro-maestroWheels are CPU-only and available for Linux x86_64, macOS arm64, and Windows AMD64, Python 3.10+. GPU execution needs the GPU plugin (see HPC & Deployment).
Sample and estimate
from maestro.circuits import QuantumCircuit
qc = QuantumCircuit()
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
print(qc.execute(shots=1024)["counts"]) # {'00': ~512, '11': ~512}
print(qc.estimate(observables=["ZZ", "XX"])["expectation_values"]) # [1.0, 1.0]OpenQASM strings work too:
import maestro
result = maestro.simple_execute(qasm_string, shots=1000)
values = maestro.simple_estimate(qasm_string, observables=["ZZI", "IXX"])Choose a simulation method
The default is the CPU statevector. Pass a SimulatorConfig to choose a different method:
import maestro
config = maestro.SimulatorConfig(
simulation_type=maestro.SimulationType.MatrixProductState,
max_bond_dimension=64,
)
ghz = QuantumCircuit()
ghz.h(0)
for q in range(99):
ghz.cx(q, q + 1)
ghz.measure_all()
counts = ghz.execute(shots=1000, config=config)["counts"] # 100 qubits, fine for MPSSimulationType values: Statevector, MatrixProductState, Stabilizer, ExtendedStabilizer, PauliPropagator, TensorNetwork, DensityMatrix, MatrixProductOperator, PathIntegral.
SimulatorType selects the engine: QCSim (CPU, the default), Gpu, DistributedGpu, DistributedMpiGpu, CompositeQCSim (p-block), QuestSim, and QiskitAer / CompositeQiskitAer when built with Aer.
Add noise
noise = maestro.NoiseModel()
noise.set_all_depolarizing(num_qubits=2, p=0.01)
bell = QuantumCircuit()
bell.h(0)
bell.cx(0, 1)
bell.measure_all()
counts = maestro.noisy_execute(bell, noise, shots=1000, noise_realizations=200)["counts"]See Noise Models for the available channels and execution modes.
Use it from Qiskit or PennyLane
from qiskit_maestro import MaestroBackend # pip install qiskit-maestro
backend = MaestroBackend()
import pennylane as qml # pip install pennylane-maestro
dev = qml.device("maestro.qubit", wires=4)