File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -251,8 +251,11 @@ def test_eigh(x):
251
251
assert eigenvectors .dtype == x .dtype , "eigh().eigenvectors did not return the correct dtype"
252
252
assert eigenvectors .shape == x .shape , "eigh().eigenvectors did not return the correct shape"
253
253
254
+ # The order of the eigenvectors is not specified, so make sure the same
255
+ # eigenvectors are compared against each other.
254
256
_test_stacks (lambda x : linalg .eigh (x ).eigenvalues , x ,
255
- res = eigenvalues , dims = 1 )
257
+ res = eigenvalues , dims = 1 , assert_equal = lambda a , b :
258
+ assert_equal (xp .sort (a ), xp .sort (b )))
256
259
257
260
# There are equivalent ways of representing eigenvectors, and algorithms
258
261
# may not give the same eigenvectors on a stack vs. a matrix.
You can’t perform that action at this time.
0 commit comments