Skip to content

linalg.svd fails with a normal np.ndarray #9620

@ribes96

Description

@ribes96

So I came up with an np.ndarray which fails when I try to factorize it to Singular Value Decomposition. It does not contain NaNs, just float64. It raises LinAlgError: SVD did not converge, but I don't know why.

Reproducing code example:

import numpy as np
from scipy import linalg

path = 'problematic_array.npy'

X = np.load(path)

np.isnan(X).any()
# False

U, s, Vh = linalg.svd(X)

Error message:

LinAlgError                               Traceback (most recent call last)
<ipython-input-16-119344cda5b9> in <module>
      9 # False
     10 
---> 11 U, s, Vh = linalg.svd(X)

~/.local/lib/python3.6/site-packages/scipy/linalg/decomp_svd.py in svd(a, full_matrices, compute_uv, overwrite_a, check_finite, lapack_driver)
    130 
    131     if info > 0:
--> 132         raise LinAlgError("SVD did not converge")
    133     if info < 0:
    134         raise ValueError('illegal value in %d-th argument of internal gesdd'

LinAlgError: SVD did not converge
  ...

Scipy/Numpy/Python version information:

Scipy version: 1.2.0
Numpy version: 1.15.4
Python version: sys.version_info(major=3, minor=6, micro=7, releaselevel='final', serial=0)

I am not sure how to share that ndarray with you. It is inside the following zip in an npy file. The reproducing code example should read it without problems.
problematic_array.zip

If it helps, it comes from a bootstrap of a resampling of MNIST

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

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions