pygsti.tools.matrixtools.real_matrix_log

pygsti.tools.matrixtools.real_matrix_log#

real_matrix_log(m, action_if_imaginary='raise', tol=1e-08)#

Construct a real logarithm of real matrix m.

This is possible when negative eigenvalues of m come in pairs, so that they can be viewed as complex conjugate pairs.

Parameters:
  • m (numpy array) – The matrix to take the logarithm of

  • action_if_imaginary ({"raise","warn","ignore"}, optional) – What action should be taken if a real-valued logarithm cannot be found. “raise” raises a ValueError, “warn” issues a warning, and “ignore” ignores the condition and simply returns the complex-valued result.

  • tol (float, optional) – An internal tolerance used when testing for equivalence and zero imaginary parts (real-ness).

Returns:

logM – An matrix logM, of the same shape as m, such that m = exp(logM)

Return type:

numpy array