Key class, that implements the functions needed for State. Inherits from boost::container::flat_map<std::pair<Int, Int>, Int>.
More...
#include <Key.hpp>
|
|
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.
|
| |
|
|
| 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.
|
| |
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
-
| Int | Class used for integer numbers. |
◆ 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
-
| Val | Value-type, cf. State. |
◆ Key()
Construct a new Key object from an entry.
- Parameters
-
| a | spatial & polarization mode |
| b | distinguishability mode |
| c | occupation number |
◆ 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
-
| p | boost::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
-
| a | Spatial&Polarization mode |
| b | Distinguishability mode |
| c | Occupation 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
-
| Val | Amplitude type that is used in the State |
| Real | Real number type that should be used, e.g. float |
- Parameters
-
| U | Unitary in line format |
| modes | Affected modes, max 2. |
| tol | Tolerance 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
-
| Val | Amplitude type that is used in the State |
- Parameters
-
| U | Unitary in line format |
| mode | affected 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
-
- 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
-
- Parameters
-
| a | Spatial&Polarization mode |
| b | Spatial&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
-
| Val | Amplitude type that is used in the State |
- Parameters
-
| modes | Spatial&Polarization Modes affected by loss |
| lossMode | Spatial&Polarization Mode the photon goes to |
| maxLM | Saves 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
-
| allModes | Spatial&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
-
| ref | The 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
-
| m | Spatial&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
-
| a | Spatial&Polarization mode |
| b | Spatial&Polarization mode |
The documentation for this class was generated from the following file:
- /Users/fabianwiesner/Desktop/Work/PhotonicQC/FidCodeUpdate/simphoqcirc/Key.hpp