Skip to content

logm fails for singular matrix #3279

@pv

Description

@pv

scipy.linalg.logm fails to compute the logarithm of the following (non-diagonalizable) matrix:

https://dl.dropboxusercontent.com/u/5453551/scipy-logm-fail.mat

EDIT: it's also singular, not only non-diagonalizable

from scipy import io, linalg
d = io.loadmat('scipy-logm-fail.mat')
lnA, errest = linalg.logm(d['A'])

# not diagonalizable:
w, v = linalg.eig(d['A'])
s = linalg.svdvals(v)
print(s.min()/s.max())
# -> 3.0988115615e-17

Matlab can do it, so probably Higham has an algorithm that works here.
Fails for Scipy version 0.13.2 (also 0.12.0 fails, so it's not a regression).

The current version of logm can do simpler non-diag cases, e.g. [[1, 1], [0, 1]], however.

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.linalg

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions