Q2NS dev
ns-3 module
Loading...
Searching...
No Matches
q2ns::QGate Class Reference

Lightweight gate descriptor used by QState backends. More...

#include <q2ns-qgate.h>

Collaboration diagram for q2ns::QGate:

Public Member Functions

 QGate ()=default
 Default constructor.
 
 QGate (QGateKind k, ns3::Time d=ns3::Seconds(0))
 Construct a built-in gate descriptor.
 
QGateKind Kind () const
 Return the gate kind.
 
ns3::Time Duration () const
 Return the optional duration metadata.
 
const MatrixUnitary () const
 Return the custom unitary matrix.
 

Static Public Member Functions

static QGate Custom (const Matrix &U, ns3::Time d=ns3::Seconds(0))
 Construct a custom gate by copying a matrix.
 
static QGate Custom (Matrix &&U, ns3::Time d=ns3::Seconds(0))
 Construct a custom gate by moving a matrix.
 

Private Attributes

QGateKind kind_ {QGateKind::I}
 Gate kind.
 
std::shared_ptr< const MatrixU_ {}
 Custom unitary for Custom gates.
 
ns3::Time duration_ {ns3::Seconds(0)}
 Optional duration metadata.
 

Detailed Description

Lightweight gate descriptor used by QState backends.

A QGate stores either:

  • a built-in gate kind, or
  • a custom unitary matrix

It may also carry an optional duration value for higher-level scheduling or interpretation. QGate itself does not enforce timing behavior.

See also
QGateKind
gates

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

Constructor & Destructor Documentation

◆ QGate() [1/2]

q2ns::QGate::QGate ( )
default

Default constructor.

◆ QGate() [2/2]

q2ns::QGate::QGate ( QGateKind  k,
ns3::Time  d = ns3::Seconds(0) 
)
inlineexplicit

Construct a built-in gate descriptor.

Parameters
kBuilt-in gate kind.
dOptional duration metadata.

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

Member Function Documentation

◆ Custom() [1/2]

static QGate q2ns::QGate::Custom ( const Matrix U,
ns3::Time  d = ns3::Seconds(0) 
)
inlinestatic

Construct a custom gate by copying a matrix.

Parameters
UUnitary matrix to copy.
dOptional duration metadata.
Returns
Custom gate descriptor.
See also
Custom(Matrix&&, ns3::Time)

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

References q2ns::Custom, duration_, kind_, and U_.

Referenced by q2ns::gates::Custom(), and q2ns::gates::Custom().

Here is the caller graph for this function:

◆ Custom() [2/2]

static QGate q2ns::QGate::Custom ( Matrix &&  U,
ns3::Time  d = ns3::Seconds(0) 
)
inlinestatic

Construct a custom gate by moving a matrix.

Parameters
UUnitary matrix to move.
dOptional duration metadata.
Returns
Custom gate descriptor.
See also
Custom(const Matrix&, ns3::Time)

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

References q2ns::Custom, duration_, kind_, and U_.

◆ Duration()

ns3::Time q2ns::QGate::Duration ( ) const
inline

Return the optional duration metadata.

Returns
Stored duration.

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

References duration_.

◆ Kind()

QGateKind q2ns::QGate::Kind ( ) const
inline

Return the gate kind.

Returns
Stored gate kind.

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

References kind_.

◆ Unitary()

const Matrix & q2ns::QGate::Unitary ( ) const
inline

Return the custom unitary matrix.

This is only valid when Kind() returns QGateKind::Custom.

Returns
Stored custom unitary matrix.
See also
Kind

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

References U_.

Member Data Documentation

◆ duration_

ns3::Time q2ns::QGate::duration_ {ns3::Seconds(0)}
private

Optional duration metadata.

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

Referenced by Custom(), Custom(), and Duration().

◆ kind_

QGateKind q2ns::QGate::kind_ {QGateKind::I}
private

Gate kind.

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

Referenced by Custom(), Custom(), and Kind().

◆ U_

std::shared_ptr<const Matrix> q2ns::QGate::U_ {}
private

Custom unitary for Custom gates.

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

Referenced by Custom(), Custom(), and Unitary().


The documentation for this class was generated from the following file: