vector_LTI.h
Go to the documentation of this file.
00001 // $Id$
00002 // Copyright (C) 2002 Klaas Gadeyne <first dot last at gmail dot com>
00003 
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU Lesser General Public License as published by
00007 // the Free Software Foundation; either version 2.1 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 //
00019 
00020 #include "../config.h"
00021 #ifdef __MATRIXWRAPPER_LTI__
00022 
00023 #ifndef __VECTOR_LTI__
00024 #define __VECTOR_LTI__
00025 
00026 #include "matrix_wrapper.h"
00027 #include "vector_wrapper.h"
00028 #include <iostream>
00029 #include <ltilib/ltiIoHandler.h>
00030 #include <ltilib/ltiVector.h>
00031 
00032 //  To avoid problems and clarify (? :-) things with namespaces, we
00033 //  use some macros
00034 
00035 #define ltiColumnVector lti::vector<double>
00036 #define ltiRowVector lti::vector<double>
00037 
00039 class MyColumnVector : public ltiColumnVector, public ColumnVector_Wrapper
00040 {
00041 public:
00042 
00043   // Constructors & Destructors
00044   ColumnVector();
00045   ColumnVector(int nrows);
00046   ColumnVector(const MyColumnVector& a, const MyColumnVector& b);
00047   ColumnVector(const ltiColumnVector &a);
00048   // For Submatrix assignment eg.  Vector = matrix.sub(2,3,1,1);
00049   ColumnVector(const MyMatrix &a);
00050 
00051   virtual ~ColumnVector();
00052 
00053   // Copy constructors
00054   ColumnVector (const MyColumnVector& a);
00055 
00056   virtual void resize(int num_rows);
00057   virtual unsigned int rows() const;
00058   virtual unsigned int columns() const;
00059   virtual unsigned int capacity() const;
00060   virtual void assign(int size, double value) ;
00061   virtual ColumnVector vectorAdd(const MyColumnVector& v2) const;
00062   virtual ColumnVector& operator =(const MyColumnVector& a);
00063   virtual ColumnVector& operator =(double a);
00064   virtual const bool operator==(const MyColumnVector& a) const;
00065 
00066   virtual MyColumnVector & operator+= (const MyColumnVector& a);
00067   virtual MyColumnVector & operator-= (const MyColumnVector& a);
00068   virtual MyColumnVector operator+ (const MyColumnVector &a) const;
00069   virtual MyColumnVector operator- (const MyColumnVector &a) const;
00070 
00071   virtual MyColumnVector& operator+= (double b);
00072   virtual MyColumnVector& operator-= (double b);
00073   virtual MyColumnVector& operator*= (double b);
00074   virtual MyColumnVector& operator/= (double b);
00075   virtual MyColumnVector operator+ (double b) const;
00076   virtual MyColumnVector operator- (double b) const;
00077   virtual MyColumnVector operator* (double b) const;
00078   virtual MyColumnVector operator/ (double b) const;
00079 
00080   virtual const double operator()(unsigned int) const;
00081   virtual double& operator()(unsigned int);
00082   virtual MyMatrix operator* (const MyRowVector &a) const;
00083   virtual MyColumnVector sub(int j_start , int j_end) const;
00084   virtual MyRowVector transpose() const;
00085 
00086 };
00087 
00088 
00090 class MyRowVector : public ltiRowVector, public RowVector_Wrapper
00091 {
00092   // No private member:  We don't add anything.
00093 
00094   // Public Members
00095  public:
00096   RowVector();
00097   RowVector(int ncols);
00098   // If you have another constructor in the matrix library you
00099   // want to use, you'll have to redefine it yourself
00100   RowVector(const ltiRowVector &a);
00101   // Copy constructor
00102   RowVector (const MyRowVector& a);
00103 
00104   virtual ~RowVector();
00105 
00106   virtual void resize(int num_cols);
00107   virtual void assign(int size, double value) ;
00108   virtual RowVector vectorAdd(const MyRowVector& v2) const;
00109   virtual unsigned int rows() const;
00110   virtual unsigned int columns() const;
00111   virtual unsigned int capacity() const;
00112   virtual RowVector& operator =(double a);
00113   virtual RowVector& operator =(const MyRowVector& a);
00114   virtual const bool operator==(const MyRowVector& a) const;
00115 
00116   virtual MyRowVector & operator+= (const MyRowVector& a);
00117   virtual MyRowVector & operator-= (const MyRowVector& a);
00118   virtual MyRowVector operator+ (const MyRowVector &a) const;
00119   virtual MyRowVector operator- (const MyRowVector &a) const;
00120 
00121   virtual MyRowVector& operator+= (double b);
00122   virtual MyRowVector& operator-= (double b);
00123   virtual MyRowVector& operator*= (double b);
00124   virtual MyRowVector& operator/= (double b);
00125   virtual MyRowVector operator+ (double b) const;
00126   virtual MyRowVector operator- (double b) const;
00127   virtual MyRowVector operator* (double b) const;
00128   virtual MyRowVector operator/ (double b) const;
00129 
00130   virtual const double operator()(unsigned int) const;
00131   virtual double& operator()(unsigned int);
00132   virtual MyRowVector sub(int j_start , int j_end) const;
00133   virtual MyColumnVector transpose() const;
00134   virtual MyRowVector operator* (const MyMatrix& a);
00135   virtual double operator*(const MyColumnVector& a) const;
00136 
00137 };
00138 
00139 
00140 #endif
00141 
00142 #endif


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 11 2019 03:45:12