-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Closed
Labels
00 - BugPriority: highHigh priority, also add milestones for urgent issuesHigh priority, also add milestones for urgent issuescomponent: numpy.linalg
Description
Reproducing code example:
svd
with hermitian=True
(introduced by @eric-wieser in #12693) has a bug with the order of singular values:
import numpy as np
a = np.array([[0, 1, 0], [1, 0, 1], [0, 1, 0]])
u, s, v = np.linalg.svd(a, hermitian=True)
print(s)
Outputs: [1.41421356e+00 6.07153217e-18 1.41421356e+00]
Per the contract of svd
, the singular values should be sorted in descending order, but they aren't here. That's because we simply reverse the order of eigenvalues than sorting, which only suffices if all eigenvalues happen to be positive.
Numpy/Python version information:
1.17.5 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0]
Metadata
Metadata
Assignees
Labels
00 - BugPriority: highHigh priority, also add milestones for urgent issuesHigh priority, also add milestones for urgent issuescomponent: numpy.linalg