Linopt
Linear optics circuit calculator
Namespaces | Classes | Typedefs | Functions | Variables
linopt Namespace Reference

The main namespace containing all library classes, functions, etc. More...

Namespaces

 execution
 The namespace containing execution policies used by several library functions.
 

Classes

class  Basis
 The class representing a collection of Fock states. More...
 
class  Circuit
 
class  CostFunctor
 
class  Fock
 The class representing a Fock state. More...
 
class  GeneralError
 The base exception class. More...
 
class  LogFunctor
 
class  NotSupported
 
class  NotUnitary
 The object of this type is thrown when a unitary matrix is expected, but it is not. More...
 
class  StanisicFunctor
 
class  State
 The class representing a linear optical state. More...
 
struct  Version
 Library version specification. More...
 
class  WrongSize
 The object of this type is thrown when an object of improper size is encountered. More...
 

Typedefs

using Matrix = Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >
 
using Column = Eigen::Matrix< Complex, Eigen::Dynamic, 1 >
 
using Row = Eigen::Matrix< Complex, 1, Eigen::Dynamic >
 
using Point = std::vector< Real >
 
using FockAmpFunction = std::function< Complex(const Fock &)>
 A typedef of a function taking a Fock state as an argument and returning a corresponding complex_type amplitude.
 
using Real = double
 
using Complex = std::complex< Real >
 

Functions

void clementsDesign (Matrix &M, const Point &x, const Point &y)
 Fills a unitary matrix according to the Clements design. More...
 
void clementsDesign (Matrix &M, const Point &x)
 Equivalent to clementsDesign(M, x, y) with all \( y_i = 0 \). More...
 
Matrix clementsDesign (const Point &x, const Point &y)
 This function is equivalent to clementsDesign(M, x, y) with M being the identity matrix. More...
 
Matrix clementsDesign (const Point &x)
 This function is equivalent to clementsDesign(M, x) with M being the identity matrix. More...
 
void getClementsDesign (Matrix &M, Point &x, Real eps=defaultEpsilon)
 Calculates phase-shift coefficients for a unitary matrix M according to the Clements design. More...
 
Point getClementsDesign (Matrix &M, Real eps=defaultEpsilon)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
std::string formatErrorMessage (std::string msg, const char *func)
 
void hurwitzParametrization (Matrix &M, const Point &x)
 Fills a unitary matrix according to the Hurwitz parametrization. More...
 
Matrix hurwitzParametrization (const Point &x)
 Returns a matrix parametrized according to the Hurwitz parametrization. More...
 
void expHermiteParametrization (Matrix &M, const Point &x)
 Fills a unitary matrix according to the exponential-Hermitian parametrization. More...
 
Matrix expHermiteParametrization (const Point &x)
 Returns a matrix parametrized according to the exponential-Hermitian parametrization. More...
 
Real matrixFidelity (const Matrix &A, const Matrix &B)
 Calculates normalized fidelity between two matrices. More...
 
bool isColumnUnitary (const Matrix &M, Real eps=defaultEpsilon)
 Tests whether a matrix is column-unitary. More...
 
bool isRowUnitary (const Matrix &M, Real eps=defaultEpsilon)
 Tests whether a matrix is row-unitary. More...
 
bool isUnitary (const Matrix &M, Real eps=defaultEpsilon)
 Tests whether a matrix is unitary. More...
 
Complex permanent (const Matrix &M)
 Calculates permanent of a square matrix. More...
 
template<typename T >
mod (T x, T a)
 
int isqrt (int x)
 
template<typename T >
std::ostream & printArray (std::ostream &stream, const T &a, const char *b1="{", const char *delim=", ", const char *b2="}")
 
std::ostream & printComplex (std::ostream &stream, const Complex &x)
 
bool operator== (const Fock &f, const Fock &g)
 Tests whether two Fock states are equal.
 
bool operator< (const Fock &f, const Fock &g)
 Compares two Fock states in lexicographic order. More...
 
bool operator!= (const Fock &f, const Fock &g)
 Tests whether two Fock states differ.
 
bool operator> (const Fock &f, const Fock &g)
 Compares two Fock states in lexicographic order. More...
 
bool operator<= (const Fock &f, const Fock &g)
 Compares two Fock states in lexicographic order. More...
 
bool operator>= (const Fock &f, const Fock &g)
 Compares two Fock states in lexicographic order. More...
 
State operator* (Complex x, const State &s)
 Multiplies a state by a complex number.
 
Complex dot (const State &a, const State &b)
 Calculates a dot (scalar) product.
 

Variables

constexpr Real defaultEpsilon = 1e-15
 Default precision for numeric comparison operations.
 

Detailed Description

The main namespace containing all library classes, functions, etc.