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

Some helper functions for State.hpp. More...

#include <vector>
#include <math.h>
#include <string>
#include <algorithm>
#include <sstream>
#include <complex>

Functions

template<class T >
conj (T t)
 Performs the usual complex conjugate.
 
template<>
float conj< float > (float f)
 Template specialization. Complex conjugate is identity for floats.
 
template<>
double conj< double > (double f)
 Template specialization. Complex conjugate is identity for doubles.
 
template<>
int conj< int > (int f)
 Template specialization. Complex conjugate is identity for ints.
 
template<class Val , class Real >
Val ovlpH (const std::vector< Val > &b, const std::vector< Real > &wf, Val(*get_ovlp)(const std::vector< Real > &, const std::vector< Real > &), const std::vector< std::vector< Real > > &waves)
 Computes the inner product of a OWF, and WF according to get_ovlp (cf. State).
 
template<class Val , class Real >
Val ovlp (const std::vector< Val > &b, const std::vector< Val > &c, Val(*get_ovlp)(const std::vector< Real > &, const std::vector< Real > &), const std::vector< std::vector< Real > > &waves)
 Computes the inner product of two proto-orthogonal wave functions according to get_ovlp. Used in addBasisElem() (cf. State).
 

Detailed Description

Some helper functions for State.hpp.

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

◆ conj()

template<class T >
T conj ( T t)

Performs the usual complex conjugate.

Template Parameters
TNumber type
Parameters
tNumber to perform the complex conj on.
Returns
T Complex conjugate

◆ conj< double >()

template<>
double conj< double > ( double f)

Template specialization. Complex conjugate is identity for doubles.

Parameters
tNumber to perform the complex conj on.
Returns
double Complex conjugate

◆ conj< float >()

template<>
float conj< float > ( float f)

Template specialization. Complex conjugate is identity for floats.

Parameters
tNumber to perform the complex conj on.
Returns
float Complex conjugate

◆ conj< int >()

template<>
int conj< int > ( int f)

Template specialization. Complex conjugate is identity for ints.

Parameters
tNumber to perform the complex conj on.
Returns
int Complex conjugate

◆ ovlp()

template<class Val , class Real >
Val ovlp ( const std::vector< Val > & b,
const std::vector< Val > & c,
Val(* get_ovlp )(const std::vector< Real > &, const std::vector< Real > &),
const std::vector< std::vector< Real > > & waves )

Computes the inner product of two proto-orthogonal wave functions according to get_ovlp. Used in addBasisElem() (cf. State).

Template Parameters
ValValue-type, cf. State.
RealReal-type, cf. State.
Parameters
bproto-orthogonal wave function
cproto-orthogonal wave function
Functionthat provides the overlap given two wave functions.
wavesWave functions that are used to express b. b provides the coefficients.
Returns
Val Overlap of b and c.

◆ ovlpH()

template<class Val , class Real >
Val ovlpH ( const std::vector< Val > & b,
const std::vector< Real > & wf,
Val(* get_ovlp )(const std::vector< Real > &, const std::vector< Real > &),
const std::vector< std::vector< Real > > & waves )

Computes the inner product of a OWF, and WF according to get_ovlp (cf. State).

Template Parameters
ValValue-type, cf. State.
RealReal-type, cf. State
Parameters
bOrthogonal wave function (OWF).
wfWave function WF
get_ovlpFunction that provides the overlap given two wave functions.
wavesWave functions that are used to express b. b provides the coefficients.
Returns
Val Overlap of b and wf.