matrix_BOOST.h
Go to the documentation of this file.
00001 // $Id: matrix_BOOST.h 27912 2007-04-27 14:25:33Z wmeeusse $
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 #include "../config.h"
00020 #ifdef __MATRIXWRAPPER_BOOST__
00021 
00022 #ifndef __MATRIX_BOOST__
00023 #define __MATRIX_BOOST__
00024 #include "../../bfl_constants.h"
00025 #include "matrix_wrapper.h"
00026 #include "vector_wrapper.h"
00027 #include <boost/numeric/ublas/matrix.hpp>
00028 #include <boost/numeric/ublas/lu.hpp>
00029 #include <boost/numeric/ublas/symmetric.hpp>
00030 #include <boost/numeric/ublas/io.hpp>
00031 #include <boost/numeric/ublas/lu.hpp>
00032 #include <boost/numeric/ublas/triangular.hpp>
00033 #include <boost/numeric/ublas/storage.hpp>
00034 #include <boost/numeric/ublas/matrix_proxy.hpp>
00035 #include <boost/numeric/ublas/matrix_expression.hpp>
00036 #include <assert.h>
00037 
00038 
00039 typedef boost::numeric::ublas::matrix<double> BoostMatrix;
00040 typedef boost::numeric::ublas::symmetric_matrix<double, boost::numeric::ublas::lower> BoostSymmetricMatrix;
00041 
00042 namespace MatrixWrapper
00043 {
00044 
00046 class Matrix : public BoostMatrix, public Matrix_Wrapper
00047 {
00048  private: // No private members:  We don't add anything.
00049 
00050  public: // Public Members
00051 
00052   // Constructors
00053   Matrix();
00054   Matrix(int m, int n);
00055 
00056   // Destructor
00057   virtual ~Matrix();
00058 
00059   // Copy constructor
00060   Matrix (const MyMatrix& a);
00061   Matrix(const BoostMatrix & a);
00062 
00063   Matrix(int num_rows,const RowVector& v);
00064 
00065   
00066   virtual unsigned int size() const;
00067   virtual unsigned int capacity() const;
00068   virtual unsigned int rows() const;
00069   virtual unsigned int columns() const;
00070   virtual double& operator()(unsigned int,unsigned int);
00071   virtual double operator()(unsigned int,unsigned int) const;
00072   virtual RowVector operator[](unsigned int)const;
00073 
00074   virtual bool operator==(const MyMatrix& a) const;
00075 
00076   virtual MyMatrix& operator =(double a);
00077 
00078   virtual MyMatrix& operator +=(double a);
00079   virtual MyMatrix& operator -=(double a);
00080   virtual MyMatrix& operator *=(double b);
00081   virtual MyMatrix& operator /=(double b);
00082   virtual MyMatrix operator+ (double b) const;
00083   virtual MyMatrix operator- (double b) const;
00084   virtual MyMatrix operator* (double b) const;
00085   virtual MyMatrix operator/ (double b) const;
00086 
00087   virtual MyMatrix& operator =(const MySymmetricMatrix& a);
00088   virtual MyMatrix& operator +=(const MyMatrix& a);
00089   virtual MyMatrix& operator -=(const MyMatrix& a);
00090   virtual MyMatrix operator+ (const MyMatrix &a) const;
00091   virtual MyMatrix operator- (const MyMatrix &a) const;
00092   virtual MyMatrix operator* (const MyMatrix &a) const;
00093 
00094   virtual MyColumnVector operator* ( const MyColumnVector &b) const;
00095 
00096   virtual MyRowVector rowCopy(unsigned int r) const;
00097   virtual MyColumnVector columnCopy(unsigned int c) const;
00098 
00099   virtual void resize(unsigned int i, unsigned int j,
00100                       bool copy=true, bool initialize=true);
00101   virtual MyMatrix inverse() const;
00102   virtual MyMatrix transpose() const;
00103   virtual double determinant() const;
00104   virtual int convertToSymmetricMatrix(MySymmetricMatrix& sym);
00105   virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const;
00106 
00107 };
00108 
00109 class SymmetricMatrix : public BoostSymmetricMatrix, public SymmetricMatrix_Wrapper
00110 {
00111  private: //
00112 
00113  public: //
00114   // Constructors
00115   SymmetricMatrix();
00116   SymmetricMatrix(int n);
00117 
00118   // Copy constructors
00119   SymmetricMatrix(const MySymmetricMatrix& a);
00120   SymmetricMatrix(const BoostSymmetricMatrix & a);
00121 
00122   SymmetricMatrix(int num_rows,const RowVector& v);
00123 
00124   // Destructor
00125   virtual ~SymmetricMatrix();
00126 
00127   virtual unsigned int size() const;
00128   virtual unsigned int capacity() const;
00129   virtual unsigned int rows() const;
00130   virtual unsigned int columns() const;
00131   virtual MySymmetricMatrix inverse() const;
00132   virtual MySymmetricMatrix transpose() const;
00133   virtual double determinant() const;
00134 
00135   virtual double& operator()(unsigned int,unsigned int);
00136   virtual double operator()(unsigned int,unsigned int) const;
00137   virtual RowVector operator[](unsigned int)const;
00138   virtual bool operator==(const MySymmetricMatrix& a) const;
00139 
00140   virtual MySymmetricMatrix& operator=(double a);
00141 
00142   virtual MySymmetricMatrix& operator +=(double a);
00143   virtual MySymmetricMatrix& operator -=(double a);
00144   virtual MySymmetricMatrix& operator *=(double b);
00145   virtual MySymmetricMatrix& operator /=(double b);
00146   virtual MySymmetricMatrix  operator + (double b) const;
00147   virtual MySymmetricMatrix  operator - (double b) const;
00148   virtual MySymmetricMatrix  operator * (double b) const;
00149   virtual MySymmetricMatrix  operator / (double b) const;
00150 
00151   virtual MyRowVector rowCopy(unsigned int r) const;
00152 
00153   virtual MyMatrix& operator +=(const MyMatrix& a);
00154   virtual MyMatrix& operator -=(const MyMatrix& a);
00155   virtual MyMatrix operator  + (const MyMatrix &a) const;
00156   virtual MyMatrix operator  - (const MyMatrix &a) const;
00157   virtual MyMatrix operator  * (const MyMatrix &a) const;
00158 
00159   virtual MySymmetricMatrix& operator +=(const MySymmetricMatrix& a);
00160   virtual MySymmetricMatrix& operator -=(const MySymmetricMatrix& a);
00161   virtual MySymmetricMatrix  operator + (const MySymmetricMatrix &a) const;
00162   virtual MySymmetricMatrix  operator - (const MySymmetricMatrix &a) const;
00163   virtual MyMatrix  operator * (const MySymmetricMatrix& a) const;
00164 
00165   virtual MyColumnVector operator* (const MyColumnVector &b) const;
00166   virtual void multiply (const MyColumnVector &b, MyColumnVector &result) const;
00167 
00168   virtual void resize(unsigned int i, bool copy=true, bool initialize=true);
00169   virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const;
00170 
00171 };
00172 
00173 }
00174 
00175 #endif
00176 
00177 #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