Q2NS dev
ns-3 module
Loading...
Searching...
No Matches
q2ns Namespace Reference

Namespaces

namespace  analysis
 
namespace  anonymous_namespace{q2ns-qmap.cc}
 
namespace  gates
 

Classes

class  AllAtOncePolicy
 
class  ConditionalQMap
 QMap wrapper that conditionally applies another QMap. More...
 
class  CongestionHelper
 
struct  CreateStateResult
 Result of creating a new backend state. More...
 
struct  CtrlHeader
 
class  DephasingQMap
 Dephasing noise model that applies Z with probability p. More...
 
class  DepolarizingQMap
 Trajectory-style depolarizing model that applies a random Pauli from {X, Y, Z} with probability p. More...
 
class  EntanglementSwapHelper
 
class  ISwapPolicy
 
class  LambdaQMap
 QMap implementation that wraps a user-provided lambda. More...
 
struct  LinkSpec
 
struct  Location
 Current tracked location of a qubit. More...
 
class  LossQMap
 Erasure model that marks the qubit lost with probability p. More...
 
class  NetController
 Main user-facing facade for creating and configuring a quantum network. More...
 
struct  NodeSpec
 
class  QChannel
 Duplex quantum channel with configurable delay, jitter, and transit maps. More...
 
class  QGate
 Lightweight gate descriptor used by QState backends. More...
 
struct  QLinkSpec
 
class  QMap
 Abstract base class for channel map models. More...
 
struct  QMapContext
 Optional per-sample context passed to QMaps. More...
 
class  QNetDevice
 Minimal quantum net device that bridges a QChannel and a QNetworker. More...
 
class  QNetworker
 Internal helper owned by QNode for node-local quantum networking. More...
 
class  QNode
 Main user-facing per-node API for quantum operations and transmission. More...
 
class  QProcessor
 Internal helper owned by a QNode to handle local quantum operations. More...
 
class  QState
 Backend-agnostic interface for a quantum state object. More...
 
class  QStateDM
 Density-matrix concrete QState backend using qpp::cmat. More...
 
class  QStateKet
 Ket-based concrete QState backend using qpp. More...
 
class  QStateRegistry
 Internal registry that owns backend states and tracks qubit membership and location. More...
 
class  QStateStab
 Stabilizer concrete QState backend using stab::AffineState. More...
 
class  Qubit
 Lightweight handle for one qubit inside a registry-managed state. More...
 
class  RandomGateQMap
 QMap that samples one gate from a weighted distribution and applies it. More...
 
class  RandomUnitaryQMap
 QMap that applies one Haar-random single-qubit SU(2) unitary. More...
 
struct  RoundsConfig
 
struct  SessionSpec
 
class  SwapApp
 
struct  SwapSessionSpec
 
struct  SwapTopologySpec
 
class  TeleportationApp
 
class  TeleportationHelper
 
struct  TopologySpec
 
struct  TrafficFlow
 
struct  TrafficSpec
 

Typedefs

using Complex = std::complex< double >
 Complex scalar type used by matrix-based backends.
 
using Matrix = Eigen::MatrixXcd
 Dynamic complex matrix type used for custom gates and matrix-based states.
 
using Index = std::size_t
 Generic qubit index type within a backend state.
 
using StateId = std::uint64_t
 Stable identifier for a registered backend state.
 
using QubitId = std::uint64_t
 Stable identifier for a registered qubit handle.
 
using QMapInstance = std::function< void(QNode &, std::shared_ptr< Qubit > &)>
 Per-transmission quantum map callable applied to a received qubit.
 
using RecvCallback = ns3::Callback< void, std::shared_ptr< Qubit > >
 Callback invoked when a qubit is successfully received at a node.
 

Enumerations

enum class  QGateKind {
  QGateKind::Custom , QGateKind::I , QGateKind::X , QGateKind::Y ,
  QGateKind::Z , QGateKind::H , QGateKind::S , QGateKind::SDG ,
  QGateKind::CNOT , QGateKind::CZ , QGateKind::SWAP
}
 Enumerates built-in gate kinds. More...
 
enum class  Basis { Basis::Z , Basis::X , Basis::Y }
 Measurement basis for single-qubit projective measurement. More...
 
enum class  QStateBackend { QStateBackend::Ket , QStateBackend::DM , QStateBackend::Stab }
 Backend family used when creating new quantum states. More...
 
enum class  LocationType { LocationType::Node , LocationType::Channel , LocationType::Lost , LocationType::Unset }
 Kind of simulated qubit location. More...
 

Functions

Matrix MakeMatrix (std::initializer_list< std::initializer_list< Complex > > rows)
 Build a Matrix from nested initializer lists.
 
const MatrixMatrixI ()
 Return the 1-qubit identity matrix.
 
const MatrixMatrixX ()
 Return the Pauli-X matrix.
 
const MatrixMatrixY ()
 Return the Pauli-Y matrix.
 
const MatrixMatrixZ ()
 Return the Pauli-Z matrix.
 
const MatrixMatrixH ()
 Return the Hadamard matrix.
 
const MatrixMatrixS ()
 Return the phase gate matrix S = diag(1, i).
 
const MatrixMatrixSDG ()
 Return the inverse phase gate matrix SDG = diag(1, -i).
 
const MatrixMatrixCNOT ()
 Return the CNOT matrix with control qubit 0 and target qubit 1.
 
const MatrixMatrixCZ ()
 Return the CZ matrix.
 
const MatrixMatrixSWAP ()
 Return the SWAP matrix.
 
const MatrixMatrixOf (QGateKind k)
 Return the built-in matrix for a non-custom gate kind.
 
QStateBackend BackendFromString (std::string_view s)
 Convert a backend name string to a QStateBackend enum value.
 
std::ostream & operator<< (std::ostream &os, const QState &s)
 Stream insertion for a QState reference.
 
std::ostream & operator<< (std::ostream &os, const std::shared_ptr< QState > &s)
 Stream insertion for a shared QState pointer.
 
struct q2ns::CtrlHeader __attribute__ ((packed))
 
std::vector< QStateBackendAllQStateBackends ()
 Return all supported backend enum values.
 
Location MakeUnsetLocation ()
 Construct an Unset location value.
 
static ns3::Ptr< ns3::Ipv4 > GetIpv4 (ns3::Ptr< ns3::Node > node)
 
static ns3::Ipv4Address GetFirstNonLoopback (ns3::Ptr< ns3::Node > node)
 

Function Documentation

◆ __attribute__()

struct q2ns::CtrlHeader q2ns::__attribute__ ( (packed)  )

◆ GetFirstNonLoopback()

static ns3::Ipv4Address q2ns::GetFirstNonLoopback ( ns3::Ptr< ns3::Node >  node)
static

Definition at line 134 of file q2ns-teleportation-helper.cc.

References GetIpv4().

Referenced by q2ns::TeleportationHelper::InstallSessionApps().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetIpv4()

static ns3::Ptr< ns3::Ipv4 > q2ns::GetIpv4 ( ns3::Ptr< ns3::Node >  node)
static

Definition at line 130 of file q2ns-teleportation-helper.cc.

Referenced by GetFirstNonLoopback().

Here is the caller graph for this function:

◆ MakeMatrix()

Matrix q2ns::MakeMatrix ( std::initializer_list< std::initializer_list< Complex > >  rows)
inline

Build a Matrix from nested initializer lists.

Parameters
rowsMatrix rows.
Returns
Constructed matrix.

Definition at line 155 of file q2ns-qgate.h.

Referenced by main(), MatrixCNOT(), MatrixCZ(), MatrixH(), MatrixI(), MatrixS(), MatrixSDG(), MatrixSWAP(), MatrixX(), MatrixY(), and MatrixZ().

Here is the caller graph for this function:

◆ MatrixCNOT()

const Matrix & q2ns::MatrixCNOT ( )
inline

Return the CNOT matrix with control qubit 0 and target qubit 1.

Basis ordering is |00>, |01>, |10>, |11>.

Returns
Reference to the cached matrix.

Definition at line 261 of file q2ns-qgate.h.

References CNOT, and MakeMatrix().

Referenced by MatrixOf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MatrixCZ()

const Matrix & q2ns::MatrixCZ ( )
inline

Return the CZ matrix.

Returns
Reference to the cached matrix.

Definition at line 277 of file q2ns-qgate.h.

References CZ, and MakeMatrix().

Referenced by MatrixOf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MatrixH()

const Matrix & q2ns::MatrixH ( )
inline

Return the Hadamard matrix.

Returns
Reference to the cached matrix.

Definition at line 221 of file q2ns-qgate.h.

References H, and MakeMatrix().

Referenced by main(), and MatrixOf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MatrixI()

const Matrix & q2ns::MatrixI ( )
inline

Return the 1-qubit identity matrix.

Returns
Reference to the cached matrix.

Definition at line 177 of file q2ns-qgate.h.

References I, and MakeMatrix().

Referenced by MatrixOf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MatrixOf()

const Matrix & q2ns::MatrixOf ( QGateKind  k)
inline

Return the built-in matrix for a non-custom gate kind.

Parameters
kBuilt-in gate kind.
Returns
Reference to the corresponding cached matrix.

Definition at line 313 of file q2ns-qgate.h.

References CNOT, CZ, H, I, MatrixCNOT(), MatrixCZ(), MatrixH(), MatrixI(), MatrixS(), MatrixSDG(), MatrixSWAP(), MatrixX(), MatrixY(), MatrixZ(), S, SDG, SWAP, X, Y, and Z.

Referenced by q2ns::QStateDM::Apply(), and q2ns::QStateKet::Apply().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MatrixS()

const Matrix & q2ns::MatrixS ( )
inline

Return the phase gate matrix S = diag(1, i).

Returns
Reference to the cached matrix.

Definition at line 233 of file q2ns-qgate.h.

References MakeMatrix(), and S.

Referenced by main(), and MatrixOf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MatrixSDG()

const Matrix & q2ns::MatrixSDG ( )
inline

Return the inverse phase gate matrix SDG = diag(1, -i).

Returns
Reference to the cached matrix.

Definition at line 244 of file q2ns-qgate.h.

References MakeMatrix(), and SDG.

Referenced by MatrixOf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MatrixSWAP()

const Matrix & q2ns::MatrixSWAP ( )
inline

Return the SWAP matrix.

Basis ordering is |00>, |01>, |10>, |11>.

Returns
Reference to the cached matrix.

Definition at line 296 of file q2ns-qgate.h.

References MakeMatrix(), and SWAP.

Referenced by MatrixOf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MatrixX()

const Matrix & q2ns::MatrixX ( )
inline

Return the Pauli-X matrix.

Returns
Reference to the cached matrix.

Definition at line 188 of file q2ns-qgate.h.

References MakeMatrix(), and X.

Referenced by MatrixOf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MatrixY()

const Matrix & q2ns::MatrixY ( )
inline

Return the Pauli-Y matrix.

Returns
Reference to the cached matrix.

Definition at line 199 of file q2ns-qgate.h.

References MakeMatrix(), and Y.

Referenced by MatrixOf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MatrixZ()

const Matrix & q2ns::MatrixZ ( )
inline

Return the Pauli-Z matrix.

Returns
Reference to the cached matrix.

Definition at line 210 of file q2ns-qgate.h.

References MakeMatrix(), and Z.

Referenced by MatrixOf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator<<() [1/2]

std::ostream & q2ns::operator<< ( std::ostream &  os,
const QState s 
)
inline

Stream insertion for a QState reference.

Parameters
osOutput stream.
sState reference.
Returns
Output stream.

Definition at line 279 of file q2ns-qstate.h.

References q2ns::QState::Print().

Here is the call graph for this function:

◆ operator<<() [2/2]

std::ostream & q2ns::operator<< ( std::ostream &  os,
const std::shared_ptr< QState > &  s 
)
inline

Stream insertion for a shared QState pointer.

Parameters
osOutput stream.
sShared state pointer.
Returns
Output stream.

Definition at line 290 of file q2ns-qstate.h.