Linopt
Linear optics circuit calculator
Functions
Circuit design

Circuit designs and decompositions into elementary blocks. More...

Functions

void linopt::clementsDesign (Matrix &M, const Point &x, const Point &y)
 Fills a unitary matrix according to the Clements design. More...
 
void linopt::clementsDesign (Matrix &M, const Point &x)
 Equivalent to clementsDesign(M, x, y) with all \( y_i = 0 \). More...
 
Matrix linopt::clementsDesign (const Point &x, const Point &y)
 This function is equivalent to clementsDesign(M, x, y) with M being the identity matrix. More...
 
Matrix linopt::clementsDesign (const Point &x)
 This function is equivalent to clementsDesign(M, x) with M being the identity matrix. More...
 
void linopt::getClementsDesign (Matrix &M, Point &x, Real eps=defaultEpsilon)
 Calculates phase-shift coefficients for a unitary matrix M according to the Clements design. More...
 
Point linopt::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...
 

Detailed Description

Circuit designs and decompositions into elementary blocks.

Function Documentation

◆ clementsDesign() [1/4]

void linopt::clementsDesign ( Matrix &  M,
const Point &  x,
const Point &  y 
)

Fills a unitary matrix according to the Clements design.

Parameters
[in,out]M– on input a diagonal unitary matrix of size \( N \times N \) is provided. If the matrix is not unitary or have improper size (calculated from x size), then it will be resized accordingly and set to the identity matrix. On output this matrix is used to store the final result.
[in]x– an array of \( N(N-1) \) phase-shift parameters, such that even elements are \( \phi \) – phase shifts before the beam splitters, and odd ones are \( \theta \) – halves of phase shifts between the beam splitters. All pairs of parameters go in reverse column-wise enumeration order.
[in]y– an array of beam splitters angle defects, such that even elements are defects of the first splitters, and odd ones are defects of the second splitters. All pairs of parameters go in reverse column-wise enumeration order.

Fills a unitary matrix parametrized according to the Clements parametrization with basic matrices of the form

\[ i e^{i\theta} \begin{pmatrix} e^{i\phi}\sin{\theta} & \cos{\theta} \\ e^{i\phi}\cos{\theta} & -\sin{\theta} \end{pmatrix} \]

with beam splitter angle defects.

Exceptions
Ifx size is not equal to \( N(N-1) \) for some integer \( N \) or if x and y sizes do not match, then WrongSize is thrown.
See also
getClementsDesign()
W. R. Clements, et al. "Optimal design for universal multiport interferometers." Optica 3, pp. 1460-1465 (2016), https://doi.org/10.1364/OPTICA.3.001460

◆ clementsDesign() [2/4]

void linopt::clementsDesign ( Matrix &  M,
const Point &  x 
)

Equivalent to clementsDesign(M, x, y) with all \( y_i = 0 \).

This function is equivalent to the clementsDesign(M, x, y) with all elements of y set to zero. However, calculations are a bit faster than direct call of clementsDesign(M, x, y).

◆ clementsDesign() [3/4]

Matrix linopt::clementsDesign ( const Point &  x,
const Point &  y 
)

This function is equivalent to clementsDesign(M, x, y) with M being the identity matrix.

Returns
Calculated unitary matrix M.

◆ clementsDesign() [4/4]

Matrix linopt::clementsDesign ( const Point &  x)

This function is equivalent to clementsDesign(M, x) with M being the identity matrix.

Returns
Calculated unitary matrix M.

◆ getClementsDesign() [1/2]

void linopt::getClementsDesign ( Matrix &  M,
Point &  x,
Real  eps = defaultEpsilon 
)

Calculates phase-shift coefficients for a unitary matrix M according to the Clements design.

Parameters
[in,out]M– on input a unitary \( N \times N \) matrix is specified. On output a diagonal unitary matrix is produced. The original matrix is destroyed during calculations.
[out]x– the array of \( N(N-1) \) phase-shift parameters, such that even elements are \( \phi \) – phase shifts before the beam splitters, and odd ones are \( \theta \) – halves of phase shifts between the beam splitters. All pairs of parameters go in reverse column-wise enumeration order. If x has improper size then it will be resized.
[in]eps– precision for unitarity test of the input matrix M. If eps is negative then no tests are performed.

Returns phase-shift coefficients and leaves a diagonal unitary matrix according to the Clements design with basic matrices of the form

\[ i e^{i\theta} \begin{pmatrix} e^{i\phi}\sin{\theta} & \cos{\theta} \\ e^{i\phi}\cos{\theta} & -\sin{\theta} \end{pmatrix}. \]

As a result of multiplication

\[ \begin{pmatrix} 1/\sqrt{2} & i/\sqrt{2} \\ i/\sqrt{2} & 1/\sqrt{2} \end{pmatrix} \begin{pmatrix} e^{i2\theta} & 0 \\ 0 & 1 \end{pmatrix} \begin{pmatrix} 1/\sqrt{2} & i/\sqrt{2} \\ i/\sqrt{2} & 1/\sqrt{2} \end{pmatrix} \begin{pmatrix} e^{i\phi} & 0 \\ 0 & 1 \end{pmatrix} \]

This function is effectively inverse of the clementsDesign(M, x).

Exceptions
IfM is not unitary within given precision eps, then NotUnitary is thrown.
See also
clementsDesign()
W. R. Clements, et al. "Optimal design for universal multiport interferometers." Optica 3, pp. 1460-1465 (2016), https://doi.org/10.1364/OPTICA.3.001460

◆ getClementsDesign() [2/2]

Point linopt::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.

Returns
Calculated array x of phase-shift parameters.