matrix_LTI.h
Go to the documentation of this file.
00001 // $Id: matrix_LTI.h 30606 2009-10-02 10:01:02Z 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 
00020 #include "../config.h"
00021 #ifdef __MATRIXWRAPPER_LTI__
00022 
00023 #ifndef __MATRIX_LTI__
00024 #define __MATRIX_LTI__
00025 
00026 #include "matrix_wrapper.h"
00027 #include "vector_wrapper.h"
00028 #include <ltilib/ltiMatrix.h>
00029 #include <assert.h>
00030 
00031 
00032 
00033 //  To avoid problems and clarify things
00034 //  with namespaces, we use some macros
00035 #define ltiMatrix          lti::matrix<double>
00036 #define ltiSymmetricMatrix lti::matrix<double>
00037 #define ltiColumnVector    lti::vector<double>
00038 
00040 class MyMatrix : public ltiMatrix, public MatrixWrapper::Matrix_Wrapper
00041 {
00042  private: // No private members:  We don't add anything.
00043 
00044  public: // Public Members
00045 
00047   Matrix();
00048 
00050   Matrix(int m, int n);
00051 
00053   virtual ~Matrix();
00054 
00056   Matrix (const MyMatrix& a);
00057 
00059   Matrix(const ltiMatrix & a);
00060 
00061   virtual unsigned int rows() const;
00062   virtual unsigned int columns() const;
00063   virtual double& operator()(unsigned int,unsigned int);
00064   virtual const double operator()(unsigned int,unsigned int) const;
00065   virtual const bool operator==(const MyMatrix& a) const;
00066 
00067   virtual MyMatrix& operator =(double a);
00068 
00069   virtual MyMatrix& operator +=(double a);
00070   virtual MyMatrix& operator -=(double a);
00071   virtual MyMatrix& operator *=(double b);
00072   virtual MyMatrix& operator /=(double b);
00073   virtual MyMatrix operator+ (double b) const;
00074   virtual MyMatrix operator- (double b) const;
00075   virtual MyMatrix operator* (double b) const;
00076   virtual MyMatrix operator/ (double b) const;
00077 
00078   virtual MyMatrix& operator =(const MySymmetricMatrix& a);
00079   virtual MyMatrix& operator +=(const MyMatrix& a);
00080   virtual MyMatrix& operator -=(const MyMatrix& a);
00081   virtual MyMatrix operator+ (const MyMatrix &a) const;
00082   virtual MyMatrix operator- (const MyMatrix &a) const;
00083   virtual MyMatrix operator* (const MyMatrix &a) const;
00084 
00085   virtual MyColumnVector operator* ( const MyColumnVector &b) const;
00086 
00087   virtual MyRowVector rowCopy(unsigned int r) const;
00088   virtual MyColumnVector columnCopy(unsigned int c) const;
00089 
00090   virtual void resize(unsigned int i, unsigned int j,
00091           bool copy=true, bool initialize=true);
00092   virtual MyMatrix inverse() const;
00093   virtual MyMatrix transpose() const;
00094   virtual double determinant() const;
00095   virtual int convertToSymmetricMatrix(MySymmetricMatrix& sym);
00096   virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const;
00097 
00098 };
00099 
00100 
00101 
00102 class MySymmetricMatrix : public ltiSymmetricMatrix, public SymmetricMatrix_Wrapper
00103 {
00104     public:
00105         // Constructors
00106         SymmetricMatrix();
00107         SymmetricMatrix(int n);
00108 
00109         // Copy constructors
00110         SymmetricMatrix(const SymmetricMatrix& a);
00111         SymmetricMatrix(const ltiSymmetricMatrix & a);
00112 
00113         // Destructor
00114         virtual ~SymmetricMatrix();
00115 
00116 
00117         virtual unsigned int rows() const;
00118         virtual unsigned int columns() const;
00119         virtual MySymmetricMatrix inverse() const;
00120         virtual MySymmetricMatrix transpose() const;
00121         virtual double determinant() const;
00122 
00123         virtual double& operator()(unsigned int,unsigned int);
00124         virtual const double operator()(unsigned int,unsigned int) const;
00125         virtual const bool operator==(const MySymmetricMatrix& a) const;
00126 
00127         virtual MySymmetricMatrix& operator=(double a);
00128 
00129         virtual MySymmetricMatrix& operator +=(double a);
00130         virtual MySymmetricMatrix& operator -=(double a);
00131         virtual MySymmetricMatrix& operator *=(double b);
00132         virtual MySymmetricMatrix& operator /=(double b);
00133         virtual MySymmetricMatrix  operator + (double b) const;
00134         virtual MySymmetricMatrix  operator - (double b) const;
00135         virtual MySymmetricMatrix  operator * (double b) const;
00136         virtual MySymmetricMatrix  operator / (double b) const;
00137 
00138         virtual MyMatrix& operator +=(const MyMatrix& a);
00139         virtual MyMatrix& operator -=(const MyMatrix& a);
00140         virtual MyMatrix operator  + (const MyMatrix &a) const;
00141         virtual MyMatrix operator  - (const MyMatrix &a) const;
00142         virtual MyMatrix operator  * (const MyMatrix &a) const;
00143 
00144         virtual MySymmetricMatrix& operator +=(const MySymmetricMatrix& a);
00145         virtual MySymmetricMatrix& operator -=(const MySymmetricMatrix& a);
00146         virtual MySymmetricMatrix  operator + (const MySymmetricMatrix &a) const;
00147         virtual MySymmetricMatrix  operator - (const MySymmetricMatrix &a) const;
00148         virtual MyMatrix  operator * (const MySymmetricMatrix& a) const;
00149 
00150         virtual MyColumnVector operator* (const MyColumnVector &b) const;
00151         //virtual void multiply (const MyColumnVector &b, MyColumnVector &result) const;
00152         virtual void resize(unsigned int i, bool copy=true, bool initialize=true);
00153         virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const;
00154 
00155 };
00156 
00157 
00158 #endif
00159 
00160 #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 Sun Oct 5 2014 22:29:53