18#include "ns3/type-id.h"
20#include "ns3/q2ns-qgate.h"
21#include "ns3/q2ns-qstate.h"
22#include "ns3/q2ns-types.h"
93 std::shared_ptr<Qubit>
GetQubit(
const std::string& label)
const;
127 void AddDevice(ns3::Ptr<ns3::NetDevice> device);
140 void AddRoute(uint32_t dstNodeId, uint32_t oif);
155 bool Send(std::shared_ptr<Qubit> q, uint32_t dstNodeId);
174 std::shared_ptr<Qubit>
CreateQubit(
const std::string& label =
"");
184 std::shared_ptr<Qubit>
CreateQubit(
const std::shared_ptr<QState>& state,
185 const std::string& label =
"");
191 std::pair<std::shared_ptr<Qubit>, std::shared_ptr<Qubit>>
CreateBellPair();
199 std::shared_ptr<QState>
GetState(
const std::shared_ptr<Qubit>& q);
209 bool Apply(
const QGate& gate,
const std::vector<std::shared_ptr<Qubit>>& qs);
219 bool Apply(
const q2ns::Matrix& gate,
const std::vector<std::shared_ptr<Qubit>>& qs);
242 std::pair<int, int>
MeasureBell(
const std::shared_ptr<Qubit>& a,
const std::shared_ptr<Qubit>& b);
253 void AdoptQubit(
const std::shared_ptr<Qubit>& q);
Main user-facing facade for creating and configuring a quantum network.
Lightweight gate descriptor used by QState backends.
Internal helper owned by QNode for node-local quantum networking.
Main user-facing per-node API for quantum operations and transmission.
QStateRegistry & registry_
Shared state registry.
std::pair< std::shared_ptr< Qubit >, std::shared_ptr< Qubit > > CreateBellPair()
Create a local Bell pair in the |Phi+> state.
int Measure(const std::shared_ptr< Qubit > &q, q2ns::Basis basis=q2ns::Basis::Z)
Measure a local qubit in the given basis.
std::shared_ptr< QState > GetState(const std::shared_ptr< Qubit > &q)
Get the current backend state of a qubit.
~QNode() override
Destructor.
std::shared_ptr< Qubit > GetQubit(const std::string &label) const
Lookup a local qubit by application label.
static ns3::TypeId GetTypeId(void)
Get the ns-3 TypeId.
void AddDevice(ns3::Ptr< ns3::NetDevice > device)
Register a device with this node.
void SetRecvCallback(RecvCallback cb)
Set the application-level receive callback.
bool Send(std::shared_ptr< Qubit > q, uint32_t dstNodeId)
Send a qubit toward a destination node.
std::unique_ptr< QProcessor > processor_
Internal local quantum processor.
void AddRoute(uint32_t dstNodeId, uint32_t oif)
Add or replace a simple host route for quantum transmission.
std::unique_ptr< QNetworker > networker_
Internal networking component.
std::shared_ptr< Qubit > CreateQubit(const std::string &label="")
Create a new local qubit initialized in the |0> state.
std::pair< int, int > MeasureBell(const std::shared_ptr< Qubit > &a, const std::shared_ptr< Qubit > &b)
Perform a Bell-state measurement on two local qubits.
std::vector< std::shared_ptr< Qubit > > GetLocalQubits() const
Return the qubits currently located at this node.
void AdoptQubit(const std::shared_ptr< Qubit > &q)
Mark a qubit as local to this node.
bool Apply(const QGate &gate, const std::vector< std::shared_ptr< Qubit > > &qs)
Apply a gate to one or more local qubits.
Internal registry that owns backend states and tracks qubit membership and location.
ns3::Callback< void, std::shared_ptr< Qubit > > RecvCallback
Callback invoked when a qubit is successfully received at a node.
std::uint64_t QubitId
Stable identifier for a registered qubit handle.
Eigen::MatrixXcd Matrix
Dynamic complex matrix type used for custom gates and matrix-based states.
Basis
Measurement basis for single-qubit projective measurement.