# sf.utils.random_covariance¶

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 $$q$$ 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