matrix_wrapper.h
Go to the documentation of this file.
00001 // $Id: matrix_wrapper.h 33361 2010-10-26 13:30:25Z 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 size() const = 0;
00051 
00053   virtual unsigned int capacity() const = 0;
00054 
00056   virtual unsigned int rows() const = 0;
00057 
00059   virtual unsigned int columns() const = 0;
00060 
00062   virtual double& operator()(unsigned int,unsigned int) = 0;
00063 
00065   virtual double operator()(unsigned int,unsigned int) const = 0;
00066 
00068   virtual bool operator==(const MyMatrix& a) const = 0;
00069 
00070 
00072   virtual MyMatrix& operator =(double a) = 0;
00073 
00074 
00075 
00077   virtual MyMatrix& operator +=(double a) = 0;
00078 
00080   virtual MyMatrix& operator -=(double a) = 0;
00081 
00083   virtual MyMatrix& operator *=(double b) = 0;
00084 
00086   virtual MyMatrix& operator /=(double b) = 0;
00087 
00089   virtual MyMatrix operator+ (double b) const = 0;
00090 
00092   virtual MyMatrix operator- (double b) const = 0;
00093 
00095   virtual MyMatrix operator* (double b) const = 0;
00096 
00098   virtual MyMatrix operator/ (double b) const = 0;
00099 
00101   virtual MyMatrix& operator =(const MySymmetricMatrix& a) = 0;
00102 
00104   virtual MyMatrix& operator +=(const MyMatrix& a) = 0;
00105 
00107   virtual MyMatrix& operator -=(const MyMatrix& a) = 0;
00108 
00110   virtual MyMatrix operator+ (const MyMatrix &a) const = 0;
00111 
00113   virtual MyMatrix operator- (const MyMatrix &a) const = 0;
00114 
00116   virtual MyMatrix operator* (const MyMatrix &a) const = 0;
00117 
00118 
00119 
00121   virtual MyColumnVector operator* ( const MyColumnVector &b) const = 0;
00122 
00123 
00125   virtual MyRowVector rowCopy(unsigned int r) const = 0;
00126 
00128   virtual MyColumnVector columnCopy(unsigned int c) const = 0;
00129 
00131   virtual void resize(unsigned int i, unsigned int j,
00132                       bool copy=true, bool initialize=true) = 0;
00133 
00135   virtual MyMatrix pseudoinverse(double epsilon = 0.01 ) const;
00136 
00138   virtual MyMatrix inverse() const = 0;
00139 
00141   virtual MyMatrix transpose() const = 0;
00142 
00144   virtual double determinant() const = 0;
00145 
00147 
00150   virtual int convertToSymmetricMatrix(MySymmetricMatrix& sym) = 0;
00151 
00153   virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const = 0;
00154 
00156   virtual bool SVD(MyColumnVector& D, MyMatrix& U, MyMatrix& V) const ;
00157 
00158   double PYTHAG(double a,double b) const;
00159 
00160   double SIGN(double a,double b) const;
00161 
00162 }; // class Matrix_Wrapper
00163 
00164 
00166 class SymmetricMatrix_Wrapper
00167 {
00168 public:
00170   SymmetricMatrix_Wrapper() {};
00171 
00173   virtual ~SymmetricMatrix_Wrapper() {};
00174 
00176   virtual unsigned int size() const = 0;
00177 
00179   virtual unsigned int capacity() const = 0;
00180 
00181 
00183   virtual unsigned int rows() const = 0;
00184 
00186   virtual unsigned int columns() const = 0;
00187 
00189   virtual double& operator()(unsigned int,unsigned int) = 0;
00190 
00192   virtual double operator()(unsigned int,unsigned int) const = 0;
00193 
00195   virtual bool operator==(const MySymmetricMatrix& a) const = 0;
00196 
00198   virtual MySymmetricMatrix& operator =(double a) = 0;
00199 
00200 
00201 
00203   virtual MySymmetricMatrix& operator +=(double a) = 0;
00204 
00206   virtual MySymmetricMatrix& operator -=(double a) = 0;
00207 
00209   virtual MySymmetricMatrix& operator *=(double b) = 0;
00210 
00212   virtual MySymmetricMatrix& operator /=(double b) = 0;
00213 
00215   virtual MySymmetricMatrix operator+ (double b) const = 0;
00216 
00218   virtual MySymmetricMatrix operator- (double b) const = 0;
00219 
00221   virtual MySymmetricMatrix operator* (double b) const = 0;
00222 
00224   virtual MySymmetricMatrix operator/ (double b) const = 0;
00225 
00226 
00228   virtual MyMatrix& operator +=(const MyMatrix& a) = 0;
00229 
00231   virtual MyMatrix& operator -=(const MyMatrix& a) = 0;
00232 
00234   virtual MyMatrix operator+ (const MyMatrix &a) const = 0;
00235 
00237   virtual MyMatrix operator- (const MyMatrix &a) const = 0;
00238 
00240   virtual MyMatrix operator* (const MyMatrix &a) const = 0;
00241 
00243   virtual MySymmetricMatrix& operator +=(const MySymmetricMatrix& a) = 0;
00244 
00246   virtual MySymmetricMatrix& operator -=(const MySymmetricMatrix& a) = 0;
00247 
00249   virtual MySymmetricMatrix operator+ (const MySymmetricMatrix &a) const = 0;
00250 
00252   virtual MySymmetricMatrix operator- (const MySymmetricMatrix &a) const= 0;
00253 
00255   virtual MyMatrix operator* (const MySymmetricMatrix &a) const = 0;
00256 
00257 
00258 
00260   virtual ColumnVector operator* ( const MyColumnVector &b) const = 0;
00261 
00263   virtual void multiply( const MyColumnVector &b, MyColumnVector &result) const = 0;
00264 
00266   virtual void resize(unsigned int i, bool copy=true, bool initialize=true) = 0;
00267 
00269   virtual MySymmetricMatrix inverse() const = 0;
00270 
00272   virtual MySymmetricMatrix transpose() const = 0;
00273 
00275   virtual double determinant() const = 0;
00276 
00278   virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const = 0;
00279 
00281   virtual bool cholesky_semidefinite(MyMatrix& m) const ;
00282 
00283 }; //class SymmetricMatrix_Wrapper
00284 
00285 
00286 } // namespace
00287 
00288 
00289 
00290 // include
00291 #include "matrix_NEWMAT.h"
00292 #include "matrix_LTI.h"
00293 #include "matrix_BOOST.h"
00294 #include "matrix_EIGEN.h"
00295 
00296 
00297 #endif // __MATRIX_WRAPPER__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends Defines


bfl_eigen
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. Eigen matrix library support added by Johannes Meyer.
autogenerated on Mon Jul 15 2013 16:45:57