vector_wrapper.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 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU Lesser General Public License as published by
00006 // the Free Software Foundation; either version 2.1 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU Lesser General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Lesser General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 //
00018 #ifndef __OROVECTOR__
00019 #define __OROVECTOR__
00020 
00021 #define use_namespace
00022 
00023 // We define here the oro_math namespace:  This should be done
00024 // explicitly because of the nesting of the namespaces and the fact
00025 // that the 2 classes can have the same name...
00026 // A vector is nothing more then a matrix with a restriction to the
00027 // number of cols/rows, but it facilitates the readings...
00028 
00029 #define MyColumnVector MatrixWrapper::ColumnVector
00030 #define MyRowVector MatrixWrapper::RowVector
00031 #define MyMatrix MatrixWrapper::Matrix
00032 
00033 namespace MatrixWrapper{
00034 
00035 class Matrix;
00036 class ColumnVector;
00037 class RowVector;
00038 
00040 class ColumnVector_Wrapper
00041 {
00042 public:
00043 
00045   ColumnVector_Wrapper() {};
00046 
00048   virtual ~ColumnVector_Wrapper() {};
00049 
00051   virtual void resize(int num_rows) = 0;
00052 
00054   virtual void assign(int newsize,double value) = 0;
00055 
00057   virtual unsigned int rows() const = 0;
00058 
00060   virtual unsigned int columns() const = 0;
00061 
00063   virtual unsigned int capacity() const = 0;
00064 
00066   virtual MyColumnVector vectorAdd(const MyColumnVector& v2) const = 0;
00067 
00069   virtual double operator()(unsigned int i) const = 0;
00070 
00072   virtual double& operator()(unsigned int i) = 0;
00073 
00075   virtual double operator[](unsigned int i) const
00076     { return (*this)(i+1);}
00077 
00079   virtual double& operator[](unsigned int i) 
00080     { return (*this)(i+1);}
00081 
00083   virtual bool operator==(const MyColumnVector& a) const = 0;
00084 
00086   virtual MyColumnVector& operator =(const MyColumnVector& a) = 0;
00087 
00089   virtual MyColumnVector& operator =(double a) = 0;
00090 
00091 
00092 
00094   virtual MyColumnVector& operator+= (const MyColumnVector& a) = 0;
00095 
00097   virtual MyColumnVector& operator-= (const MyColumnVector& a) = 0;
00098 
00100   virtual MyColumnVector operator+ (const MyColumnVector &a) const = 0;
00101 
00103   virtual MyColumnVector operator- (const MyColumnVector &a) const = 0;
00104 
00105 
00106 
00108   virtual MyColumnVector& operator+= (double b) = 0;
00109 
00111   virtual MyColumnVector& operator-= (double b) = 0;
00112 
00114   virtual MyColumnVector& operator*= (double b) = 0;
00115 
00117   virtual MyColumnVector& operator/= (double b) = 0;
00118 
00120   virtual MyColumnVector operator+ (double b) const = 0;
00121 
00123   virtual MyColumnVector operator- (double b) const = 0;
00124 
00126   virtual MyColumnVector operator* (double b) const = 0;
00127 
00129   virtual MyColumnVector operator/ (double b) const = 0;
00130 
00132   virtual MyMatrix operator* (const MyRowVector &a) const = 0;
00133 
00135   virtual MyColumnVector sub(int j_start , int j_end) const = 0;
00136 
00138   virtual MyRowVector transpose() const = 0;
00139 
00140 }; // class
00141 
00142 
00144 class RowVector_Wrapper
00145 {
00146 public:
00147 
00149   RowVector_Wrapper() {};
00150 
00152   virtual ~RowVector_Wrapper() {};
00153 
00155   virtual void resize(int num_cols) = 0;
00156 
00158   virtual void assign(int newsize,double value) = 0;
00159 
00161   virtual unsigned int rows() const = 0;
00162 
00164   virtual unsigned int columns() const = 0;
00165 
00167   virtual unsigned int capacity() const = 0;
00168 
00170   virtual MyRowVector vectorAdd(const MyRowVector& v2) const = 0;
00171 
00173   virtual double operator()(unsigned int) const = 0;
00174 
00176   virtual double& operator()(unsigned int) = 0;
00177 
00179   virtual bool operator==(const MyRowVector& a) const = 0;
00180 
00182   virtual MyRowVector& operator =(const MyRowVector& a) = 0;
00183 
00185   virtual MyRowVector& operator =(double a) = 0;
00186 
00187 
00188 
00190   virtual MyRowVector& operator+= (const MyRowVector& a) = 0;
00191 
00193   virtual MyRowVector& operator-= (const MyRowVector& a) = 0;
00194 
00196   virtual MyRowVector operator+ (const MyRowVector &a) const = 0;
00197 
00199   virtual MyRowVector operator- (const MyRowVector &a) const = 0;
00200 
00201 
00203   virtual MyRowVector& operator+= (double b) = 0;
00204 
00206   virtual MyRowVector& operator-= (double b) = 0;
00207 
00209   virtual MyRowVector& operator*= (double b) = 0;
00210 
00212   virtual MyRowVector& operator/= (double b) = 0;
00213 
00215   virtual MyRowVector operator+(double b) const = 0;
00216 
00218   virtual RowVector operator- (double b) const = 0;
00219 
00221   virtual MyRowVector operator* (double b) const = 0;
00222 
00224   virtual RowVector operator/ (double b) const = 0;
00225 
00227   virtual double operator* (const MyColumnVector &a) const = 0;
00228 
00230   virtual MyRowVector sub(int j_start , int j_end) const = 0;
00231 
00233   virtual MyColumnVector transpose() const = 0;
00234 
00235 }; // class
00236 
00237 
00238 
00239 } // namespace
00240 
00241 #include "vector_NEWMAT.h"
00242 #include "vector_LTI.h"
00243 #include "vector_BOOST.h"
00244 
00245 #endif // __OROVECTOR__


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