mat: test that SymEigen eigenvalues are in ascending order
package mat
import (
+ "sort"
"testing"
"golang.org/x/exp/rand"
@@ -160,6 +161,11 @@ func TestSymEigen(t *testing.T) {
t.Errorf("Eigenvalue does not match")
}
}
+
+ // Check that the eigenvalues are in ascending order.
+ if !sort.Float64sAreSorted(es.values) {
+ t.Errorf("Eigenvalues not ascending")
+ }
}
}
}
