# naginterfaces.library.matop.real_​gen_​matrix_​log¶

naginterfaces.library.matop.real_gen_matrix_log(a)[source]

real_gen_matrix_log computes the principal matrix logarithm, , of a real matrix , with no eigenvalues on the closed negative real line.

For full information please refer to the NAG Library document for f01ej

https://www.nag.com/numeric/nl/nagdoc_29.2/flhtml/f01/f01ejf.html

Parameters
afloat, array-like, shape

The matrix .

Returns
afloat, ndarray, shape

The principal matrix logarithm, .

imnormfloat

If the function has given a reliable answer then . If differs from by more than unit roundoff (as returned by machine.precision) then the computed matrix logarithm is unreliable.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

is singular so the logarithm cannot be computed.

(errno )

was found to have eigenvalues on the negative real line. The principal logarithm is not defined in this case. complex_gen_matrix_log() can be used to find a complex non-principal logarithm.

(errno )

Warns
NagAlgorithmicWarning
(errno )

The arithmetic precision is higher than that used for the Padé approximant computed matrix logarithm.

Notes

Any nonsingular matrix has infinitely many logarithms. For a matrix with no eigenvalues on the closed negative real line, the principal logarithm is the unique logarithm whose spectrum lies in the strip .

is computed using the inverse scaling and squaring algorithm for the matrix logarithm described in Al–Mohy and Higham (2011), adapted to real matrices by Al–Mohy et al. (2012).

References

Al–Mohy, A H and Higham, N J, 2011, Improved inverse scaling and squaring algorithms for the matrix logarithm, SIAM J. Sci. Comput. (34(4)), C152–C169

Al–Mohy, A H, Higham, N J and Relton, S D, 2012, Computing the Fréchet derivative of the matrix logarithm and estimating the condition number, SIAM J. Sci. Comput. (35(4)), C394–C410

Higham, N J, 2008, Functions of Matrices: Theory and Computation, SIAM, Philadelphia, PA, USA