Linopt
Linear optics circuit calculator
|
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... | |
Circuit designs and decompositions into elementary blocks.
void linopt::clementsDesign | ( | Matrix & | M, |
const Point & | x, | ||
const Point & | y | ||
) |
Fills a unitary matrix according to the Clements design.
[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.
If | x 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. |
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)
.
Matrix linopt::clementsDesign | ( | const Point & | x, |
const Point & | y | ||
) |
This function is equivalent to clementsDesign(M, x, y)
with M
being the identity matrix.
M
. Matrix linopt::clementsDesign | ( | const Point & | x | ) |
This function is equivalent to clementsDesign(M, x)
with M
being the identity matrix.
M
. void linopt::getClementsDesign | ( | Matrix & | M, |
Point & | x, | ||
Real | eps = defaultEpsilon |
||
) |
Calculates phase-shift coefficients for a unitary matrix M
according to the Clements design.
[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)
.
If | M is not unitary within given precision eps , then NotUnitary is thrown. |
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.
x
of phase-shift parameters.