Code for: The Influence of Experimental Imperfections on Photonic GHZ State Generation
Loading...
Searching...
No Matches
Key< Int > Class Template Reference

Key class, that implements the functions needed for State. Inherits from boost::container::flat_map<std::pair<Int, Int>, Int>. More...

#include <Key.hpp>

Inheritance diagram for Key< Int >:

Public Types

using Par = boost::container::flat_map<std::pair<Int, Int>, Int>
 Short handle for the parent type that provide the actual data structure.
 
using basetype = Int
 Handle for the intereger number type to provide it for State.
 
template<class Val >
using SD = boost::container::flat_map<Key<Int>, Val>
 Handle for State-like (actually State-parent) data structure.
 

Public Member Functions

 Key ()
 Construct a new Key object.
 
 Key (Int a, Int b, Int c)
 Construct a new Key object from an entry.
 
void add (const Par &p)
 Adds a boost::container::flat_map<std::pair<Int, Int>, Int>, if entry exist, occupation numbers are added.
 
 operator Par () const
 Returns this as boost::container::flat_map<std::pair<Int, Int>, Int>.
 
void clean ()
 Removes entries with occupation number 0.
 
template<class Val >
Val factor (Int a, Int b) const
 Normalization factor for second-quantization for Spatial&Polarization modes a and b.
 
template<class Val >
Val factor () const
 Normalization factor for second-quantization for all modes.
 
void addEnd (const Int &a, const Int &b, const Int &c)
 Adds entry and the end.
 
template<class Val , class Real >
SD< Val > apply (const std::vector< Val > &U, const std::vector< Int > &modes, const Real &tol) const
 Applies a Unitary in second quantization.
 
template<class Val >
Val apply (const Val &U, const Int &mode) const
 Applies a Unitary in second quantization for a single mode.
 
void swap (Int a, Int b)
 Swaps Spatial&Polarization modes a and b.
 
bool overlapping (const boost::container::flat_map< Int, Int > &ref) const
 Checks if the Key containes data of a boost::container::flat_map<Int, Int>.
 
void incr (const Int &mode, const Int &d, const Int &num)
 
template<class Val >
SD< Val > loss (const std::vector< Int > &modes, const Int &lossMode, Int &maxLM) const
 Applies loss with uniform probability per photon on the modes.
 
bool notEmpty (const std::vector< std::vector< Int > > &allModes) const
 Checks if the key has at least one photon in on of the modes in allModes.
 
bool sameDModeDel (const std::vector< Int > &m)
 Checks if all S&P modes in m have the same distinguishability mode and deletes all modes in m.
 

Detailed Description

template<class Int>
class Key< Int >

Key class, that implements the functions needed for State. Inherits from boost::container::flat_map<std::pair<Int, Int>, Int>.

Template Parameters
IntClass used for integer numbers.

Member Typedef Documentation

◆ SD

template<class Int >
template<class Val >
using Key< Int >::SD = boost::container::flat_map<Key<Int>, Val>

Handle for State-like (actually State-parent) data structure.

Template Parameters
ValValue-type, cf. State.

Constructor & Destructor Documentation

◆ Key()

template<class Int >
Key< Int >::Key ( Int a,
Int b,
Int c )
inline

Construct a new Key object from an entry.

Parameters
aspatial & polarization mode
bdistinguishability mode
coccupation number

Member Function Documentation

◆ add()

template<class Int >
void Key< Int >::add ( const Par & p)
inline

Adds a boost::container::flat_map<std::pair<Int, Int>, Int>, if entry exist, occupation numbers are added.

Parameters
pboost::container::flat_map<std::pair<Int, Int>, Int> to add.

◆ addEnd()

template<class Int >
void Key< Int >::addEnd ( const Int & a,
const Int & b,
const Int & c )
inline

Adds entry and the end.

Parameters
aSpatial&Polarization mode
bDistinguishability mode
cOccupation number

◆ apply() [1/2]

template<class Int >
template<class Val , class Real >
SD< Val > Key< Int >::apply ( const std::vector< Val > & U,
const std::vector< Int > & modes,
const Real & tol ) const
inline

Applies a Unitary in second quantization.

Template Parameters
ValAmplitude type that is used in the State
RealReal number type that should be used, e.g. float
Parameters
UUnitary in line format
modesAffected modes, max 2.
tolTolerance for the aplitude, amplitude with absolute value lower than tol are discarded
Returns
SD<Val> State similar data structure one gets, if one applies U on the implicit state (Key : 1.0).

◆ apply() [2/2]

template<class Int >
template<class Val >
Val Key< Int >::apply ( const Val & U,
const Int & mode ) const
inline

Applies a Unitary in second quantization for a single mode.

Template Parameters
ValAmplitude type that is used in the State
Parameters
UUnitary in line format
modeaffected mode
Returns
Val The factor for the amplitude

◆ factor() [1/2]

template<class Int >
template<class Val >
Val Key< Int >::factor ( ) const
inline

Normalization factor for second-quantization for all modes.

Template Parameters
ValValue-type, cf. State
Returns
Val The normalization factor

◆ factor() [2/2]

template<class Int >
template<class Val >
Val Key< Int >::factor ( Int a,
Int b ) const
inline

Normalization factor for second-quantization for Spatial&Polarization modes a and b.

Template Parameters
ValValue-type, cf. State
Parameters
aSpatial&Polarization mode
bSpatial&Polarization mode
Returns
Val The normalization factor

◆ loss()

template<class Int >
template<class Val >
SD< Val > Key< Int >::loss ( const std::vector< Int > & modes,
const Int & lossMode,
Int & maxLM ) const
inline

Applies loss with uniform probability per photon on the modes.

Template Parameters
ValAmplitude type that is used in the State
Parameters
modesSpatial&Polarization Modes affected by loss
lossModeSpatial&Polarization Mode the photon goes to
maxLMSaves the highest mode used for loss.
Returns
SD<Val>, i.e. boost::container::flat_map<Key<Int>, Val>, that is obtained by loss on (Key:1.0)

◆ notEmpty()

template<class Int >
bool Key< Int >::notEmpty ( const std::vector< std::vector< Int > > & allModes) const
inline

Checks if the key has at least one photon in on of the modes in allModes.

Parameters
allModesSpatial&Distinguishability modes to check
Returns
true, if there is at least one photon in one of the mode
false, otherwise

◆ operator Par()

template<class Int >
Key< Int >::operator Par ( ) const
inline

Returns this as boost::container::flat_map<std::pair<Int, Int>, Int>.

Returns
Par, i.e. boost::container::flat_map<std::pair<Int, Int>, Int>

◆ overlapping()

template<class Int >
bool Key< Int >::overlapping ( const boost::container::flat_map< Int, Int > & ref) const
inline

Checks if the Key containes data of a boost::container::flat_map<Int, Int>.

Parameters
refThe data to check if contained
Returns
Bool, if contained or not

◆ sameDModeDel()

template<class Int >
bool Key< Int >::sameDModeDel ( const std::vector< Int > & m)
inline

Checks if all S&P modes in m have the same distinguishability mode and deletes all modes in m.

Parameters
mSpatial&Polarization modes to check
Returns
true, if all modes in m have the same distinguishability mode
false, otherwise

◆ swap()

template<class Int >
void Key< Int >::swap ( Int a,
Int b )
inline

Swaps Spatial&Polarization modes a and b.

Parameters
aSpatial&Polarization mode
bSpatial&Polarization mode

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