Linopt
Linear optics circuit calculator
Public Types | Public Member Functions | List of all members
linopt::State Class Reference

The class representing a linear optical state. More...

#include <states.h>

Inheritance diagram for linopt::State:
Inheritance graph
[legend]
Collaboration diagram for linopt::State:
Collaboration graph
[legend]

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.
 
Stateoperator+= (const State &s)
 Effectively equivalent to *this = (*this) + s.
 
State operator- (const State &s) const
 Subtracts two states.
 
Stateoperator-= (const State &s)
 Effectively equivalent to *this = (*this) - s.
 
State operator* (const State &s) const
 Returns a tensor product of two states.
 
Stateoperator*= (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.
 
Stateoperator*= (Complex x)
 Effectively equivalent to *this = (*this) * x.
 
State operator/ (Complex x) const
 Divides a state by a complex number.
 
Stateoperator/= (Complex x)
 Effectively equivalent to *this = (*this) / x.
 
Real norm () const
 Returns norm of the state.
 
Statenormalize ()
 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, Statepostselect (int modes) const
 
std::map< Fock, Statepostselect (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 > &amps)
 
template<typename ExecPolicy = execution::Seq>
void setAmplitudes (const FockAmpFunction &f)
 

Detailed Description

The class representing a linear optical state.

The interface of this class is very similar to std::map<Fock, Complex>.


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