Code for: The Influence of Experimental Imperfections on Photonic GHZ State Generation
Loading...
Searching...
No Matches
/Users/fabianwiesner/Desktop/Work/PhotonicQC/FidCodeUpdate/simphoqcirc/simAux.hpp File Reference

Some helper functions for the simulation. More...

#include "State.hpp"
#include "Key.hpp"
#include <iomanip>

Typedefs

template<class T >
using CNum = std::complex<T>
 

Functions

template<class V , class R >
std::array< std::vector< V >, 15 > genRotationsBasic (const std::vector< R > &angleErrs)
 Generate the rotation unitaries used for the wave-plates including the errors.
 
template<class R >
void write (const std::vector< int > &LossPositions, const std::vector< int > &doublePrep, const std::vector< R > &angleErrs, const R &ovl, const std::string &path, int rank, const std::vector< R > &res)
 Writes the results of the simulation to a file.
 
float trivOvlF (const std::vector< float > &V, const std::vector< float > &W)
 Given to float-vectors that parametrize wave functions, it returs the overlap, which is trivially saved in the first vector.
 
template<class K , class V , class R >
void detloss (State< K, V, R > &S, int pos, const std::vector< int > &modes, const std::vector< int > &lossPos)
 Applies loss on modes in S if the current position pos is in lossPos.
 

Detailed Description

Some helper functions for the simulation.

Author
Fabian Wiesner (fabia.nosp@m.n.wi.nosp@m.esner.nosp@m.97@g.nosp@m.mail..nosp@m.com)
Version
0.1
Date
2024-06-06

Function Documentation

◆ detloss()

template<class K , class V , class R >
void detloss ( State< K, V, R > & S,
int pos,
const std::vector< int > & modes,
const std::vector< int > & lossPos )

Applies loss on modes in S if the current position pos is in lossPos.

Template Parameters
KKey type that should be used.
VAmplitude type that should be used, e.g. float or std::complex<float>
RReal number type that should be used, e.g.
Parameters
SState to apply loss on
poscurrent position in circuit
modesmodes affected by loss
lossPospotitions in circuit where loss happens

◆ genRotationsBasic()

template<class V , class R >
std::array< std::vector< V >, 15 > genRotationsBasic ( const std::vector< R > & angleErrs)

Generate the rotation unitaries used for the wave-plates including the errors.

Template Parameters
VValue-type, cf. State
RReal-type, cf. State
Parameters
angleErrsRotation errors
Returns
std::array<std::vector<V>, 15> Unitaries for the rotations in line-form

◆ trivOvlF()

float trivOvlF ( const std::vector< float > & V,
const std::vector< float > & W )

Given to float-vectors that parametrize wave functions, it returs the overlap, which is trivially saved in the first vector.

Parameters
VFirst vector, at least len 2 with identifier on 0 and overlap on 1
WSecond vector, at least len 1 with identifier on 0
Returns
float Overlap of the wave functions

◆ write()

template<class R >
void write ( const std::vector< int > & LossPositions,
const std::vector< int > & doublePrep,
const std::vector< R > & angleErrs,
const R & ovl,
const std::string & path,
int rank,
const std::vector< R > & res )
inline

Writes the results of the simulation to a file.

Template Parameters
RReal number type that should be used, e.g. float.
Parameters
LossPositionsPositions of loss in the circuit
doublePrepSpatial&Polarization modes with two-photon preparation
angleErrsRotation error for wave plated
ovlpairwise overlap of wave functions
pathPath-prefix where to save
rankRank of the process, used for saving
resResult of the simulation