atlas_q.stabilizer_backend.StabilizerSimulator#

class atlas_q.stabilizer_backend.StabilizerSimulator(n_qubits)[source]#

Bases: object

Efficient simulator for Clifford circuits using stabilizer formalism

Complexity: - Space: O(n²) vs O(2ⁿ) for state-vector - Time per gate: O(n²) vs O(2ⁿ)

Usage:

sim = StabilizerSimulator(n_qubits=100) sim.h(0) sim.cnot(0, 1) outcome = sim.measure(0)

Methods

cnot(control, target)

CNOT gate

copy()

Fast copy using numpy array copy (much faster than deepcopy)

cz(qubit1, qubit2)

CZ gate (symmetric)

h(qubit)

Hadamard gate: X ↔ Z

measure(qubit[, rng])

Measure qubit in computational basis

s(qubit)

Phase gate: X → Y, Z → Z

s_dag(qubit)

Inverse phase gate: X → -Y, Z → Z

swap(qubit1, qubit2)

SWAP gate

to_mps([device])

Convert stabilizer state to MPS representation

to_statevector()

Convert stabilizer state to full statevector (SLOW! Only for small n)

x(qubit)

Pauli-X gate

y(qubit)

Pauli-Y gate

z(qubit)

Pauli-Z gate

__init__(n_qubits)[source]#

Methods

__init__(n_qubits)

cnot(control, target)

CNOT gate

copy()

Fast copy using numpy array copy (much faster than deepcopy)

cz(qubit1, qubit2)

CZ gate (symmetric)

h(qubit)

Hadamard gate: X ↔ Z

measure(qubit[, rng])

Measure qubit in computational basis

s(qubit)

Phase gate: X → Y, Z → Z

s_dag(qubit)

Inverse phase gate: X → -Y, Z → Z

swap(qubit1, qubit2)

SWAP gate

to_mps([device])

Convert stabilizer state to MPS representation

to_statevector()

Convert stabilizer state to full statevector (SLOW! Only for small n)

x(qubit)

Pauli-X gate

y(qubit)

Pauli-Y gate

z(qubit)

Pauli-Z gate

copy()[source]#

Fast copy using numpy array copy (much faster than deepcopy)

h(qubit)[source]#

Hadamard gate: X ↔ Z

s(qubit)[source]#

Phase gate: X → Y, Z → Z

s_dag(qubit)[source]#

Inverse phase gate: X → -Y, Z → Z

cnot(control, target)[source]#

CNOT gate

cz(qubit1, qubit2)[source]#

CZ gate (symmetric)

swap(qubit1, qubit2)[source]#

SWAP gate

x(qubit)[source]#

Pauli-X gate

y(qubit)[source]#

Pauli-Y gate

z(qubit)[source]#

Pauli-Z gate

measure(qubit, rng=None)[source]#

Measure qubit in computational basis

Returns:

0 or 1 (measurement outcome)

to_mps(device='cuda')[source]#

Convert stabilizer state to MPS representation

This is used when non-Clifford gates appear in the circuit.

Returns:

AdaptiveMPS instance

to_statevector()[source]#

Convert stabilizer state to full statevector (SLOW! Only for small n)

This explicitly constructs the 2^n statevector. Only use for small systems (n ≤ 20).

Returns:

Statevector of shape (2^n,)