matrix_NEWMAT.h
Go to the documentation of this file.
00001 // $Id$
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 
00020 #include "../config.h"
00021 #ifdef __MATRIXWRAPPER_NEWMAT__
00022 
00023 #ifndef __MATRIX_NEWMAT__
00024 #define __MATRIX_NEWMAT__
00025 
00026 #include "matrix_wrapper.h"
00027 #include "vector_wrapper.h"
00028 #include <newmat/newmatio.h>
00029 #include <newmat/newmatap.h>
00030 
00031 #define NewMatMatrix          NEWMAT::Matrix
00032 #define NewMatSymmetricMatrix NEWMAT::SymmetricMatrix
00033 
00034 namespace MatrixWrapper
00035 {
00036 
00038 class Matrix : public NewMatMatrix, public Matrix_Wrapper
00039 {
00040  private: // No private members:  We don't add anything.
00041 
00042  public: // Public Members
00043 
00044   // Constructors
00045   Matrix();
00046   Matrix(int m, int n);
00047 
00048   // Destructor
00049   virtual ~Matrix();
00050 
00051   // Copy constructor
00052   Matrix (const MyMatrix& a);
00053   Matrix(const NewMatMatrix & a);
00054 
00055   virtual unsigned int rows() const;
00056   virtual unsigned int columns() const;
00057   virtual double& operator()(unsigned int,unsigned int);
00058   virtual const double operator()(unsigned int,unsigned int) const;
00059   virtual const bool operator==(const MyMatrix& a) const;
00060 
00061   virtual MyMatrix& operator =(double a);
00062 
00063   virtual MyMatrix& operator +=(double a);
00064   virtual MyMatrix& operator -=(double a);
00065   virtual MyMatrix& operator *=(double b);
00066   virtual MyMatrix& operator /=(double b);
00067   virtual MyMatrix operator+ (double b) const;
00068   virtual MyMatrix operator- (double b) const;
00069   virtual MyMatrix operator* (double b) const;
00070   virtual MyMatrix operator/ (double b) const;
00071 
00072   virtual MyMatrix& operator =(const MySymmetricMatrix& a);
00073   virtual MyMatrix& operator +=(const MyMatrix& a);
00074   virtual MyMatrix& operator -=(const MyMatrix& a);
00075   virtual MyMatrix operator+ (const MyMatrix &a) const;
00076   virtual MyMatrix operator- (const MyMatrix &a) const;
00077   virtual MyMatrix operator* (const MyMatrix &a) const;
00078 
00079   virtual MyColumnVector operator* ( const MyColumnVector &b) const;
00080 
00081   virtual MyRowVector rowCopy(unsigned int r) const;
00082   virtual MyColumnVector columnCopy(unsigned int c) const;
00083 
00084   virtual void resize(unsigned int i, unsigned int j,
00085                       bool copy=true, bool initialize=true);
00086   virtual MyMatrix inverse() const;
00087   virtual MyMatrix transpose() const;
00088   virtual double determinant() const;
00089   virtual int convertToSymmetricMatrix(MySymmetricMatrix& sym);
00090   virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const;
00091 
00092 };
00093 
00094 class SymmetricMatrix : public NewMatSymmetricMatrix, public SymmetricMatrix_Wrapper
00095 {
00096  private: //
00097 
00098  public: //
00099   // Constructors
00100   SymmetricMatrix();
00101   SymmetricMatrix(int n);
00102 
00103   // Copy constructors
00104   SymmetricMatrix(const MySymmetricMatrix& a);
00105   SymmetricMatrix(const NewMatSymmetricMatrix & a);
00106 
00107   // Destructor
00108   virtual ~SymmetricMatrix();
00109 
00110   virtual unsigned int rows() const;
00111   virtual unsigned int columns() const;
00112   virtual MySymmetricMatrix inverse() const;
00113   virtual MySymmetricMatrix transpose() const;
00114   virtual double determinant() const;
00115 
00116   virtual double& operator()(unsigned int,unsigned int);
00117   virtual const double operator()(unsigned int,unsigned int) const;
00118   virtual const bool operator==(const MySymmetricMatrix& a) const;
00119 
00120   virtual MySymmetricMatrix& operator=(double a);
00121 
00122   virtual MySymmetricMatrix& operator +=(double a);
00123   virtual MySymmetricMatrix& operator -=(double a);
00124   virtual MySymmetricMatrix& operator *=(double b);
00125   virtual MySymmetricMatrix& operator /=(double b);
00126   virtual MySymmetricMatrix  operator + (double b) const;
00127   virtual MySymmetricMatrix  operator - (double b) const;
00128   virtual MySymmetricMatrix  operator * (double b) const;
00129   virtual MySymmetricMatrix  operator / (double b) const;
00130 
00131   virtual MyMatrix& operator +=(const MyMatrix& a);
00132   virtual MyMatrix& operator -=(const MyMatrix& a);
00133   virtual MyMatrix operator  + (const MyMatrix &a) const;
00134   virtual MyMatrix operator  - (const MyMatrix &a) const;
00135   virtual MyMatrix operator  * (const MyMatrix &a) const;
00136 
00137   virtual MySymmetricMatrix& operator +=(const MySymmetricMatrix& a);
00138   virtual MySymmetricMatrix& operator -=(const MySymmetricMatrix& a);
00139   virtual MySymmetricMatrix  operator + (const MySymmetricMatrix &a) const;
00140   virtual MySymmetricMatrix  operator - (const MySymmetricMatrix &a) const;
00141   virtual MyMatrix  operator * (const MySymmetricMatrix& a) const;
00142 
00143   virtual MyColumnVector operator* (const MyColumnVector &b) const;
00144   virtual void multiply (const MyColumnVector &b, MyColumnVector &result) const;
00145 
00146   virtual void resize(unsigned int i, bool copy=true, bool initialize=true);
00147   virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const;
00148 
00149 };
00150 
00151 }
00152 
00153 #endif
00154 
00155 #endif


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 Mon Feb 11 2019 03:45:12