Decompositions

Module name: thewalrus.decompositions

This module implements common shared matrix decompositions that are used to perform gate decompositions.

Summary

williamson(V[, rtol, atol])

Williamson decomposition of positive-definite (real) symmetric matrix.

symplectic_eigenvals(cov)

Returns the symplectic eigenvalues of a covariance matrix.

Code details

symplectic_eigenvals(cov)[source]

Returns the symplectic eigenvalues of a covariance matrix.

Parameters

cov (array) – a covariance matrix

Returns

symplectic eigenvalues

Return type

(array)

williamson(V, rtol=1e-05, atol=1e-08)[source]

Williamson decomposition of positive-definite (real) symmetric matrix.

See this thread and the Williamson decomposition documentation

Parameters
  • V (array[float]) – positive definite symmetric (real) matrix

  • rtol (float) – the relative tolerance parameter used in np.allclose

  • atol (float) – the absolute tolerance parameter used in np.allclose

Returns

(Db, S) where Db is a diagonal matrix

and S is a symplectic matrix such that \(V = S^T Db S\)

Return type

tuple[array,array]