vector_wrapper.h
Go to the documentation of this file.
00001 // $Id: vector_wrapper.h 31308 2009-12-17 09:25:56Z tdelaet $
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 unsigned int rows() const = 0;
00055 
00057   virtual unsigned int columns() const = 0;
00058 
00060   virtual MyColumnVector vectorAdd(const MyColumnVector& v2) const = 0;
00061 
00063   virtual double operator()(unsigned int i) const = 0;
00064 
00066   virtual double& operator()(unsigned int i) = 0;
00067 
00069   virtual double operator[](unsigned int i) const
00070     { return (*this)(i+1);}
00071 
00073   virtual double& operator[](unsigned int i) 
00074     { return (*this)(i+1);}
00075 
00077   virtual bool operator==(const MyColumnVector& a) const = 0;
00078 
00080   virtual MyColumnVector& operator =(const MyColumnVector& a) = 0;
00081 
00083   virtual MyColumnVector& operator =(double a) = 0;
00084 
00085 
00086 
00088   virtual MyColumnVector& operator+= (const MyColumnVector& a) = 0;
00089 
00091   virtual MyColumnVector& operator-= (const MyColumnVector& a) = 0;
00092 
00094   virtual MyColumnVector operator+ (const MyColumnVector &a) const = 0;
00095 
00097   virtual MyColumnVector operator- (const MyColumnVector &a) const = 0;
00098 
00099 
00100 
00102   virtual MyColumnVector& operator+= (double b) = 0;
00103 
00105   virtual MyColumnVector& operator-= (double b) = 0;
00106 
00108   virtual MyColumnVector& operator*= (double b) = 0;
00109 
00111   virtual MyColumnVector& operator/= (double b) = 0;
00112 
00114   virtual MyColumnVector operator+ (double b) const = 0;
00115 
00117   virtual MyColumnVector operator- (double b) const = 0;
00118 
00120   virtual MyColumnVector operator* (double b) const = 0;
00121 
00123   virtual MyColumnVector operator/ (double b) const = 0;
00124 
00125 
00126 
00128   virtual MyMatrix operator* (const MyRowVector &a) const = 0;
00129 
00131   virtual MyColumnVector sub(int j_start , int j_end) const = 0;
00132 
00134   virtual MyRowVector transpose() const = 0;
00135 
00136 }; // class
00137 
00138 
00140 class RowVector_Wrapper
00141 {
00142 public:
00143 
00145   RowVector_Wrapper() {};
00146 
00148   virtual ~RowVector_Wrapper() {};
00149 
00151   virtual void resize(int num_cols) = 0;
00152 
00154   virtual unsigned int rows() const = 0;
00155 
00157   virtual unsigned int columns() const = 0;
00158 
00160   virtual MyRowVector vectorAdd(const MyRowVector& v2) const = 0;
00161 
00163   virtual double operator()(unsigned int) const = 0;
00164 
00166   virtual double& operator()(unsigned int) = 0;
00167 
00169   virtual bool operator==(const MyRowVector& a) const = 0;
00170 
00172   virtual MyRowVector& operator =(const MyRowVector& a) = 0;
00173 
00175   virtual MyRowVector& operator =(double a) = 0;
00176 
00177 
00178 
00180   virtual MyRowVector& operator+= (const MyRowVector& a) = 0;
00181 
00183   virtual MyRowVector& operator-= (const MyRowVector& a) = 0;
00184 
00186   virtual MyRowVector operator+ (const MyRowVector &a) const = 0;
00187 
00189   virtual MyRowVector operator- (const MyRowVector &a) const = 0;
00190 
00191 
00193   virtual MyRowVector& operator+= (double b) = 0;
00194 
00196   virtual MyRowVector& operator-= (double b) = 0;
00197 
00199   virtual MyRowVector& operator*= (double b) = 0;
00200 
00202   virtual MyRowVector& operator/= (double b) = 0;
00203 
00205   virtual MyRowVector operator+(double b) const = 0;
00206 
00208   virtual RowVector operator- (double b) const = 0;
00209 
00211   virtual MyRowVector operator* (double b) const = 0;
00212 
00214   virtual RowVector operator/ (double b) const = 0;
00215 
00217   virtual double operator* (const MyColumnVector &a) const = 0;
00218 
00220   virtual MyRowVector sub(int j_start , int j_end) const = 0;
00221 
00223   virtual MyColumnVector transpose() const = 0;
00224 
00225 }; // class
00226 
00227 
00228 
00229 } // namespace
00230 
00231 #include "vector_NEWMAT.h"
00232 #include "vector_LTI.h"
00233 #include "vector_BOOST.h"
00234 
00235 #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 Fri Aug 28 2015 10:10:21