cirq.diagonalize_real_symmetric_matrix

cirq.diagonalize_real_symmetric_matrix(matrix: numpy.ndarray, tolerance: cirq.linalg.tolerance.Tolerance = Tolerance(rtol=1e-05, atol=1e-08, equal_nan=False)) → numpy.ndarray[source]

Returns an orthogonal matrix that diagonalizes the given matrix.

Parameters:
  • matrix – A real symmetric matrix to diagonalize.
  • tolerance – Numeric error thresholds.
Returns:

An orthogonal matrix P such that P.T @ matrix @ P is diagonal.

Raises:
  • ValueError – Matrix isn’t real symmetric.
  • ArithmeticError – Failed to meet specified tolerance.