math/Matrixmxn.h

Go to the documentation of this file.
00001 
00002 // This file is identical to the LinAlgLib.h for creating the library
00003 // except for the exclusion private members and variables as well as 
00004 // the matlab include files.  This way, projects including this file 
00005 // and the LinAlgLib.lib will not see the Matlab support behind it.
00006 
00007 #ifndef _MATRIX_H_
00008 #define _MATRIX_H_
00009 
00010 class VectorN;
00011 
00012 class Matrixmxn
00013 {
00014 public:
00015     // m = # of rows, n = # of col.
00016     Matrixmxn(const int m =1, const int n =1);
00017         Matrixmxn(const Matrixmxn& right);
00018     ~Matrixmxn();
00019                                         
00020     virtual bool Inverse(Matrixmxn& inv);
00021         virtual Matrixmxn Inverse();
00022     virtual Matrixmxn Transpose();
00023     virtual double Determinant();
00024     
00025     virtual bool Compare (const Matrixmxn& right);
00026     
00027     virtual Matrixmxn operator + (const Matrixmxn& right) const;
00028     virtual Matrixmxn operator - (const Matrixmxn& right) const;
00029     virtual Matrixmxn operator * (const Matrixmxn& right) const; 
00030     virtual Matrixmxn operator * (const double& right) const;   
00031     virtual VectorN operator *(const VectorN& right) const;
00032         Matrixmxn& operator = (const Matrixmxn& right);
00033         virtual Matrixmxn& operator *= (const Matrixmxn& right);
00034         virtual Matrixmxn& operator *= (const double& right);
00035         virtual Matrixmxn& operator += (const Matrixmxn& right);
00036         virtual Matrixmxn& operator -= (const Matrixmxn& right);
00037     
00038     virtual bool operator == (const Matrixmxn& right);    
00039     virtual double& operator ()(const unsigned int row, const unsigned int col);
00040     
00041     VectorN GetColumnVector(int col) const;
00042     VectorN GetRowVector(int row) const;
00043     
00044     // Read data in entry row m, column n.
00045     virtual double GetValues(const int m, const int n) const; 
00046     // Set data in entry row m, column n     
00047         virtual void SetValues(int m, int n, double **val);
00048     virtual void SetValues(const int m, const int n, const double data); 
00049     virtual void SetValues(const Matrixmxn& right);
00050 
00051     // Resize the matrix to m rows, n columns
00052     bool Resize(const int m, const int n);      
00053 
00054     // returns number of rows in matrix
00055     int GetRows() const {return m_nRows;};    
00056     // returns number of columns in matrix              
00057     int GetColumns() const {return m_nColumns;};               
00058 
00059 protected:
00060     // m_nRows by m_nColumns size matrix
00061     // column major (row subscripts run faster)
00062     double**    values;
00063     
00064     int         m_nRows;  
00065     int         m_nColumns;     
00066         
00067         bool ReallocateMatrix(int m, int n);
00068         bool AllocateMatrix();
00069         void FreeMatrix();
00070 };
00071 
00072 
00073 // Singular Value Decomposition - taken from numerical recipes
00074 // NOTE: SVD() replaces 'a' with the 'u' of the decomposed matrix
00075  bool    SVD(double** a, int m, int n, double *w, double **v);   
00076 
00077 #endif

Generated on Sat Apr 1 21:30:38 2006 for Motion Planning Kernel by  doxygen 1.4.6-NO