matrix_LTI.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 
20 #include "../config.h"
21 #ifdef __MATRIXWRAPPER_LTI__
22 
23 #ifndef __MATRIX_LTI__
24 #define __MATRIX_LTI__
25 
26 #include "matrix_wrapper.h"
27 #include "vector_wrapper.h"
28 #include <ltilib/ltiMatrix.h>
29 #include <assert.h>
30 
31 
32 
33 // To avoid problems and clarify things
34 // with namespaces, we use some macros
35 #define ltiMatrix lti::matrix<double>
36 #define ltiSymmetricMatrix lti::matrix<double>
37 #define ltiColumnVector lti::vector<double>
38 
40 class MyMatrix : public ltiMatrix, public MatrixWrapper::Matrix_Wrapper
41 {
42  private: // No private members: We don't add anything.
43 
44  public: // Public Members
45 
47  Matrix();
48 
50  Matrix(int m, int n);
51 
53  virtual ~Matrix();
54 
56  Matrix (const MyMatrix& a);
57 
59  Matrix(const ltiMatrix & a);
60 
61  virtual unsigned int rows() const;
62  virtual unsigned int columns() const;
63  virtual double& operator()(unsigned int,unsigned int);
64  virtual const double operator()(unsigned int,unsigned int) const;
65  virtual const bool operator==(const MyMatrix& a) const;
66 
67  virtual MyMatrix& operator =(double a);
68 
69  virtual MyMatrix& operator +=(double a);
70  virtual MyMatrix& operator -=(double a);
71  virtual MyMatrix& operator *=(double b);
72  virtual MyMatrix& operator /=(double b);
73  virtual MyMatrix operator+ (double b) const;
74  virtual MyMatrix operator- (double b) const;
75  virtual MyMatrix operator* (double b) const;
76  virtual MyMatrix operator/ (double b) const;
77 
78  virtual MyMatrix& operator =(const MySymmetricMatrix& a);
79  virtual MyMatrix& operator +=(const MyMatrix& a);
80  virtual MyMatrix& operator -=(const MyMatrix& a);
81  virtual MyMatrix operator+ (const MyMatrix &a) const;
82  virtual MyMatrix operator- (const MyMatrix &a) const;
83  virtual MyMatrix operator* (const MyMatrix &a) const;
84 
85  virtual MyColumnVector operator* ( const MyColumnVector &b) const;
86 
87  virtual MyRowVector rowCopy(unsigned int r) const;
88  virtual MyColumnVector columnCopy(unsigned int c) const;
89 
90  virtual void resize(unsigned int i, unsigned int j,
91  bool copy=true, bool initialize=true);
92  virtual MyMatrix inverse() const;
93  virtual MyMatrix transpose() const;
94  virtual double determinant() const;
96  virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const;
97 
98 };
99 
100 
101 
102 class MySymmetricMatrix : public ltiSymmetricMatrix, public SymmetricMatrix_Wrapper
103 {
104  public:
105  // Constructors
106  SymmetricMatrix();
107  SymmetricMatrix(int n);
108 
109  // Copy constructors
110  SymmetricMatrix(const SymmetricMatrix& a);
111  SymmetricMatrix(const ltiSymmetricMatrix & a);
112 
113  // Destructor
114  virtual ~SymmetricMatrix();
115 
116 
117  virtual unsigned int rows() const;
118  virtual unsigned int columns() const;
119  virtual MySymmetricMatrix inverse() const;
120  virtual MySymmetricMatrix transpose() const;
121  virtual double determinant() const;
122 
123  virtual double& operator()(unsigned int,unsigned int);
124  virtual const double operator()(unsigned int,unsigned int) const;
125  virtual const bool operator==(const MySymmetricMatrix& a) const;
126 
127  virtual MySymmetricMatrix& operator=(double a);
128 
129  virtual MySymmetricMatrix& operator +=(double a);
130  virtual MySymmetricMatrix& operator -=(double a);
131  virtual MySymmetricMatrix& operator *=(double b);
132  virtual MySymmetricMatrix& operator /=(double b);
133  virtual MySymmetricMatrix operator + (double b) const;
134  virtual MySymmetricMatrix operator - (double b) const;
135  virtual MySymmetricMatrix operator * (double b) const;
136  virtual MySymmetricMatrix operator / (double b) const;
137 
138  virtual MyMatrix& operator +=(const MyMatrix& a);
139  virtual MyMatrix& operator -=(const MyMatrix& a);
140  virtual MyMatrix operator + (const MyMatrix &a) const;
141  virtual MyMatrix operator - (const MyMatrix &a) const;
142  virtual MyMatrix operator * (const MyMatrix &a) const;
143 
144  virtual MySymmetricMatrix& operator +=(const MySymmetricMatrix& a);
145  virtual MySymmetricMatrix& operator -=(const MySymmetricMatrix& a);
146  virtual MySymmetricMatrix operator + (const MySymmetricMatrix &a) const;
147  virtual MySymmetricMatrix operator - (const MySymmetricMatrix &a) const;
148  virtual MyMatrix operator * (const MySymmetricMatrix& a) const;
149 
150  virtual MyColumnVector operator* (const MyColumnVector &b) const;
151  //virtual void multiply (const MyColumnVector &b, MyColumnVector &result) const;
152  virtual void resize(unsigned int i, bool copy=true, bool initialize=true);
153  virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const;
154 
155 };
156 
157 
158 #endif
159 
160 #endif
#define MyMatrix
virtual MyMatrix & operator-=(double a)=0
MATRIX - SCALAR operator.
virtual MyMatrix operator+(double b) const =0
MATRIX - SCALAR operator.
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
virtual bool operator==(const MyMatrix &a) const =0
Operator ==.
virtual MyMatrix inverse() const =0
get inverse
virtual unsigned int rows() 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 MyMatrix operator*(double b) const =0
MATRIX - SCALAR operator.
virtual MyMatrix transpose() const =0
get transpose
virtual double determinant() const =0
get determinant
Class Matrixwrapper.
#define MyRowVector
virtual int convertToSymmetricMatrix(MySymmetricMatrix &sym)=0
Turn matrix into Symmetric one.
virtual MyRowVector rowCopy(unsigned int r) const =0
Get row from matrix.
#define MySymmetricMatrix
virtual double & operator()(unsigned int, unsigned int)=0
Operator ()
virtual MyMatrix & operator+=(double a)=0
MATRIX - SCALAR operator.
#define MyColumnVector
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