vector_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 __VECTOR_NEWMAT__
24 #define __VECTOR_NEWMAT__
25 
26 #include "matrix_wrapper.h"
27 #include "vector_wrapper.h"
28 #include <newmat/newmatio.h>
29 #include <assert.h>
30 
31 
32 #define NewMatColumnVector NEWMAT::ColumnVector
33 #define NewMatRowVector NEWMAT::RowVector
34 
35 namespace MatrixWrapper
36 {
37 
39 class ColumnVector : public NewMatColumnVector, public ColumnVector_Wrapper
40 {
41 public:
42 
44  ColumnVector();
45 
47  ColumnVector(int nrows);
48 
50  ColumnVector(const MyColumnVector& a, const MyColumnVector& b);
51 
53  virtual ~ColumnVector();
54 
56  ColumnVector (const MyColumnVector& a);
57 
59  ColumnVector (const NewMatColumnVector& a);
60 
61  virtual void resize(int num_rows);
62  virtual void assign(int size, double value) ;
63  virtual unsigned int rows() const;
64  virtual unsigned int columns() const;
65  virtual unsigned int capacity() const;
66  virtual ColumnVector vectorAdd(const MyColumnVector& v2) const;
67  virtual ColumnVector& operator =(const MyColumnVector& a);
68  virtual ColumnVector& operator =(double a);
69  virtual const bool operator==(const MyColumnVector& a) const;
70 
71  virtual MyColumnVector & operator+= (const MyColumnVector& a);
72  virtual MyColumnVector & operator-= (const MyColumnVector& a);
73  virtual MyColumnVector operator+ (const MyColumnVector &a) const;
74  virtual MyColumnVector operator- (const MyColumnVector &a) const;
75 
76  virtual MyColumnVector& operator+= (double b);
77  virtual MyColumnVector& operator-= (double b);
78  virtual MyColumnVector& operator*= (double b);
79  virtual MyColumnVector& operator/= (double b);
80  virtual MyColumnVector operator+ (double b) const;
81  virtual MyColumnVector operator- (double b) const;
82  virtual MyColumnVector operator* (double b) const;
83  virtual MyColumnVector operator/ (double b) const;
84 
85  virtual const double operator()(unsigned int) const;
86  virtual double& operator()(unsigned int);
87  virtual MyMatrix operator* (const MyRowVector &a) const;
88  virtual MyColumnVector sub(int j_start , int j_end) const;
89  virtual MyRowVector transpose() const;
90 
91 
92 };
93 
95 class RowVector : public NewMatRowVector, public RowVector_Wrapper
96 {
97  // No private member: We don't add anything.
98 
99  // Public Members
100  public:
101  RowVector();
102  RowVector(int ncols);
103  // If you have another constructor in the matrix library you
104  // want to use, you'll have to redefine it yourself
105 
106  // Copy constructor
107  RowVector (const MyRowVector& a);
108  // Copy constructor for newmat
109  RowVector (const NewMatRowVector& a);
110 
111  virtual ~RowVector();
112 
113  virtual void resize(int num_cols);
114  virtual void assign(int size, double value) ;
115  virtual RowVector vectorAdd(const MyRowVector& v2) const;
116  virtual unsigned int rows() const;
117  virtual unsigned int columns() const;
118  virtual unsigned int capacity() const;
119  virtual RowVector& operator =(double a);
120  virtual RowVector& operator =(const MyRowVector& a);
121  virtual const bool operator==(const MyRowVector& a) const;
122 
123  virtual MyRowVector & operator+= (const MyRowVector& a);
124  virtual MyRowVector & operator-= (const MyRowVector& a);
125  virtual MyRowVector operator+ (const MyRowVector &a) const;
126  virtual MyRowVector operator- (const MyRowVector &a) const;
127 
128  virtual MyRowVector& operator+= (double b);
129  virtual MyRowVector& operator-= (double b);
130  virtual MyRowVector& operator*= (double b);
131  virtual MyRowVector& operator/= (double b);
132  virtual MyRowVector operator+ (double b) const;
133  virtual MyRowVector operator- (double b) const;
134  virtual MyRowVector operator* (double b) const;
135  virtual MyRowVector operator/ (double b) const;
136 
137  virtual const double operator()(unsigned int) const;
138  virtual double& operator()(unsigned int);
139  virtual MyRowVector sub(int j_start , int j_end) const;
140  virtual MyColumnVector transpose() const;
141  virtual double operator*(const MyColumnVector& a) const;
142 
143 };
144 
145 }
146 
147 #endif
148 
149 #endif
#define MyMatrix
#define MyRowVector
#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