decompose#

Decompose the unitary matrix

Classes

UnitaryDecomposer(unitary[, method])

This class is to decompose a unitary matrix into the Clements/Reck architecture.

class UnitaryDecomposer(unitary: ndarray | Tensor, method: str = 'cssr')[source]#

Bases: object

This class is to decompose a unitary matrix into the Clements/Reck architecture.

Parameters:
  • unitary (ndarray | Tensor) – The unitary matrix to be decomposed.

  • method (str) – The decomposition method, only 16 values ('rssr', 'rsdr', 'rdsr', 'rddr', 'rssl', 'rsdl', 'rdsl', 'rddl', 'cssr', 'csdr', 'cdsr', 'cddr', 'cssl', 'csdl', 'cdsl', 'cddl') are valid. The first char denotes the Clements or Reck architecture. The second char denotes single or double arms of outer phase shifters. The third char denotes single or double arms of inner phase shifters. The last char denotes the position of a column of phase shifters, i.e., 'l' for left and 'r' for right. Default: 'cssr'

decomp() tuple[dict, dict, dict][source]#

Decompose the unitary matrix.

The third dictionary is the representation of the positions and the angles of all phase shifters.

ps_pos(dic_mzi, phase_angle)[source]#

Label the position of each phaseshifter for 'cssr' case.

sort_mzi(mzi_info)[source]#

Sort mzi parameters in the same array for plotting.