00001 #include <iostream.h> 00002 #include<gslwrap/matrix_float.h> 00003 00004 main() 00005 { 00006 gsl::matrix_float a( 3, 3 ); 00007 gsl::matrix_float b( 3, 3 ); 00008 srand48(10); 00009 00010 int i, j; 00011 for( i = 0; i < a.size1(); i++ ) 00012 for(j = 0; j < a.size2(); j++ ) 00013 a( i, j ) = drand48(); 00014 for( i = 0; i < b.size1(); i++ ) 00015 for( j = 0; j < b.size2(); j++ ) 00016 b( i, j ) = drand48(); 00017 00018 cout << "a + b:" << endl << a + b << endl; 00019 cout << "a - b:" << endl << a - b << endl; 00020 cout << "a + 1.0:" << endl << a + 1.0 << endl; 00021 cout << "1.0 - a:" << endl << 1.0 - a << endl; 00022 cout << "a * 10.0:" << endl << a * 10.0 << endl; 00023 cout << "10.0 * a:" << endl << 10.0 * a << endl; 00024 cout << "a / 10.0:" << endl << a / 10.0 << endl; 00025 cout << "a * b:" << endl << a * b << endl; 00026 cout << "a.LU_decomp():" << endl << a.LU_decomp() << endl; 00027 cout << "a.LU_invert():" << endl << a.LU_invert() << endl; 00028 cout << "a.LU_invert() * a:" << endl << a.LU_invert() * a << endl; 00029 }