src
wrappers
matrix
matrix_BOOST.h
Go to the documentation of this file.
1
// $Id: matrix_BOOST.h 27912 2007-04-27 14:25:33Z wmeeusse $
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
#include "../config.h"
20
#ifdef __MATRIXWRAPPER_BOOST__
21
22
#ifndef __MATRIX_BOOST__
23
#define __MATRIX_BOOST__
24
#include "../../bfl_constants.h"
25
#include "
matrix_wrapper.h
"
26
#include "
vector_wrapper.h
"
27
#include <boost/numeric/ublas/matrix.hpp>
28
#include <boost/numeric/ublas/lu.hpp>
29
#include <boost/numeric/ublas/symmetric.hpp>
30
#include <boost/numeric/ublas/io.hpp>
31
#include <boost/numeric/ublas/lu.hpp>
32
#include <boost/numeric/ublas/triangular.hpp>
33
#include <boost/numeric/ublas/storage.hpp>
34
#include <boost/numeric/ublas/matrix_proxy.hpp>
35
#include <boost/numeric/ublas/matrix_expression.hpp>
36
#include <assert.h>
37
38
39
typedef
boost::numeric::ublas::matrix<double> BoostMatrix;
40
typedef
boost::numeric::ublas::symmetric_matrix<double, boost::numeric::ublas::lower> BoostSymmetricMatrix;
41
42
namespace
MatrixWrapper
43
{
44
46
class
Matrix :
public
BoostMatrix,
public
Matrix_Wrapper
47
{
48
private
:
// No private members: We don't add anything.
49
50
public
:
// Public Members
51
52
// Constructors
53
Matrix();
54
Matrix(
int
m,
int
n);
55
56
// Destructor
57
virtual
~Matrix();
58
59
// Copy constructor
60
Matrix (
const
MyMatrix
& a);
61
Matrix(
const
BoostMatrix & a);
62
63
Matrix(
int
num_rows,
const
RowVector& v);
64
65
66
virtual
unsigned
int
size()
const
;
67
virtual
unsigned
int
capacity()
const
;
68
virtual
unsigned
int
rows()
const
;
69
virtual
unsigned
int
columns()
const
;
70
virtual
double
& operator()(
unsigned
int
,
unsigned
int
);
71
virtual
double
operator()(
unsigned
int
,
unsigned
int
)
const
;
72
virtual
RowVector operator[](
unsigned
int
)
const
;
73
74
virtual
bool
operator==(
const
MyMatrix
& a)
const
;
75
76
virtual
MyMatrix
& operator =(
double
a);
77
78
virtual
MyMatrix
& operator +=(
double
a);
79
virtual
MyMatrix
& operator -=(
double
a);
80
virtual
MyMatrix
& operator *=(
double
b);
81
virtual
MyMatrix
& operator /=(
double
b);
82
virtual
MyMatrix
operator+ (
double
b)
const
;
83
virtual
MyMatrix
operator- (
double
b)
const
;
84
virtual
MyMatrix
operator* (
double
b)
const
;
85
virtual
MyMatrix
operator/ (
double
b)
const
;
86
87
virtual
MyMatrix
& operator =(
const
MySymmetricMatrix
& a);
88
virtual
MyMatrix
& operator +=(
const
MyMatrix
& a);
89
virtual
MyMatrix
& operator -=(
const
MyMatrix
& a);
90
virtual
MyMatrix
operator+ (
const
MyMatrix
&a)
const
;
91
virtual
MyMatrix
operator- (
const
MyMatrix
&a)
const
;
92
virtual
MyMatrix
operator* (
const
MyMatrix
&a)
const
;
93
94
virtual
MyColumnVector
operator* (
const
MyColumnVector
&b)
const
;
95
96
virtual
MyRowVector
rowCopy(
unsigned
int
r)
const
;
97
virtual
MyColumnVector
columnCopy(
unsigned
int
c)
const
;
98
99
virtual
void
resize(
unsigned
int
i,
unsigned
int
j,
100
bool
copy=
true
,
bool
initialize=
true
);
101
virtual
MyMatrix
inverse()
const
;
102
virtual
MyMatrix
transpose()
const
;
103
virtual
double
determinant()
const
;
104
virtual
int
convertToSymmetricMatrix(
MySymmetricMatrix
& sym);
105
virtual
MyMatrix
sub(
int
i_start,
int
i_end,
int
j_start ,
int
j_end)
const
;
106
107
};
108
109
class
SymmetricMatrix :
public
BoostSymmetricMatrix,
public
SymmetricMatrix_Wrapper
110
{
111
private
:
//
112
113
public
:
//
114
// Constructors
115
SymmetricMatrix();
116
SymmetricMatrix(
int
n);
117
118
// Copy constructors
119
SymmetricMatrix(
const
MySymmetricMatrix
& a);
120
SymmetricMatrix(
const
BoostSymmetricMatrix & a);
121
122
SymmetricMatrix(
int
num_rows,
const
RowVector& v);
123
124
// Destructor
125
virtual
~SymmetricMatrix();
126
127
virtual
unsigned
int
size()
const
;
128
virtual
unsigned
int
capacity()
const
;
129
virtual
unsigned
int
rows()
const
;
130
virtual
unsigned
int
columns()
const
;
131
virtual
MySymmetricMatrix
inverse()
const
;
132
virtual
MySymmetricMatrix
transpose()
const
;
133
virtual
double
determinant()
const
;
134
135
virtual
double
& operator()(
unsigned
int
,
unsigned
int
);
136
virtual
double
operator()(
unsigned
int
,
unsigned
int
)
const
;
137
virtual
RowVector operator[](
unsigned
int
)
const
;
138
virtual
bool
operator==(
const
MySymmetricMatrix
& a)
const
;
139
140
virtual
MySymmetricMatrix
& operator=(
double
a);
141
142
virtual
MySymmetricMatrix
& operator +=(
double
a);
143
virtual
MySymmetricMatrix
& operator -=(
double
a);
144
virtual
MySymmetricMatrix
& operator *=(
double
b);
145
virtual
MySymmetricMatrix
& operator /=(
double
b);
146
virtual
MySymmetricMatrix
operator + (
double
b)
const
;
147
virtual
MySymmetricMatrix
operator - (
double
b)
const
;
148
virtual
MySymmetricMatrix
operator * (
double
b)
const
;
149
virtual
MySymmetricMatrix
operator / (
double
b)
const
;
150
151
virtual
MyRowVector
rowCopy(
unsigned
int
r)
const
;
152
153
virtual
MyMatrix
& operator +=(
const
MyMatrix
& a);
154
virtual
MyMatrix
& operator -=(
const
MyMatrix
& a);
155
virtual
MyMatrix
operator + (
const
MyMatrix
&a)
const
;
156
virtual
MyMatrix
operator - (
const
MyMatrix
&a)
const
;
157
virtual
MyMatrix
operator * (
const
MyMatrix
&a)
const
;
158
159
virtual
MySymmetricMatrix
& operator +=(
const
MySymmetricMatrix
& a);
160
virtual
MySymmetricMatrix
& operator -=(
const
MySymmetricMatrix
& a);
161
virtual
MySymmetricMatrix
operator + (
const
MySymmetricMatrix
&a)
const
;
162
virtual
MySymmetricMatrix
operator - (
const
MySymmetricMatrix
&a)
const
;
163
virtual
MyMatrix
operator * (
const
MySymmetricMatrix
& a)
const
;
164
165
virtual
MyColumnVector
operator* (
const
MyColumnVector
&b)
const
;
166
virtual
void
multiply (
const
MyColumnVector
&b,
MyColumnVector
&result)
const
;
167
168
virtual
void
resize(
unsigned
int
i,
bool
copy=
true
,
bool
initialize=
true
);
169
virtual
MyMatrix
sub(
int
i_start,
int
i_end,
int
j_start ,
int
j_end)
const
;
170
171
};
172
173
}
174
175
#endif
176
177
#endif
MyMatrix
#define MyMatrix
vector_wrapper.h
matrix_wrapper.h
MatrixWrapper
Definition:
matrix_wrapper.cpp:7
MyRowVector
#define MyRowVector
MySymmetricMatrix
#define MySymmetricMatrix
MyColumnVector
#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