18#include "ns3/q2ns-qstate.h"
83 void Print(std::ostream&
os)
const override;
122 const qpp::ket&
GetKet()
const;
132 void SetKet(
const qpp::ket&
k);
Lightweight gate descriptor used by QState backends.
Ket-based concrete QState backend using qpp.
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.
qpp::cmat GetDensityMatrix() const
Return the density matrix |psi><psi| of the current ket.
qpp::ket state_
Pure state ket.
static void ValidateKet(const qpp::ket &k)
Validate basic ket properties.
MeasureResult Measure(q2ns::Index target, q2ns::Basis basis=q2ns::Basis::Z) override
Measure one qubit in the requested basis and split the result.
const qpp::ket & GetKet() const
Return the underlying ket.
std::size_t NumQubits() const override
Return the number of logical qubits in the state.
std::shared_ptr< QState > MergeDisjoint(const QState &other) const override
Return the disjoint merge of this state and another ket backend.
void SetKet(const qpp::ket &k)
Replace the underlying ket.
void Apply(const QGate &g, const std::vector< q2ns::Index > &targets) override
Apply a gate to the given target qubits.
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.