SawMatrix.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Nestor Aguirre                                  *
00003  *   nfaguirrec@unal.edu.co                                                *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef GPPMATRIX_H
00021 #define GPPMATRIX_H
00022 
00023 /***********************************
00024 * AnSII C++
00025 */
00026 #include <math.h>
00027 
00028 //**********************************
00029 
00030 /***********************************
00031 * gsl Library
00032 */
00033 #include <gsl/gsl_matrix.h>
00034 #include <gsl/gsl_math.h>
00035 #include <gsl/gsl_blas.h>
00036 #include <gsl/gsl_eigen.h>
00037 #include <gsl/gsl_linalg.h>
00038 
00039 //**********************************
00040 
00041 /***********************************
00042 * Project
00043 */
00044 #include <SawObject.h>
00045 
00046 class SawVector ;
00047 class SawVectorList ;
00048 
00049 //**********************************
00050 
00061 class SawMatrix : public SawObject
00062 {
00063         public:
00068                 SawMatrix( uint rows , uint cols , double a = 0.0 );
00069                 SawMatrix( double* array, uint rows, uint cols );
00070                 SawMatrix( const SawMatrix& m );
00071                 void operator = ( const SawMatrix& m );
00072                 ~SawMatrix();
00074                 
00075                 void swapRows( uint i, uint j ) ;
00076                 void swapColumns( uint i, uint j ) ;
00077                 
00078                 gsl_matrix* getGSLMatrix() const ;
00079                 void setGSLMatrix( gsl_matrix* matrix ) ;
00080                 uint getRows() const ;
00081                 uint getColumns() const ;
00082                 double get( uint i, uint j ) const;
00083                 void set( uint i, uint j, double value );
00084                 
00085                 void setIdentity() ;
00086                 void setNull() ;
00087                 
00088                 bool operator == ( SawMatrix m );
00089                 bool operator != ( SawMatrix m );
00090                 
00091                 double getMax( uint* i=NULL, uint *j=NULL ) const ;
00092                 double getMin( uint* i=NULL, uint *j=NULL ) const ;
00093                 
00094                 double getDeterminant() ;
00095                 SawMatrix getInverse() ;
00096                 SawVector getEigenValues( SawVectorList* eigenVectors = NULL ) ;
00097                 
00098                 bool isNull() const ;
00099                 
00100                 SawMatrix getTransPose() ;
00101                 
00106                 friend SawMatrix operator + ( SawMatrix a, SawMatrix b ) ;
00107                 friend SawMatrix operator - ( SawMatrix a, SawMatrix b ) ;
00108                 friend SawMatrix operator * ( SawMatrix a, SawMatrix b ) ;
00109                 
00110                 friend SawMatrix operator * ( SawMatrix m, double a ) ;
00111                 friend SawMatrix operator * ( double a, SawMatrix m ) ;
00113                 
00118                 friend ostream& operator << ( ostream& os, const SawMatrix& m ) ;
00119                 friend istream& operator >> ( istream& is, const SawMatrix& m ) ;
00121                 
00126                 static SawMatrix genericFunction( SawMatrix a, double(* func)(double) ) ;
00127                 static SawMatrix genericFunction( SawMatrix a, double(* func)(double, double), double param = 0.0 ) ;
00128                 static SawMatrix sin( SawMatrix a ) ;
00129                 static SawMatrix cos( SawMatrix a ) ;
00130                 static SawMatrix tan( SawMatrix a ) ;
00131                 static SawMatrix asin( SawMatrix a ) ;
00132                 static SawMatrix acos( SawMatrix a ) ;
00133                 static SawMatrix atan( SawMatrix a ) ;
00134                 static SawMatrix sinh( SawMatrix a ) ;
00135                 static SawMatrix cosh( SawMatrix a ) ;
00136                 static SawMatrix exp( SawMatrix a ) ;
00137                 static SawMatrix ln( SawMatrix a ) ;
00138                 static SawMatrix log( SawMatrix a ) ;
00139                 static SawMatrix sqrt( SawMatrix a ) ;
00140                 static SawMatrix pow( SawMatrix a, double e ) ;
00142                 
00143         private:
00144                 static SawMatrix genericFunc( SawMatrix a, double(* func)(double) ) ;
00145                 
00146         private:
00147                 gsl_matrix* matrix ;
00148                 uint rows ;
00149                 uint cols ;
00150 };
00151 
00152 #endif

Generado el Sun Jul 22 18:05:41 2007 para SAW por  doxygen 1.5.1