matrix_NEWMAT.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_NEWMAT__
22 
23 #ifndef __MATRIX_NEWMAT__
24 #define __MATRIX_NEWMAT__
25 
26 #include "matrix_wrapper.h"
27 #include "vector_wrapper.h"
28 #include <newmat/newmatio.h>
29 #include <newmat/newmatap.h>
30 
31 #define NewMatMatrix NEWMAT::Matrix
32 #define NewMatSymmetricMatrix NEWMAT::SymmetricMatrix
33 
34 namespace MatrixWrapper
35 {
36 
38 class Matrix : public NewMatMatrix, public Matrix_Wrapper
39 {
40  private: // No private members: We don't add anything.
41 
42  public: // Public Members
43 
44  // Constructors
45  Matrix();
46  Matrix(int m, int n);
47 
48  // Destructor
49  virtual ~Matrix();
50 
51  // Copy constructor
52  Matrix (const MyMatrix& a);
53  Matrix(const NewMatMatrix & a);
54 
55  virtual unsigned int rows() const;
56  virtual unsigned int columns() const;
57  virtual double& operator()(unsigned int,unsigned int);
58  virtual const double operator()(unsigned int,unsigned int) const;
59  virtual const bool operator==(const MyMatrix& a) const;
60 
61  virtual MyMatrix& operator =(double a);
62 
63  virtual MyMatrix& operator +=(double a);
64  virtual MyMatrix& operator -=(double a);
65  virtual MyMatrix& operator *=(double b);
66  virtual MyMatrix& operator /=(double b);
67  virtual MyMatrix operator+ (double b) const;
68  virtual MyMatrix operator- (double b) const;
69  virtual MyMatrix operator* (double b) const;
70  virtual MyMatrix operator/ (double b) const;
71 
72  virtual MyMatrix& operator =(const MySymmetricMatrix& a);
73  virtual MyMatrix& operator +=(const MyMatrix& a);
74  virtual MyMatrix& operator -=(const MyMatrix& a);
75  virtual MyMatrix operator+ (const MyMatrix &a) const;
76  virtual MyMatrix operator- (const MyMatrix &a) const;
77  virtual MyMatrix operator* (const MyMatrix &a) const;
78 
79  virtual MyColumnVector operator* ( const MyColumnVector &b) const;
80 
81  virtual MyRowVector rowCopy(unsigned int r) const;
82  virtual MyColumnVector columnCopy(unsigned int c) const;
83 
84  virtual void resize(unsigned int i, unsigned int j,
85  bool copy=true, bool initialize=true);
86  virtual MyMatrix inverse() const;
87  virtual MyMatrix transpose() const;
88  virtual double determinant() const;
89  virtual int convertToSymmetricMatrix(MySymmetricMatrix& sym);
90  virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const;
91 
92 };
93 
94 class SymmetricMatrix : public NewMatSymmetricMatrix, public SymmetricMatrix_Wrapper
95 {
96  private: //
97 
98  public: //
99  // Constructors
100  SymmetricMatrix();
101  SymmetricMatrix(int n);
102 
103  // Copy constructors
104  SymmetricMatrix(const MySymmetricMatrix& a);
105  SymmetricMatrix(const NewMatSymmetricMatrix & a);
106 
107  // Destructor
108  virtual ~SymmetricMatrix();
109 
110  virtual unsigned int rows() const;
111  virtual unsigned int columns() const;
112  virtual MySymmetricMatrix inverse() const;
113  virtual MySymmetricMatrix transpose() const;
114  virtual double determinant() const;
115 
116  virtual double& operator()(unsigned int,unsigned int);
117  virtual const double operator()(unsigned int,unsigned int) const;
118  virtual const bool operator==(const MySymmetricMatrix& a) const;
119 
120  virtual MySymmetricMatrix& operator=(double a);
121 
122  virtual MySymmetricMatrix& operator +=(double a);
123  virtual MySymmetricMatrix& operator -=(double a);
124  virtual MySymmetricMatrix& operator *=(double b);
125  virtual MySymmetricMatrix& operator /=(double b);
126  virtual MySymmetricMatrix operator + (double b) const;
127  virtual MySymmetricMatrix operator - (double b) const;
128  virtual MySymmetricMatrix operator * (double b) const;
129  virtual MySymmetricMatrix operator / (double b) const;
130 
131  virtual MyMatrix& operator +=(const MyMatrix& a);
132  virtual MyMatrix& operator -=(const MyMatrix& a);
133  virtual MyMatrix operator + (const MyMatrix &a) const;
134  virtual MyMatrix operator - (const MyMatrix &a) const;
135  virtual MyMatrix operator * (const MyMatrix &a) const;
136 
137  virtual MySymmetricMatrix& operator +=(const MySymmetricMatrix& a);
138  virtual MySymmetricMatrix& operator -=(const MySymmetricMatrix& a);
139  virtual MySymmetricMatrix operator + (const MySymmetricMatrix &a) const;
140  virtual MySymmetricMatrix operator - (const MySymmetricMatrix &a) const;
141  virtual MyMatrix operator * (const MySymmetricMatrix& a) const;
142 
143  virtual MyColumnVector operator* (const MyColumnVector &b) const;
144  virtual void multiply (const MyColumnVector &b, MyColumnVector &result) const;
145 
146  virtual void resize(unsigned int i, bool copy=true, bool initialize=true);
147  virtual MyMatrix sub(int i_start, int i_end, int j_start , int j_end) const;
148 
149 };
150 
151 }
152 
153 #endif
154 
155 #endif
#define MyMatrix
#define MyRowVector
#define MySymmetricMatrix
#define MyColumnVector


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