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

The class representing a Fock state. More...

#include <states.h>

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

Public Types

using Vector = std::vector< int >
 Convenience typedef to std::vector.
 
using Value = int
 
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
 Returns the number of modes in a Fock state.
 
void pushBack (Value n)
 
void popBack ()
 
 Fock ()=default
 Default constructor.
 
 Fock (const Vector &v)
 Construct a Fock state from a fock::vector_class.
 
int total () const
 Returns the total number of photons in all modes.
 
Real prodFact () const
 Returns a product of factorials of occupation numbers.
 
Fock operator* (const Fock &f) const
 Returns a tensor product of *this and f.
 
Fockoperator*= (const Fock &f)
 Effectively equivalent to *this = (*this) * f.
 
Fock operator+ (const Fock &f) const
 Returns a sum of two Fock states (elementwise addition of corresponding occupation numbers). More...
 
Fockoperator+= (const Fock &f)
 Effectively equivalent to *this = (*this) + f.
 

Detailed Description

The class representing a Fock state.

A Fock state is a state with exact number of photons in each mode. A Fock state is represented as a list of nonnegative integers:

\[ | n_0, \dots, n_m \rangle, \]

where \( n_i \) is called an occupation number of an \( i \)-th mode.

The interface of this class is very similar to std::vector.

Member Function Documentation

◆ operator+()

Fock Fock::operator+ ( const Fock f) const

Returns a sum of two Fock states (elementwise addition of corresponding occupation numbers).

Exceptions
If*this and f have different sizes then WrongSize is thrown.

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