Random matrices¶
This submodule provides access to utility functions to generate random unitary, symplectic and covariance matrices.
-
random_covariance
(N, hbar=2, pure=False, block_diag=False)[source]¶ Random covariance matrix.
- Parameters
N (int) – number of modes
hbar (float) – the value of \(\hbar\) to use in the definition of the quadrature operators \(x\) and \(p\)
pure (bool) – If True, a random covariance matrix corresponding to a pure state is returned.
block_diag (bool) – If True, uses passive Gaussian transformations that are orthogonal instead of unitary. This implies that the positions \(x\) do not mix with the momenta \(p\) and thus the covariance matrix is block diagonal.
- Returns
random \(2N\times 2N\) covariance matrix
- Return type
array
-
random_interferometer
(N, real=False)[source]¶ Random unitary matrix representing an interferometer. For more details, see [mezzadri2006].
- Parameters
N (int) – number of modes
real (bool) – return a random real orthogonal matrix
- Returns
random \(N\times N\) unitary distributed with the Haar measure
- Return type
array
-
random_symplectic
(N, passive=False, block_diag=False, scale=1.0)[source]¶ Random symplectic matrix representing a Gaussian transformation.
The squeezing parameters \(r\) for active transformations are randomly sampled from the standard normal distribution, while passive transformations are randomly sampled from the Haar measure. Note that for the Symplectic group there is no notion of Haar measure since this is group is not compact.
- Parameters
N (int) – number of modes
passive (bool) – If True, returns a passive Gaussian transformation (i.e., one that preserves photon number). If False, returns an active transformation.
block_diag (bool) – If True, uses passive Gaussian transformations that are orthogonal instead of unitary. This implies that the positions \(q\) do not mix with the momenta \(p\) and thus the symplectic operator is block diagonal
scale (float) – Sets the scale of the random values used as squeezing parameters. They will range from 0 to \(\sqrt{2}\texttt{scale}\)
- Returns
random \(2N\times 2N\) symplectic matrix
- Return type
array
Downloads