src
wrappers
matrix
vector_BOOST.h
Go to the documentation of this file.
1
// $Id: vector_BOOST.h 27906 2007-04-27 11:50:53Z 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
20
#include "../config.h"
21
#ifdef __MATRIXWRAPPER_BOOST__
22
23
#ifndef __VECTOR_BOOST__
24
#define __VECTOR_BOOST__
25
26
#include "
matrix_wrapper.h
"
27
#include "
vector_wrapper.h
"
28
#include <boost/numeric/ublas/vector.hpp>
29
#include <boost/numeric/ublas/vector_proxy.hpp>
30
#include <boost/numeric/ublas/io.hpp>
31
32
33
#define BoostColumnVector boost::numeric::ublas::vector<double>
34
#define BoostRowVector boost::numeric::ublas::vector<double>
35
36
37
namespace
MatrixWrapper
38
{
39
41
class
ColumnVector :
public
BoostColumnVector,
public
ColumnVector_Wrapper
42
{
43
public
:
44
46
ColumnVector();
47
49
ColumnVector(
int
nrows);
50
ColumnVector(
int
nrows,
double
value);
51
53
ColumnVector(
const
MyColumnVector
& a,
const
MyColumnVector
& b);
54
56
virtual
~ColumnVector();
57
59
ColumnVector (
const
MyColumnVector
& a);
60
62
ColumnVector (
const
BoostColumnVector& a);
63
64
virtual
void
resize(
int
num_rows);
65
virtual
unsigned
int
rows()
const
;
66
virtual
unsigned
int
columns()
const
;
67
virtual
unsigned
int
capacity()
const
;
68
virtual
void
assign(
int
size,
double
value) ;
69
virtual
ColumnVector vectorAdd(
const
MyColumnVector
& v2)
const
;
70
virtual
ColumnVector& operator =(
const
MyColumnVector
& a);
71
virtual
ColumnVector& operator =(
double
a);
72
73
virtual
MyColumnVector
& operator+= (
const
MyColumnVector
& a);
74
virtual
MyColumnVector
& operator-= (
const
MyColumnVector
& a);
75
virtual
MyColumnVector
operator+ (
const
MyColumnVector
&a)
const
;
76
virtual
MyColumnVector
operator- (
const
MyColumnVector
&a)
const
;
77
78
virtual
MyColumnVector
& operator+= (
double
b);
79
virtual
MyColumnVector
& operator-= (
double
b);
80
virtual
MyColumnVector
& operator*= (
double
b);
81
virtual
MyColumnVector
& operator/= (
double
b);
82
virtual
MyColumnVector
operator+ (
double
b)
const
;
83
virtual
MyColumnVector
operator- (
double
b)
const
;
84
virtual
MyColumnVector
operator* (
double
b)
const
;
85
virtual
MyColumnVector
operator/ (
double
b)
const
;
86
88
virtual
double
operator[](
unsigned
int
i)
const
89
{
90
//std::cout << "(BOOSTVECTOR) operator[] called " << i << std::endl;
91
// if (i==0)
92
// std::cout << "(BOOSTVECTOR) operator[0]" << std::endl;
93
94
return
(*
this
)(i+1);
95
}
96
98
virtual
double
& operator[](
unsigned
int
i)
99
{
100
//std::cout << "(BOOSTVECTOR) operator[] called " << i << std::endl;
101
// if (i==0)
102
// std::cout << "(BOOSTVECTOR) operator[0]" << std::endl;
103
return
(*
this
)(i+1);
104
}
105
106
virtual
double
operator()(
unsigned
int
)
const
;
107
virtual
bool
operator==(
const
MyColumnVector
& a)
const
;
108
virtual
double
& operator()(
unsigned
int
);
109
virtual
MyMatrix
operator* (
const
MyRowVector
&a)
const
;
110
virtual
MyColumnVector
sub(
int
j_start ,
int
j_end)
const
;
111
virtual
MyRowVector
transpose()
const
;
112
113
114
};
115
117
class
RowVector :
public
BoostRowVector,
public
RowVector_Wrapper
118
{
119
// No private member: We don't add anything.
120
121
// Public Members
122
public
:
123
RowVector();
124
RowVector(
int
ncols);
125
RowVector(
int
ncols,
double
value);
126
// If you have another constructor in the matrix library you
127
// want to use, you'll have to redefine it yourself
128
129
// Copy constructor
130
RowVector (
const
MyRowVector
& a);
131
// Copy constructor for boost
132
RowVector (
const
BoostRowVector& a);
133
134
virtual
~RowVector();
135
136
virtual
void
resize(
int
num_cols);
137
virtual
void
assign(
int
size,
double
value) ;
138
virtual
RowVector vectorAdd(
const
MyRowVector
& v2)
const
;
139
virtual
unsigned
int
rows()
const
;
140
virtual
unsigned
int
columns()
const
;
141
virtual
unsigned
int
capacity()
const
;
142
virtual
RowVector& operator =(
double
a);
143
virtual
RowVector& operator =(
const
MyRowVector
& a);
144
145
virtual
MyRowVector
& operator+= (
const
MyRowVector
& a);
146
virtual
MyRowVector
& operator-= (
const
MyRowVector
& a);
147
virtual
MyRowVector
operator+ (
const
MyRowVector
&a)
const
;
148
virtual
MyRowVector
operator- (
const
MyRowVector
&a)
const
;
149
150
virtual
MyRowVector
& operator+= (
double
b);
151
virtual
MyRowVector
& operator-= (
double
b);
152
virtual
MyRowVector
& operator*= (
double
b);
153
virtual
MyRowVector
& operator/= (
double
b);
154
virtual
MyRowVector
operator+ (
double
b)
const
;
155
virtual
MyRowVector
operator- (
double
b)
const
;
156
virtual
MyRowVector
operator* (
double
b)
const
;
157
virtual
MyRowVector
operator/ (
double
b)
const
;
158
159
virtual
double
operator()(
unsigned
int
)
const
;
160
virtual
bool
operator==(
const
MyRowVector
& a)
const
;
161
virtual
double
& operator()(
unsigned
int
);
162
virtual
MyRowVector
sub(
int
j_start ,
int
j_end)
const
;
163
virtual
MyColumnVector
transpose()
const
;
164
virtual
double
operator*(
const
MyColumnVector
& a)
const
;
165
166
};
167
168
}
169
170
#endif
171
172
#endif
MyMatrix
#define MyMatrix
vector_wrapper.h
matrix_wrapper.h
MatrixWrapper
Definition:
matrix_wrapper.cpp:7
MyRowVector
#define MyRowVector
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