vector_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 __VECTOR_LTI__
24 #define __VECTOR_LTI__
25 
26 #include "matrix_wrapper.h"
27 #include "vector_wrapper.h"
28 #include <iostream>
29 #include <ltilib/ltiIoHandler.h>
30 #include <ltilib/ltiVector.h>
31 
32 // To avoid problems and clarify (? :-) things with namespaces, we
33 // use some macros
34 
35 #define ltiColumnVector lti::vector<double>
36 #define ltiRowVector lti::vector<double>
37 
39 class MyColumnVector : public ltiColumnVector, public ColumnVector_Wrapper
40 {
41 public:
42 
43  // Constructors & Destructors
44  ColumnVector();
45  ColumnVector(int nrows);
46  ColumnVector(const MyColumnVector& a, const MyColumnVector& b);
47  ColumnVector(const ltiColumnVector &a);
48  // For Submatrix assignment eg. Vector = matrix.sub(2,3,1,1);
49  ColumnVector(const MyMatrix &a);
50 
51  virtual ~ColumnVector();
52 
53  // Copy constructors
54  ColumnVector (const MyColumnVector& a);
55 
56  virtual void resize(int num_rows);
57  virtual unsigned int rows() const;
58  virtual unsigned int columns() const;
59  virtual unsigned int capacity() const;
60  virtual void assign(int size, double value) ;
61  virtual ColumnVector vectorAdd(const MyColumnVector& v2) const;
62  virtual ColumnVector& operator =(const MyColumnVector& a);
63  virtual ColumnVector& operator =(double a);
64  virtual const bool operator==(const MyColumnVector& a) const;
65 
66  virtual MyColumnVector & operator+= (const MyColumnVector& a);
67  virtual MyColumnVector & operator-= (const MyColumnVector& a);
68  virtual MyColumnVector operator+ (const MyColumnVector &a) const;
69  virtual MyColumnVector operator- (const MyColumnVector &a) const;
70 
71  virtual MyColumnVector& operator+= (double b);
72  virtual MyColumnVector& operator-= (double b);
73  virtual MyColumnVector& operator*= (double b);
74  virtual MyColumnVector& operator/= (double b);
75  virtual MyColumnVector operator+ (double b) const;
76  virtual MyColumnVector operator- (double b) const;
77  virtual MyColumnVector operator* (double b) const;
78  virtual MyColumnVector operator/ (double b) const;
79 
80  virtual const double operator()(unsigned int) const;
81  virtual double& operator()(unsigned int);
82  virtual MyMatrix operator* (const MyRowVector &a) const;
83  virtual MyColumnVector sub(int j_start , int j_end) const;
84  virtual MyRowVector transpose() const;
85 
86 };
87 
88 
90 class MyRowVector : public ltiRowVector, public RowVector_Wrapper
91 {
92  // No private member: We don't add anything.
93 
94  // Public Members
95  public:
96  RowVector();
97  RowVector(int ncols);
98  // If you have another constructor in the matrix library you
99  // want to use, you'll have to redefine it yourself
100  RowVector(const ltiRowVector &a);
101  // Copy constructor
102  RowVector (const MyRowVector& a);
103 
104  virtual ~RowVector();
105 
106  virtual void resize(int num_cols);
107  virtual void assign(int size, double value) ;
108  virtual RowVector vectorAdd(const MyRowVector& v2) const;
109  virtual unsigned int rows() const;
110  virtual unsigned int columns() const;
111  virtual unsigned int capacity() const;
112  virtual RowVector& operator =(double a);
113  virtual RowVector& operator =(const MyRowVector& a);
114  virtual const bool operator==(const MyRowVector& a) const;
115 
116  virtual MyRowVector & operator+= (const MyRowVector& a);
117  virtual MyRowVector & operator-= (const MyRowVector& a);
118  virtual MyRowVector operator+ (const MyRowVector &a) const;
119  virtual MyRowVector operator- (const MyRowVector &a) const;
120 
121  virtual MyRowVector& operator+= (double b);
122  virtual MyRowVector& operator-= (double b);
123  virtual MyRowVector& operator*= (double b);
124  virtual MyRowVector& operator/= (double b);
125  virtual MyRowVector operator+ (double b) const;
126  virtual MyRowVector operator- (double b) const;
127  virtual MyRowVector operator* (double b) const;
128  virtual MyRowVector operator/ (double b) const;
129 
130  virtual const double operator()(unsigned int) const;
131  virtual double& operator()(unsigned int);
132  virtual MyRowVector sub(int j_start , int j_end) const;
133  virtual MyColumnVector transpose() const;
134  virtual MyRowVector operator* (const MyMatrix& a);
135  virtual double operator*(const MyColumnVector& a) const;
136 
137 };
138 
139 
140 #endif
141 
142 #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 Jun 10 2019 12:48:00