Some helper functions for the simulation.
More...
#include "State.hpp"
#include "Key.hpp"
#include <iomanip>
|
|
template<class T > |
| using | CNum = std::complex<T> |
| |
|
| 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.
|
| |
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
- Copyright
- Copyright (c) 2024, provided under CC BY-NC 4.0. license
◆ 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
-
| K | Key type that should be used. |
| V | Amplitude type that should be used, e.g. float or std::complex<float> |
| R | Real number type that should be used, e.g. |
- Parameters
-
| S | State to apply loss on |
| pos | current position in circuit |
| modes | modes affected by loss |
| lossPos | potitions 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
-
- Parameters
-
- 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
-
| V | First vector, at least len 2 with identifier on 0 and overlap on 1 |
| W | Second 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
-
| R | Real number type that should be used, e.g. float. |
- Parameters
-
| LossPositions | Positions of loss in the circuit |
| doublePrep | Spatial&Polarization modes with two-photon preparation |
| angleErrs | Rotation error for wave plated |
| ovl | pairwise overlap of wave functions |
| path | Path-prefix where to save |
| rank | Rank of the process, used for saving |
| res | Result of the simulation |