vector_LTI.h
Go to the documentation of this file.
00001 // $Id: vector_LTI.h 29830 2009-01-14 15:10:41Z kgadeyne $
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 ColumnVector vectorAdd(const MyColumnVector& v2) const;
00060   virtual ColumnVector& operator =(const MyColumnVector& a);
00061   virtual ColumnVector& operator =(double a);
00062   virtual const bool operator==(const MyColumnVector& a) const;
00063 
00064   virtual MyColumnVector & operator+= (const MyColumnVector& a);
00065   virtual MyColumnVector & operator-= (const MyColumnVector& a);
00066   virtual MyColumnVector operator+ (const MyColumnVector &a) const;
00067   virtual MyColumnVector operator- (const MyColumnVector &a) const;
00068 
00069   virtual MyColumnVector& operator+= (double b);
00070   virtual MyColumnVector& operator-= (double b);
00071   virtual MyColumnVector& operator*= (double b);
00072   virtual MyColumnVector& operator/= (double b);
00073   virtual MyColumnVector operator+ (double b) const;
00074   virtual MyColumnVector operator- (double b) const;
00075   virtual MyColumnVector operator* (double b) const;
00076   virtual MyColumnVector operator/ (double b) const;
00077 
00078   virtual const double operator()(unsigned int) const;
00079   virtual double& operator()(unsigned int);
00080   virtual MyMatrix operator* (const MyRowVector &a) const;
00081   virtual MyColumnVector sub(int j_start , int j_end) const;
00082   virtual MyRowVector transpose() const;
00083 
00084 };
00085 
00086 
00088 class MyRowVector : public ltiRowVector, public RowVector_Wrapper
00089 {
00090   // No private member:  We don't add anything.
00091 
00092   // Public Members
00093  public:
00094   RowVector();
00095   RowVector(int ncols);
00096   // If you have another constructor in the matrix library you
00097   // want to use, you'll have to redefine it yourself
00098   RowVector(const ltiRowVector &a);
00099   // Copy constructor
00100   RowVector (const MyRowVector& a);
00101 
00102   virtual ~RowVector();
00103 
00104   virtual void resize(int num_cols);
00105   virtual RowVector vectorAdd(const MyRowVector& v2) const;
00106   virtual unsigned int rows() const;
00107   virtual unsigned int columns() const;
00108   virtual RowVector& operator =(double a);
00109   virtual RowVector& operator =(const MyRowVector& a);
00110   virtual const bool operator==(const MyRowVector& a) const;
00111 
00112   virtual MyRowVector & operator+= (const MyRowVector& a);
00113   virtual MyRowVector & operator-= (const MyRowVector& a);
00114   virtual MyRowVector operator+ (const MyRowVector &a) const;
00115   virtual MyRowVector operator- (const MyRowVector &a) const;
00116 
00117   virtual MyRowVector& operator+= (double b);
00118   virtual MyRowVector& operator-= (double b);
00119   virtual MyRowVector& operator*= (double b);
00120   virtual MyRowVector& operator/= (double b);
00121   virtual MyRowVector operator+ (double b) const;
00122   virtual MyRowVector operator- (double b) const;
00123   virtual MyRowVector operator* (double b) const;
00124   virtual MyRowVector operator/ (double b) const;
00125 
00126   virtual const double operator()(unsigned int) const;
00127   virtual double& operator()(unsigned int);
00128   virtual MyRowVector sub(int j_start , int j_end) const;
00129   virtual MyColumnVector transpose() const;
00130   virtual MyRowVector operator* (const MyMatrix& a);
00131   virtual double operator*(const MyColumnVector& a) const;
00132 
00133 };
00134 
00135 
00136 #endif
00137 
00138 #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 Sun Oct 5 2014 22:29:53