Get around the SVD did not converge error of death.
(A, **kwargs)
| 118 | |
| 119 | |
| 120 | def _safe_svd(A, **kwargs): |
| 121 | """Get around the SVD did not converge error of death.""" |
| 122 | # Intel has a bug with their GESVD driver: |
| 123 | # https://software.intel.com/en-us/forums/intel-distribution-for-python/topic/628049 # noqa: E501 |
| 124 | # For SciPy 0.18 and up, we can work around it by using |
| 125 | # lapack_driver='gesvd' instead. |
| 126 | from scipy import linalg |
| 127 | |
| 128 | if kwargs.get("overwrite_a", False): |
| 129 | raise ValueError("Cannot set overwrite_a=True with this function") |
| 130 | try: |
| 131 | return linalg.svd(A, **kwargs) |
| 132 | except np.linalg.LinAlgError as exp: |
| 133 | from .utils import warn |
| 134 | |
| 135 | warn(f"SVD error ({exp}), attempting to use GESVD instead of GESDD") |
| 136 | return linalg.svd(A, lapack_driver="gesvd", **kwargs) |
| 137 | |
| 138 | |
| 139 | def _csc_array_cast(x): |