00001 #include <TooN/TooN.h> 00002 #include <TooN/helpers.h> 00003 00004 using namespace std; 00005 using namespace TooN; 00006 00007 template<class C> void type(const C&) 00008 { 00009 cout << __PRETTY_FUNCTION__ << endl; 00010 } 00011 00012 #define V(a,N) (a==-1?-1:N) 00013 00014 template<int a, int b> void mmult_test() 00015 { 00016 cout << "\n\n\n----------------------------------------------\n\n"; 00017 cout << "Testing " << (a==-1?"dynamic":"static") << " * " << (b==-1?"dynamic":"static") << ":\n"; 00018 00019 Matrix<V(a,2),V(a,3)> m3(2,3); 00020 m3[0] = makeVector(0, 1, 2); 00021 m3[1] = makeVector(3, 4, 5); 00022 Matrix<V(b,3),V(b,2)> m4(3,2); 00023 m4[0] = makeVector(6, 7); 00024 m4[1] = makeVector(8, 9); 00025 m4[2] = makeVector(10, 11); 00026 00027 Vector<V(a,3)> v(3); 00028 v = makeVector(6,8,10); 00029 00030 cout << m3<<endl; 00031 cout << m4<<endl; 00032 cout << m3*m4; 00033 00034 cout << "\n should be: \n 28 31\n 100 112\n"; 00035 00036 cout << endl << v << endl; 00037 cout << endl << m3*v << endl; 00038 00039 cout << "\n should be: \n 28 100\n" << endl; 00040 00041 } 00042 00043 int main() 00044 { 00045 mmult_test<1,1>(); 00046 mmult_test<1,-1>(); 00047 mmult_test<-1,1>(); 00048 mmult_test<-1,-1>(); 00049 } 00050