00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <fstream>
00023 #include <math.h>
00024 using namespace std;
00025
00026
00027 #include <SawMatrix.h>
00028 #include <SawVector.h>
00029 #include <SawVectorList.h>
00030 #include <SawUtils.h>
00031
00032 double myFunction1( double x ){ return pow( x, 0.5 ) ; }
00033 double myFunction2( double x ){ return sin( x ) ; }
00034
00035 int main(int argc, char *argv[]){
00036
00037 cout << "************************************************" << endl ;
00038 cout << "* *" << endl ;
00039 cout << "* MATRIX FUNCTIONS TEST *" << endl ;
00040 cout << "* Nestor Aguirre 2006 *" << endl ;
00041 cout << "* nfaguirrec@unal.edu.co *" << endl ;
00042 cout << "* *" << endl ;
00043 cout << "************************************************" << endl ;
00044 cout << endl ;
00045
00046
00047
00048
00049 SawMatrix matrix( 7, 7 ) ;
00050 ifstream file("overlapH2O.data") ;
00051 file >> matrix ;
00052 file.close() ;
00053
00054 cout << endl ;
00055 cout << "-----------------------------------------" << endl ;
00056 cout << " Usando funciones predefinidas en Saw " << endl ;
00057 cout << "-----------------------------------------" << endl ;
00058 cout << "A = " << matrix << endl ;
00059 cout << "A^(0.5) = " << SawMatrix::pow( matrix, -0.5 ) << endl ;
00060 cout << "sin(A) = " << SawMatrix::sin( matrix ) << endl ;
00061
00062 cout << "-----------------------------------------" << endl ;
00063 cout << " Usando SawMatrix::genericFunction() " << endl ;
00064 cout << "-----------------------------------------" << endl ;
00065 cout << endl ;
00066 cout << "A^(-0.5) = " << SawMatrix::genericFunction( matrix, *myFunction1 ) << endl ;
00067 cout << "sin(A) = " << SawMatrix::genericFunction( matrix, *myFunction2 ) << endl ;
00068
00069 return EXIT_SUCCESS;
00070 }