matrix_wrapper.h
Go to the documentation of this file.
00001 // $Id: matrix_wrapper.h 31308 2009-12-17 09:25:56Z tdelaet $
00002 // Copyright (C) 2002 Klaas Gadeyne <first dot last at gmail dot com>
00003 
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU Lesser General Public License as published by
00007 // the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 //
00019 #ifndef __MATRIX_WRAPPER__
00020 #define __MATRIX_WRAPPER__
00021 
00022 
00023 
00024 // define
00025 #define use_namespace
00026 #define MyMatrix          MatrixWrapper::Matrix
00027 #define MyColumnVector    MatrixWrapper::ColumnVector
00028 #define MyRowVector       MatrixWrapper::RowVector
00029 #define MySymmetricMatrix MatrixWrapper::SymmetricMatrix
00030 
00031 namespace MatrixWrapper{
00032 
00033 class Matrix;
00034 class ColumnVector;
00035 class RowVector;
00036 class SymmetricMatrix;
00037 
00039 class Matrix_Wrapper
00040 {
00041 public:
00042 
00044   Matrix_Wrapper() {};
00045 
00047   virtual ~Matrix_Wrapper() {};
00048 
00050   virtual unsigned int rows() const = 0;
00051 
00053   virtual unsigned int columns() const = 0;
00054 
00056   virtual double& operator()(unsigned int,unsigned int) = 0;
00057 
00059   virtual double operator()(unsigned int,unsigned int) const = 0;
00060 
00062   virtual bool operator==(const MyMatrix& a) const = 0;
00063 
00064 
00066   virtual MyMatrix& operator =(double a) = 0;
00067 
00068 
00069 
00071   virtual MyMatrix& operator +=(double a) = 0;
00072 
00074   virtual MyMatrix& operator -=(double a) = 0;
00075 
00077   virtual MyMatrix& operator *=(double b) = 0;
00078 
00080   virtual MyMatrix& operator /=(double b) = 0;
00081 
00083   virtual MyMatrix operator+ (double b) const = 0;
00084 
00086   virtual MyMatrix operator- (double b) const = 0;
00087 
00089   virtual MyMatrix operator* (double b) const = 0;
00090 
00092   virtual MyMatrix operator/ (double b) const = 0;
00093 
00095   virtual MyMatrix& operator =(const MySymmetricMatrix& a) = 0;
00096 
00098   virtual MyMatrix& operator +=(const MyMatrix& a) = 0;
00099 
00101   virtual MyMatrix& operator -=(const MyMatrix& a) = 0;
00102 
00104   virtual MyMatrix operator+ (const MyMatrix &a) const = 0;
00105 
00107   virtual MyMatrix operator- (const MyMatrix &a) const = 0;
00108 
00110   virtual MyMatrix operator* (const MyMatrix &a) const = 0;
00111 
00112 
00113 
00115   virtual MyColumnVector operator* ( const MyColumnVector &b) const = 0;
00116 
00117 
00119   virtual MyRowVector rowCopy(unsigned int r) const = 0;
00120 
00122   virtual MyColumnVector columnCopy(unsigned int c) const = 0;
00123 
00124 
00126   virtual void resize(unsigned int i, unsigned int j,
00127                       bool copy=true, bool initialize=true) = 0;
00128 
00130   virtual MyMatrix pseudoinverse(double epsilon = 0.01 ) const;
00131 
00133   virtual MyMatrix inverse() const = 0;
00134 
00136   virtual MyMatrix transpose() const = 0;
00137 
00139   virtual double determinant() const = 0;
00140 
00142 
00145   virtual int convertToSymmetricMatrix(MySymmetricMatrix& sym) = 0;
00146 
00148   virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const = 0;
00149 
00151   virtual bool SVD(MyColumnVector& D, MyMatrix& U, MyMatrix& V) const ;
00152 
00153   double PYTHAG(double a,double b) const;
00154 
00155   double SIGN(double a,double b) const;
00156 
00157 }; // class Matrix_Wrapper
00158 
00159 
00161 class SymmetricMatrix_Wrapper
00162 {
00163 public:
00165   SymmetricMatrix_Wrapper() {};
00166 
00168   virtual ~SymmetricMatrix_Wrapper() {};
00169 
00171   virtual unsigned int rows() const = 0;
00172 
00174   virtual unsigned int columns() const = 0;
00175 
00177   virtual double& operator()(unsigned int,unsigned int) = 0;
00178 
00180   virtual double operator()(unsigned int,unsigned int) const = 0;
00181 
00183   virtual bool operator==(const MySymmetricMatrix& a) const = 0;
00184 
00186   virtual MySymmetricMatrix& operator =(double a) = 0;
00187 
00188 
00189 
00191   virtual MySymmetricMatrix& operator +=(double a) = 0;
00192 
00194   virtual MySymmetricMatrix& operator -=(double a) = 0;
00195 
00197   virtual MySymmetricMatrix& operator *=(double b) = 0;
00198 
00200   virtual MySymmetricMatrix& operator /=(double b) = 0;
00201 
00203   virtual MySymmetricMatrix operator+ (double b) const = 0;
00204 
00206   virtual MySymmetricMatrix operator- (double b) const = 0;
00207 
00209   virtual MySymmetricMatrix operator* (double b) const = 0;
00210 
00212   virtual MySymmetricMatrix operator/ (double b) const = 0;
00213 
00214 
00216   virtual MyMatrix& operator +=(const MyMatrix& a) = 0;
00217 
00219   virtual MyMatrix& operator -=(const MyMatrix& a) = 0;
00220 
00222   virtual MyMatrix operator+ (const MyMatrix &a) const = 0;
00223 
00225   virtual MyMatrix operator- (const MyMatrix &a) const = 0;
00226 
00228   virtual MyMatrix operator* (const MyMatrix &a) const = 0;
00229 
00231   virtual MySymmetricMatrix& operator +=(const MySymmetricMatrix& a) = 0;
00232 
00234   virtual MySymmetricMatrix& operator -=(const MySymmetricMatrix& a) = 0;
00235 
00237   virtual MySymmetricMatrix operator+ (const MySymmetricMatrix &a) const = 0;
00238 
00240   virtual MySymmetricMatrix operator- (const MySymmetricMatrix &a) const= 0;
00241 
00243   virtual MyMatrix operator* (const MySymmetricMatrix &a) const = 0;
00244 
00245 
00246 
00248   virtual ColumnVector operator* ( const MyColumnVector &b) const = 0;
00249 
00251   virtual void multiply( const MyColumnVector &b, MyColumnVector &result) const = 0;
00252 
00254   virtual void resize(unsigned int i, bool copy=true, bool initialize=true) = 0;
00255 
00257   virtual MySymmetricMatrix inverse() const = 0;
00258 
00260   virtual MySymmetricMatrix transpose() const = 0;
00261 
00263   virtual double determinant() const = 0;
00264 
00266   virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const = 0;
00267 
00269   virtual bool cholesky_semidefinite(MyMatrix& m) const ;
00270 
00271 }; //class SymmetricMatrix_Wrapper
00272 
00273 
00274 } // namespace
00275 
00276 
00277 
00278 // include
00279 #include "matrix_NEWMAT.h"
00280 #include "matrix_LTI.h"
00281 #include "matrix_BOOST.h"
00282 
00283 
00284 #endif // __MATRIX_WRAPPER__


bfl
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. ROS package maintained by Wim Meeussen.
autogenerated on Fri Aug 28 2015 10:10:21