Linopt
Linear optics circuit calculator
|
The class representing a linear optical state. More...
#include <states.h>
Public Types | |
using | Element = std::pair< Fock, Complex > |
using | Map = std::map< Fock, Complex > |
using | Value = Complex |
using | value_type = Value |
using | Reference = Value & |
using | reference = Reference |
using | Iterator = Base::iterator |
using | ConstIterator = Base::const_iterator |
using | ReverseIterator = Base::reverse_iterator |
using | ConstReverseIterator = Base::const_reverse_iterator |
Public Member Functions | |
int | size () const |
State () | |
Default constructor. | |
State (const Map &m) | |
State (const Fock &f) | |
Constructs a state from fock with unit amplitude. | |
State (const Basis &b) | |
State | operator+ (const State &s) const |
Adds two states, i.e., calculates their superposition. | |
State & | operator+= (const State &s) |
Effectively equivalent to *this = (*this) + s . | |
State | operator- (const State &s) const |
Subtracts two states. | |
State & | operator-= (const State &s) |
Effectively equivalent to *this = (*this) - s . | |
State | operator* (const State &s) const |
Returns a tensor product of two states. | |
State & | operator*= (const State &s) |
Effectively equivalent to *this = (*this) * s . | |
State | operator- () const |
Negates amplitudes of the state. | |
State | operator* (Complex x) const |
Multiplies a state by a complex number. | |
State & | operator*= (Complex x) |
Effectively equivalent to *this = (*this) * x . | |
State | operator/ (Complex x) const |
Divides a state by a complex number. | |
State & | operator/= (Complex x) |
Effectively equivalent to *this = (*this) / x . | |
Real | norm () const |
Returns norm of the state. | |
State & | normalize () |
Normalizes the state to have unit norm. | |
Complex | dot (const State &s) const |
Calculates a dot (scalar) product. | |
State | postselect (const Fock &ancilla) const |
std::map< Fock, State > | postselect (int modes) const |
std::map< Fock, State > | postselect (const Basis &b) const |
Basis | getBasis () const |
void | setBasis (const Basis &b) |
std::vector< State::Value > | getAmplitudes () const |
template<typename ExecPolicy = execution::Seq> | |
void | setAmplitudes (const std::vector< Complex > &s) |
template<typename ExecPolicy = execution::Seq> | |
void | setAmplitudes (const FockAmpFunction &f) |
The class representing a linear optical state.
The interface of this class is very similar to std::map<Fock, Complex>
.