Simulators for running circuits locally.
Contains a state-vector simulator able to return the resulting state vector after running a circuit on an all-zero initialized basis state. Supports both the little- and big-endian conventions.
Sample a single qubit.
qubit – The qubit index that is measured.
state – The state to sample from.
rng – Random number generator to use for measuring in the computational basis.
collapse_state – Whether to collapse the state after measuring.
little_endian – If true, return the state vector using little-endian indexing for the qubits. Otherwise use big-endian.
The measurement sample (0 or 1).
- Return type
Simulate the given circuit with either a state vector or density matrix simulation.
The resulting state is stored in the circuit object, together with the measured value in the classical register.
circuit – The circuit to simulate.
mixed_state – If true, use the full density matrix method to simulate the circuit. Otherwise, simulate using the state vector method.