Skip to content

Commit

Permalink
Extended regression test for SymEigen<3>
Browse files Browse the repository at this point in the history
Found a bug! (not fixed yet)
  • Loading branch information
Edward Rosten committed Nov 27, 2012
1 parent 2b5d6ce commit 4d0a8e2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
12 changes: 11 additions & 1 deletion regressions/sym_eigen.cc
@@ -1,3 +1,9 @@
#undef TOON_CHECK_BOUNDS
#define TOON_CHECK_BOUNDS
#undef TOON_INITIALIZE_SNAN
#define TOON_INITIALIZE_NAN


#include <TooN/SymEigen.h>
#include "regressions/regression.h"
#include <iomanip>
Expand All @@ -10,7 +16,7 @@ template<int Size, int Size2>
void test_(const Matrix<Size>& m)
{
Matrix<Size2> M = m;
SymEigen<> e(M);
SymEigen<Size2> e(M);
cout << setprecision(15);
cout << e.get_evectors() << endl;
cout << e.get_evalues() << endl;
Expand Down Expand Up @@ -50,6 +56,7 @@ void test_things_(int S2, int & sorted, double & n)
n = max(n, norm_inf(m * sm.get_evectors()[0] - sm.get_evalues()[0] * sm.get_evectors()[0]));
}


void test_things()
{
int s=0;
Expand Down Expand Up @@ -89,6 +96,9 @@ int main()

test_things();

test<3>(Data(0, 0, 0,
0, 1, 1,
0, 1, 2));

//Size 2 (special case)
test<2>(Data(
Expand Down
14 changes: 14 additions & 0 deletions regressions/sym_eigen.txt
Expand Up @@ -2,6 +2,20 @@
Sorted 0
Errors 0

#Eigen decomposition of [0 0 0; 0 1 1; 0 1 2]

1 0 0
0 -0.85065080835204 0.525731112119133
0 0.525731112119133 0.85065080835204

0 0.381966011250105 2.61803398874989


1 0 0
0 -0.85065080835204 0.525731112119133
0 0.525731112119133 0.85065080835204

0 0.381966011250105 2.61803398874989

#Some simple matrices with easy decompositions
0 1
Expand Down

0 comments on commit 4d0a8e2

Please sign in to comment.