20#include "AffineState.h"
22#include "ns3/q2ns-qstate.h"
71 void Print(std::ostream&
os)
const override;
78 void Apply(
const QGate&
g,
const std::vector<Index>&
t)
override;
113 std::shared_ptr<QState>
Clone()
const {
114 return std::make_shared<QStateStab>(*
this);
Lightweight gate descriptor used by QState backends.
Stabilizer concrete QState backend using stab::AffineState.
MeasureResult Measure(Index target, Basis basis=Basis::Z) override
Measure one qubit in the requested basis and split the result.
const stab::AffineState & GetAffineState() const
Return the underlying AffineState.
void RemoveQubit_(Index target)
Remove one qubit while preserving survivor order.
std::size_t numQubits_
Number of logical qubits.
void RotateIntoZBasis_(Index q, Basis basis)
Rotate a local basis so that measuring Z implements the requested basis.
std::shared_ptr< QState > Clone() const
Return a clone of this stabilizer state.
std::shared_ptr< QState > MergeDisjoint(const QState &other) const override
Return the disjoint merge of this state and another stabilizer backend.
std::size_t NumQubits() const override
Return the number of logical qubits in the state.
static std::shared_ptr< QStateStab > Synth1QEigenstate_(Basis basis, int bit)
Build a 1-qubit basis eigenstate for a measurement outcome.
stab::AffineState psi_
Underlying stabilizer state.
void Print(std::ostream &os) const override
Print a human-readable representation of the state.
void Apply(const QGate &g, const std::vector< Index > &t) override
Apply a supported Clifford gate to the given target qubits.
int64_t AssignStreams(int64_t stream) override
Assign RNG streams for deterministic randomness.
Backend-agnostic interface for a quantum state object.
static int64_t AssignStreamsGlobal(int64_t stream, ReseedFn reseed_fn)
Helper for backends that reseed a global RNG source.
Basis
Measurement basis for single-qubit projective measurement.
std::size_t Index
Generic qubit index type within a backend state.
Result of measuring one qubit and splitting the state.