vector_wrapper.h
Go to the documentation of this file.
1 // $Id$
2 // Copyright (C) 2002 Klaas Gadeyne <first dot last at gmail dot com>
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published by
6 // the Free Software Foundation; either version 2.1 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 #ifndef __OROVECTOR__
19 #define __OROVECTOR__
20 
21 #define use_namespace
22 
23 // We define here the oro_math namespace: This should be done
24 // explicitly because of the nesting of the namespaces and the fact
25 // that the 2 classes can have the same name...
26 // A vector is nothing more then a matrix with a restriction to the
27 // number of cols/rows, but it facilitates the readings...
28 
29 #define MyColumnVector MatrixWrapper::ColumnVector
30 #define MyRowVector MatrixWrapper::RowVector
31 #define MyMatrix MatrixWrapper::Matrix
32 
33 namespace MatrixWrapper{
34 
35 class Matrix;
36 class ColumnVector;
37 class RowVector;
38 
41 {
42 public:
43 
46 
48  virtual ~ColumnVector_Wrapper() {};
49 
51  virtual void resize(int num_rows) = 0;
52 
54  virtual void assign(int newsize,double value) = 0;
55 
57  virtual unsigned int rows() const = 0;
58 
60  virtual unsigned int columns() const = 0;
61 
63  virtual unsigned int capacity() const = 0;
64 
66  virtual MyColumnVector vectorAdd(const MyColumnVector& v2) const = 0;
67 
69  virtual double operator()(unsigned int i) const = 0;
70 
72  virtual double& operator()(unsigned int i) = 0;
73 
75  virtual double operator[](unsigned int i) const
76  { return (*this)(i+1);}
77 
79  virtual double& operator[](unsigned int i)
80  { return (*this)(i+1);}
81 
83  virtual bool operator==(const MyColumnVector& a) const = 0;
84 
86  virtual MyColumnVector& operator =(const MyColumnVector& a) = 0;
87 
89  virtual MyColumnVector& operator =(double a) = 0;
90 
91 
92 
94  virtual MyColumnVector& operator+= (const MyColumnVector& a) = 0;
95 
97  virtual MyColumnVector& operator-= (const MyColumnVector& a) = 0;
98 
100  virtual MyColumnVector operator+ (const MyColumnVector &a) const = 0;
101 
103  virtual MyColumnVector operator- (const MyColumnVector &a) const = 0;
104 
105 
106 
108  virtual MyColumnVector& operator+= (double b) = 0;
109 
111  virtual MyColumnVector& operator-= (double b) = 0;
112 
114  virtual MyColumnVector& operator*= (double b) = 0;
115 
117  virtual MyColumnVector& operator/= (double b) = 0;
118 
120  virtual MyColumnVector operator+ (double b) const = 0;
121 
123  virtual MyColumnVector operator- (double b) const = 0;
124 
126  virtual MyColumnVector operator* (double b) const = 0;
127 
129  virtual MyColumnVector operator/ (double b) const = 0;
130 
132  virtual MyMatrix operator* (const MyRowVector &a) const = 0;
133 
135  virtual MyColumnVector sub(int j_start , int j_end) const = 0;
136 
138  virtual MyRowVector transpose() const = 0;
139 
140 }; // class
141 
142 
145 {
146 public:
147 
150 
152  virtual ~RowVector_Wrapper() {};
153 
155  virtual void resize(int num_cols) = 0;
156 
158  virtual void assign(int newsize,double value) = 0;
159 
161  virtual unsigned int rows() const = 0;
162 
164  virtual unsigned int columns() const = 0;
165 
167  virtual unsigned int capacity() const = 0;
168 
170  virtual MyRowVector vectorAdd(const MyRowVector& v2) const = 0;
171 
173  virtual double operator()(unsigned int) const = 0;
174 
176  virtual double& operator()(unsigned int) = 0;
177 
179  virtual bool operator==(const MyRowVector& a) const = 0;
180 
182  virtual MyRowVector& operator =(const MyRowVector& a) = 0;
183 
185  virtual MyRowVector& operator =(double a) = 0;
186 
187 
188 
190  virtual MyRowVector& operator+= (const MyRowVector& a) = 0;
191 
193  virtual MyRowVector& operator-= (const MyRowVector& a) = 0;
194 
196  virtual MyRowVector operator+ (const MyRowVector &a) const = 0;
197 
199  virtual MyRowVector operator- (const MyRowVector &a) const = 0;
200 
201 
203  virtual MyRowVector& operator+= (double b) = 0;
204 
206  virtual MyRowVector& operator-= (double b) = 0;
207 
209  virtual MyRowVector& operator*= (double b) = 0;
210 
212  virtual MyRowVector& operator/= (double b) = 0;
213 
215  virtual MyRowVector operator+(double b) const = 0;
216 
218  virtual RowVector operator- (double b) const = 0;
219 
221  virtual MyRowVector operator* (double b) const = 0;
222 
224  virtual RowVector operator/ (double b) const = 0;
225 
227  virtual double operator* (const MyColumnVector &a) const = 0;
228 
230  virtual MyRowVector sub(int j_start , int j_end) const = 0;
231 
233  virtual MyColumnVector transpose() const = 0;
234 
235 }; // class
236 
237 
238 
239 } // namespace
240 
241 #include "vector_NEWMAT.h"
242 #include "vector_LTI.h"
243 #include "vector_BOOST.h"
244 
245 #endif // __OROVECTOR__
virtual unsigned int capacity() const =0
capacity
virtual MyColumnVector vectorAdd(const MyColumnVector &v2) const =0
join two vectors
virtual ~ColumnVector_Wrapper()
Destructor.
virtual void resize(int num_rows)=0
resize
Class RowVectorWrapper.
virtual double operator()(unsigned int i) const =0
element indexing
virtual void assign(int newsize, double value)=0
assign
virtual MyColumnVector operator+(const MyColumnVector &a) const =0
Operators.
virtual MyColumnVector & operator*=(double b)=0
Operators.
#define MyMatrix
Class ColumnVectorWrapper.
virtual unsigned int columns() const =0
Ask numbers of columns (=1)
virtual double & operator[](unsigned int i)
element indexing STARTING FROM 0
virtual bool operator==(const MyColumnVector &a) const =0
Operator ==.
#define MyColumnVector
virtual MyColumnVector sub(int j_start, int j_end) const =0
get sub matrix
virtual MyColumnVector & operator=(const MyColumnVector &a)=0
operator =
virtual MyColumnVector & operator-=(const MyColumnVector &a)=0
Operators.
virtual ~RowVector_Wrapper()
Destructor.
virtual MyColumnVector & operator/=(double b)=0
Operators.
virtual MyColumnVector operator/(double b) const =0
Operators.
virtual double operator[](unsigned int i) const
element indexing STARTING FROM 0
virtual MyRowVector transpose() const =0
get transpose
virtual MyColumnVector operator*(double b) const =0
Operators.
virtual MyColumnVector & operator+=(const MyColumnVector &a)=0
Operators.
virtual unsigned int rows() const =0
Ask number of rows.
virtual MyColumnVector operator-(const MyColumnVector &a) const =0
Operators.
#define MyRowVector


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 28 2022 21:56:33