matrix_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 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation; either version 2.1 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 #ifndef __MATRIX_WRAPPER__
20 #define __MATRIX_WRAPPER__
21 
22 
23 
24 // define
25 #define use_namespace
26 #define MyMatrix MatrixWrapper::Matrix
27 #define MyColumnVector MatrixWrapper::ColumnVector
28 #define MyRowVector MatrixWrapper::RowVector
29 #define MySymmetricMatrix MatrixWrapper::SymmetricMatrix
30 
31 namespace MatrixWrapper{
32 
33 class Matrix;
34 class ColumnVector;
35 class RowVector;
36 class SymmetricMatrix;
37 
40 {
41 public:
42 
45 
47  virtual ~Matrix_Wrapper() {};
48 
50  virtual unsigned int size() const = 0;
51 
53  virtual unsigned int capacity() const = 0;
54 
56  virtual unsigned int rows() const = 0;
57 
59  virtual unsigned int columns() const = 0;
60 
62  virtual double& operator()(unsigned int,unsigned int) = 0;
63 
65  virtual double operator()(unsigned int,unsigned int) const = 0;
66 
68  virtual bool operator==(const MyMatrix& a) const = 0;
69 
70 
72  virtual MyMatrix& operator =(double a) = 0;
73 
74 
75 
77  virtual MyMatrix& operator +=(double a) = 0;
78 
80  virtual MyMatrix& operator -=(double a) = 0;
81 
83  virtual MyMatrix& operator *=(double b) = 0;
84 
86  virtual MyMatrix& operator /=(double b) = 0;
87 
89  virtual MyMatrix operator+ (double b) const = 0;
90 
92  virtual MyMatrix operator- (double b) const = 0;
93 
95  virtual MyMatrix operator* (double b) const = 0;
96 
98  virtual MyMatrix operator/ (double b) const = 0;
99 
101  virtual MyMatrix& operator =(const MySymmetricMatrix& a) = 0;
102 
104  virtual MyMatrix& operator +=(const MyMatrix& a) = 0;
105 
107  virtual MyMatrix& operator -=(const MyMatrix& a) = 0;
108 
110  virtual MyMatrix operator+ (const MyMatrix &a) const = 0;
111 
113  virtual MyMatrix operator- (const MyMatrix &a) const = 0;
114 
116  virtual MyMatrix operator* (const MyMatrix &a) const = 0;
117 
118 
119 
121  virtual MyColumnVector operator* ( const MyColumnVector &b) const = 0;
122 
123 
125  virtual MyRowVector rowCopy(unsigned int r) const = 0;
126 
128  virtual MyColumnVector columnCopy(unsigned int c) const = 0;
129 
131  virtual void resize(unsigned int i, unsigned int j,
132  bool copy=true, bool initialize=true) = 0;
133 
135  virtual MyMatrix pseudoinverse(double epsilon = 0.01 ) const;
136 
138  virtual MyMatrix inverse() const = 0;
139 
141  virtual MyMatrix transpose() const = 0;
142 
144  virtual double determinant() const = 0;
145 
147 
150  virtual int convertToSymmetricMatrix(MySymmetricMatrix& sym) = 0;
151 
153  virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const = 0;
154 
156  virtual bool SVD(MyColumnVector& D, MyMatrix& U, MyMatrix& V) const ;
157 
158  double PYTHAG(double a,double b) const;
159 
160  double SIGN(double a,double b) const;
161 
162 }; // class Matrix_Wrapper
163 
164 
167 {
168 public:
171 
174 
176  virtual unsigned int size() const = 0;
177 
179  virtual unsigned int capacity() const = 0;
180 
181 
183  virtual unsigned int rows() const = 0;
184 
186  virtual unsigned int columns() const = 0;
187 
189  virtual double& operator()(unsigned int,unsigned int) = 0;
190 
192  virtual double operator()(unsigned int,unsigned int) const = 0;
193 
195  virtual bool operator==(const MySymmetricMatrix& a) const = 0;
196 
198  virtual MySymmetricMatrix& operator =(double a) = 0;
199 
200 
201 
203  virtual MySymmetricMatrix& operator +=(double a) = 0;
204 
206  virtual MySymmetricMatrix& operator -=(double a) = 0;
207 
209  virtual MySymmetricMatrix& operator *=(double b) = 0;
210 
212  virtual MySymmetricMatrix& operator /=(double b) = 0;
213 
215  virtual MySymmetricMatrix operator+ (double b) const = 0;
216 
218  virtual MySymmetricMatrix operator- (double b) const = 0;
219 
221  virtual MySymmetricMatrix operator* (double b) const = 0;
222 
224  virtual MySymmetricMatrix operator/ (double b) const = 0;
225 
226 
228  virtual MyMatrix& operator +=(const MyMatrix& a) = 0;
229 
231  virtual MyMatrix& operator -=(const MyMatrix& a) = 0;
232 
234  virtual MyMatrix operator+ (const MyMatrix &a) const = 0;
235 
237  virtual MyMatrix operator- (const MyMatrix &a) const = 0;
238 
240  virtual MyMatrix operator* (const MyMatrix &a) const = 0;
241 
243  virtual MySymmetricMatrix& operator +=(const MySymmetricMatrix& a) = 0;
244 
246  virtual MySymmetricMatrix& operator -=(const MySymmetricMatrix& a) = 0;
247 
249  virtual MySymmetricMatrix operator+ (const MySymmetricMatrix &a) const = 0;
250 
252  virtual MySymmetricMatrix operator- (const MySymmetricMatrix &a) const= 0;
253 
255  virtual MyMatrix operator* (const MySymmetricMatrix &a) const = 0;
256 
257 
258 
260  virtual ColumnVector operator* ( const MyColumnVector &b) const = 0;
261 
263  virtual void multiply( const MyColumnVector &b, MyColumnVector &result) const = 0;
264 
266  virtual void resize(unsigned int i, bool copy=true, bool initialize=true) = 0;
267 
269  virtual MySymmetricMatrix inverse() const = 0;
270 
272  virtual MySymmetricMatrix transpose() const = 0;
273 
275  virtual double determinant() const = 0;
276 
278  virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const = 0;
279 
281  virtual bool cholesky_semidefinite(MyMatrix& m) const ;
282 
283 }; //class SymmetricMatrix_Wrapper
284 
285 
286 } // namespace
287 
288 
289 
290 // include
291 #include "matrix_NEWMAT.h"
292 #include "matrix_LTI.h"
293 #include "matrix_BOOST.h"
294 
295 
296 #endif // __MATRIX_WRAPPER__
double SIGN(double a, double b) const
virtual MyMatrix & operator-=(double a)=0
MATRIX - SCALAR operator.
double epsilon
virtual MyMatrix operator+(double b) const =0
MATRIX - SCALAR operator.
double PYTHAG(double a, double b) const
#define MySymmetricMatrix
virtual MyMatrix operator/(double b) const =0
MATRIX - SCALAR operator.
virtual MyMatrix sub(int i_start, int i_end, int j_start, int j_end) const =0
get sub matrix
#define MyRowVector
virtual bool operator==(const MyMatrix &a) const =0
Operator ==.
virtual MyMatrix inverse() const =0
get inverse
Class SymmetricMatrixWrapper.
#define MyColumnVector
virtual unsigned int capacity() const =0
Ask Number of Rows.
virtual unsigned int rows() const =0
Ask Number of Rows.
virtual unsigned int size() const =0
Ask Number of Rows.
virtual MyColumnVector columnCopy(unsigned int c) const =0
Get column from matrix.
virtual MyMatrix & operator*=(double b)=0
MATRIX - SCALAR operator.
virtual MyMatrix operator-(double b) const =0
MATRIX - SCALAR operator.
virtual MyMatrix & operator/=(double b)=0
MATRIX - SCALAR operator.
virtual ~SymmetricMatrix_Wrapper()
Destructor.
virtual MyMatrix operator*(double b) const =0
MATRIX - SCALAR operator.
virtual MyMatrix transpose() const =0
get transpose
#define MyMatrix
virtual double determinant() const =0
get determinant
Class Matrixwrapper.
virtual bool SVD(MyColumnVector &D, MyMatrix &U, MyMatrix &V) const
SVD Decomposition (for pseudo-inverse properties)
virtual int convertToSymmetricMatrix(MySymmetricMatrix &sym)=0
Turn matrix into Symmetric one.
virtual MyRowVector rowCopy(unsigned int r) const =0
Get row from matrix.
virtual ~Matrix_Wrapper()
Destructor.
virtual MyMatrix pseudoinverse(double epsilon=0.01) const
get pseudoinverse
virtual double & operator()(unsigned int, unsigned int)=0
Operator ()
virtual MyMatrix & operator+=(double a)=0
MATRIX - SCALAR operator.
virtual MyMatrix & operator=(double a)=0
Set all elements of the Matrix equal to a.
virtual void resize(unsigned int i, unsigned int j, bool copy=true, bool initialize=true)=0
resize matrix
virtual unsigned int columns() const =0
Ask Number of Columns.


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