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

Definition of the data structure used to represent states. Inherits from boost::container::flat_map<Key, Val>. More...

#include <State.hpp>

Inheritance diagram for State< Key, Val, Real >:

Public Member Functions

 State ()
 Construct a new (empty) State object.
 
 State (Key k)
 Construct a new State object from a single key with amplitude 1.0.
 
void set (Val(*f)(const WF &, const WF &))
 Sets the overlap function to f.
 
void set (Real t)
 Sets the tolerance to t.
 
void set (Int n)
 Sets the lossMode to n.
 
void set (Par &&p) noexcept
 Sets the actual State data to p.
 
void set (const Par &p)
 Sets the actual State data to p.
 
void set (const Key &k, const Val &v)
 Inserts/assigns a new Key Value pair.
 
void set (Key &&k, const Val &v)
 Inserts/assigns a new Key Value pair.
 
void set (Int a, Int b, Int c, const Val &v)
 Inserts/assigns a new Key Value pair. The key is implicitly given by (a,b,c).
 
void add (const Par &p)
 Adds an state-like object to a State. If a Key is already in the state the amplitudes are added.
 
void add (Par &&p)
 Adds an state-like object to a State. If a Key is already in the state the amplitudes are added.
 
void add (const Par &p, const Val &v)
 Adds an scaled state-like object to a State. If a Key is already in the state the amplitudes are added.
 
Real norm () const
 Returns the norm of a state.
 
Par getPar ()
 Get the Par, i.e. boost::container::flat_map<Key, Val>, object.
 
Par && get_parMoved ()
 Get the Par, i.e. boost::container::flat_map<Key, Val>, object moved.
 
OWF addBasisElem (const WF &)
 Uses Gram-Schmidt procedure to add a basis element to the orthogonal basis. Used to get orthogonal Distinguishability modes.
 
void addPhoton (const WF &, Int, Int)
 Adds num new photon to the state with the wave function wf in the Spatial&Polarization mode m.
 
void apply (const std::vector< Val > &U, const std::vector< Int > &modes)
 Applies a unitary U in second-quantization on the Spatial&Polarization modes in modes (max 2).
 
void apply (const Val &U, const Int &mode)
 Applies a unitary U in second-quantization on the Spatial&Polarization modes in modes (max 1).
 
void swap (Int a, Int b)
 Swaps two Spatial&Polarization modes, used to implement a PBS.
 
void clean ()
 Removes all Key-Val pairs where the abs of the amplitude is lower than tol.
 
void normalise ()
 Normalizes the state.
 
void mul (Val)
 Multiplies the state with a scalar n.
 
State< Key, Val, Real > overlapWithFilter (const boost::container::flat_map< Int, Int > &, const std::vector< std::vector< Int > > &, const std::vector< boost::container::flat_map< Int, Int > > &)
 Computes the overlap to a measurement pattern and filters according to a fidelity reference.
 
void overlapCompl (const std::vector< boost::container::flat_map< Int, Int > > &, const std::vector< std::vector< Int > > &={})
 Keeps the part of the state that is either rejected because of the measurement result or because of post-selection.
 
void loss (const std::vector< Int > &)
 Performes loss of one photons on the modes in modes.
 
void notEmpty (const std::vector< std::vector< Int > > &)
 Filters out these key that haven't at least one photon in on of the modes in allModes.
 
void sameDModeDel (const std::vector< std::vector< Int > > &, const std::vector< Val > &)
 Keeps the keys where all Distinguishability Modes are the same for one of the collection of modes in modes.
 

Detailed Description

template<class Key, class Val, class Real>
class State< Key, Val, Real >

Definition of the data structure used to represent states. Inherits from boost::container::flat_map<Key, Val>.

Template Parameters
KeyKey type used in the State
ValAmplitude type used in the State, e.g. float or std::complex<float>
RealReal number type that should be used, e.g. float.

Constructor & Destructor Documentation

◆ State()

template<class Key , class Val , class Real >
State< Key, Val, Real >::State ( Key k)
inline

Construct a new State object from a single key with amplitude 1.0.

Parameters
kKey for the State (k:1.0).

Member Function Documentation

◆ add() [1/3]

template<class Key , class Val , class Real >
void State< Key, Val, Real >::add ( const Par & p)
inline

Adds an state-like object to a State. If a Key is already in the state the amplitudes are added.

Parameters
pState-like object to be added.

◆ add() [2/3]

template<class Key , class Val , class Real >
void State< Key, Val, Real >::add ( const Par & p,
const Val & v )
inline

Adds an scaled state-like object to a State. If a Key is already in the state the amplitudes are added.

Parameters
pState-like object to be added.
vp is firsted scaled with v before added to this.

◆ add() [3/3]

template<class Key , class Val , class Real >
void State< Key, Val, Real >::add ( Par && p)
inline

Adds an state-like object to a State. If a Key is already in the state the amplitudes are added.

Parameters
pState-like object to be added.

◆ addBasisElem()

template<class Key , class Val , class Real >
std::vector< Val > State< Key, Val, Real >::addBasisElem ( const WF & wf)

Uses Gram-Schmidt procedure to add a basis element to the orthogonal basis. Used to get orthogonal Distinguishability modes.

Parameters
wfWave-function of the new entry represented as vector
Returns
std::vector<Val> Returns the inner products of wf with all basis elements after G.-S. procedure.

◆ addPhoton()

template<class Key , class Val , class Real >
void State< Key, Val, Real >::addPhoton ( const WF & wf,
Int mode,
Int num )

Adds num new photon to the state with the wave function wf in the Spatial&Polarization mode m.

Parameters
wfWave function of the new photons represented as vector
modeSpatial&Polarization mode of the new photons
numNumber of new photons

◆ apply() [1/2]

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

Applies a unitary U in second-quantization on the Spatial&Polarization modes in modes (max 2).

Parameters
UUnitary represented as line
modesmodes affected by the operation

◆ apply() [2/2]

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

Applies a unitary U in second-quantization on the Spatial&Polarization modes in modes (max 1).

Parameters
UUnitary, i.e. here a number with abs value 1
modemode affected by the operation

◆ get_parMoved()

template<class Key , class Val , class Real >
Par && State< Key, Val, Real >::get_parMoved ( )
inline

Get the Par, i.e. boost::container::flat_map<Key, Val>, object moved.

Returns
Par&&

◆ getPar()

template<class Key , class Val , class Real >
Par State< Key, Val, Real >::getPar ( )
inline

Get the Par, i.e. boost::container::flat_map<Key, Val>, object.

Returns
Par

◆ loss()

template<class Key , class Val , class Real >
void State< Key, Val, Real >::loss ( const std::vector< Int > & modes)
inline

Performes loss of one photons on the modes in modes.

Parameters
modesSpatial&Polarization modes to perform loss on

◆ mul()

template<class Key , class Val , class Real >
void State< Key, Val, Real >::mul ( Val n)
inline

Multiplies the state with a scalar n.

Parameters
nScalar to multiply the state with

◆ norm()

template<class Key , class Val , class Real >
Real State< Key, Val, Real >::norm ( ) const
inline

Returns the norm of a state.

Returns
Real The norm of the state

◆ notEmpty()

template<class Key , class Val , class Real >
void State< Key, Val, Real >::notEmpty ( const std::vector< std::vector< Int > > & allModes)
inline

Filters out these key that haven't at least one photon in on of the modes in allModes.

Parameters
allModesSpatial&Distinguishability modes to check.

◆ overlapCompl()

template<class Key , class Val , class Real >
void State< Key, Val, Real >::overlapCompl ( const std::vector< boost::container::flat_map< Int, Int > > & MVec,
const std::vector< std::vector< Int > > & allModes = {} )
inline

Keeps the part of the state that is either rejected because of the measurement result or because of post-selection.

Parameters
MVecMeasurement pattern {S&P mode: total occupation-numer}. Filters out the Keys that overlap with one of these.
allModesModes for post-selection. Filters our those that are accepted by post-selection, i.e. for all of the vectors at least one is not occupied

◆ overlapWithFilter()

template<class Key , class Val , class Real >
State< Key, Val, Real > State< Key, Val, Real >::overlapWithFilter ( const boost::container::flat_map< Int, Int > & ref,
const std::vector< std::vector< Int > > & allModes,
const std::vector< boost::container::flat_map< Int, Int > > & fref )
inline

Computes the overlap to a measurement pattern and filters according to a fidelity reference.

Filters the state such that the measurement patter is overlapping and the fidelity reference is overlapping. Returns the part of the state that is accepted by the measurement and post-selection but is not overlapping with the fidelity refence.

Parameters
refThe measurement pattern {S&P mode: total occupation-numer}. All S&P modes not in ref are accepted either way.
allModesvector of vector of S&P modes of fidelity reference used to pre-filter. At least for one of them all modes have to be occupied. This implements post-selections.
frefThe fidelity reference. Used to further filter the measurement result, keeps that parts that could contribute to the fidelity.
Returns
State<Key, Val, Real>

◆ sameDModeDel()

template<class Key , class Val , class Real >
void State< Key, Val, Real >::sameDModeDel ( const std::vector< std::vector< Int > > & modes,
const std::vector< Val > & facs )
inline

Keeps the keys where all Distinguishability Modes are the same for one of the collection of modes in modes.

Parameters
modesFor one of the vectors in modes, all Distinguishability Modes have to be the same for the key to be included in the output.
facsFactors associated to the vectors in modes. These are used for the amplitudes correspoding to the keys, in which all the modes in the correspoding vector have the same Distinguishability Modes.

◆ set() [1/8]

template<class Key , class Val , class Real >
void State< Key, Val, Real >::set ( const Key & k,
const Val & v )
inline

Inserts/assigns a new Key Value pair.

Parameters
kKey for new entry. If k is already in the State the amplitude is overwritten with v.
vnew amplitude.

◆ set() [2/8]

template<class Key , class Val , class Real >
void State< Key, Val, Real >::set ( const Par & p)
inline

Sets the actual State data to p.

Parameters
pThe data is set to.

◆ set() [3/8]

template<class Key , class Val , class Real >
void State< Key, Val, Real >::set ( Int a,
Int b,
Int c,
const Val & v )
inline

Inserts/assigns a new Key Value pair. The key is implicitly given by (a,b,c).

Parameters
aSpatial&Polarization mode
bDistinguishability mode
cOccupation number.
vnew amplitude.

◆ set() [4/8]

template<class Key , class Val , class Real >
void State< Key, Val, Real >::set ( Int n)
inline

Sets the lossMode to n.

Parameters
nInt the lossMode is set to.

◆ set() [5/8]

template<class Key , class Val , class Real >
void State< Key, Val, Real >::set ( Key && k,
const Val & v )
inline

Inserts/assigns a new Key Value pair.

Parameters
kKey for new entry. If k is already in the State the amplitude is overwritten with v. Key is moved.
vnew amplitude.

◆ set() [6/8]

template<class Key , class Val , class Real >
void State< Key, Val, Real >::set ( Par && p)
inlinenoexcept

Sets the actual State data to p.

Parameters
pThe data is set to. Moved input.

◆ set() [7/8]

template<class Key , class Val , class Real >
void State< Key, Val, Real >::set ( Real t)
inline

Sets the tolerance to t.

Parameters
tReal the tolerance is set to.

◆ set() [8/8]

template<class Key , class Val , class Real >
void State< Key, Val, Real >::set ( Val(* )(const WF &, const WF &))
inline

Sets the overlap function to f.

Parameters
ffunction that gets two vector<Val> and returns a Val, that is the overlap.

◆ swap()

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

Swaps two Spatial&Polarization modes, used to implement a PBS.

Parameters
aFirst Spatial&Polarization mode
bSecond Spatial&Polarization mode

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