18#include "ns3/q2ns-qstate.h"
76 void Print(std::ostream&
os)
const override;
Lightweight gate descriptor used by QState backends.
Density-matrix concrete QState backend using qpp::cmat.
MeasureResult Measure(q2ns::Index target, q2ns::Basis basis=q2ns::Basis::Z) override
Measure one qubit in the requested basis and split the result.
static void ValidateDensityMatrix(const qpp::cmat &rho)
Validate basic density-matrix structure.
std::size_t NumQubits() const override
Return the number of logical qubits in the state.
std::shared_ptr< QState > PartialTrace(const std::vector< q2ns::Index > &subsystemA)
Extract a subsystem by partial trace.
int64_t AssignStreams(int64_t stream) override
Assign RNG streams for deterministic randomness.
void Print(std::ostream &os) const override
Print a human-readable representation of the state.
void Apply(const QGate &g, const std::vector< q2ns::Index > &targets) override
Apply a gate to the given target qubits.
const qpp::cmat & GetRho() const
Return the underlying density matrix.
qpp::cmat rho_
Backend density matrix.
std::shared_ptr< QState > MergeDisjoint(const QState &other) const override
Return the disjoint merge of this state and another density-matrix backend.
void SetRho(const qpp::cmat &rho)
Replace the underlying density matrix after validation.
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.