vector_EIGEN.h
Go to the documentation of this file.
00001 #include "../config.h"
00002 #ifdef __MATRIXWRAPPER_EIGEN__
00003 
00004 #ifndef __VECTOR_EIGEN__
00005 #define __VECTOR_EIGEN__
00006 
00007 #include "matrix_wrapper.h"
00008 #include "vector_wrapper.h"
00009 
00010 #include <Eigen/Core>
00011 
00012 typedef Eigen::VectorXd EigenColumnVector;
00013 typedef Eigen::RowVectorXd EigenRowVector;
00014 
00015 
00016 namespace MatrixWrapper
00017 {
00018 
00020 class ColumnVector : public EigenColumnVector, public ColumnVector_Wrapper
00021 {
00022 public:
00023 
00025   ColumnVector();
00026 
00028   ColumnVector(int nrows);
00029   ColumnVector(int nrows,double value);
00030 
00032   ColumnVector(const MyColumnVector& a, const MyColumnVector& b);
00033 
00035   virtual ~ColumnVector();
00036 
00038   ColumnVector (const MyColumnVector& a);
00039 
00041   ColumnVector (const EigenColumnVector& a);
00042 
00043   virtual void resize(int num_rows);
00044   virtual unsigned int rows() const;
00045   virtual unsigned int columns() const;
00046   virtual unsigned int capacity() const;
00047   virtual void assign(int size, double value) ;
00048   virtual ColumnVector vectorAdd(const MyColumnVector& v2) const;
00049 
00050   using EigenColumnVector::operator ==;
00051   using EigenColumnVector::operator =;
00052   using EigenColumnVector::operator +=;
00053   using EigenColumnVector::operator -=;
00054   using EigenColumnVector::operator +;
00055   using EigenColumnVector::operator -;
00056 
00057   virtual ColumnVector& operator =(const MyColumnVector& a);
00058   virtual ColumnVector& operator =(double a);
00059 
00060   virtual MyColumnVector & operator+= (const MyColumnVector& a);
00061   virtual MyColumnVector & operator-= (const MyColumnVector& a);
00062   virtual MyColumnVector operator+ (const MyColumnVector &a) const;
00063   virtual MyColumnVector operator- (const MyColumnVector &a) const;
00064 
00065   virtual MyColumnVector& operator+= (double b);
00066   virtual MyColumnVector& operator-= (double b);
00067   virtual MyColumnVector& operator*= (double b);
00068   virtual MyColumnVector& operator/= (double b);
00069   virtual MyColumnVector operator+ (double b) const;
00070   virtual MyColumnVector operator- (double b) const;
00071   virtual MyColumnVector operator* (double b) const;
00072   virtual MyColumnVector operator/ (double b) const;
00073 
00075   virtual double operator[](unsigned int i) const
00076   { 
00077   //std::cout << "(BOOSTVECTOR) operator[] called " << i << std::endl;
00078    // if (i==0)
00079    //     std::cout << "(BOOSTVECTOR) operator[0]" << std::endl;
00080     
00081    return (*this)(i+1);
00082   }
00083 
00085   virtual double& operator[](unsigned int i) 
00086   { 
00087   //std::cout << "(BOOSTVECTOR) operator[] called " << i << std::endl;
00088   //  if (i==0)
00089   //      std::cout << "(BOOSTVECTOR) operator[0]" << std::endl;
00090      return (*this)(i+1);
00091   }
00092 
00093   virtual double operator()(unsigned int) const;
00094   virtual bool operator==(const MyColumnVector& a) const;
00095   virtual double& operator()(unsigned int);
00096   virtual MyMatrix operator* (const MyRowVector &a) const;
00097   virtual MyColumnVector sub(int j_start , int j_end) const;
00098   virtual MyRowVector transpose() const;
00099 
00100 
00101 };
00102 
00104 class RowVector : public EigenRowVector, public RowVector_Wrapper
00105 {
00106   // No private member:  We don't add anything.
00107 
00108   // Public Members
00109  public:
00110   RowVector();
00111   RowVector(int ncols);
00112   RowVector(int ncols,double value);
00113   // If you have another constructor in the matrix library you
00114   // want to use, you'll have to redefine it yourself
00115 
00116   // Copy constructor
00117   RowVector (const MyRowVector& a);
00118   // Copy constructor for Eigen
00119   RowVector (const EigenRowVector& a);
00120 
00121   virtual ~RowVector();
00122 
00123   virtual void resize(int num_cols);
00124   virtual void assign(int size, double value) ;
00125   virtual RowVector vectorAdd(const MyRowVector& v2) const;
00126   virtual unsigned int rows() const;
00127   virtual unsigned int columns() const;
00128   virtual unsigned int capacity() const;
00129   virtual RowVector& operator =(double a);
00130   virtual RowVector& operator =(const MyRowVector& a);
00131 
00132   using EigenRowVector::operator ==;
00133   using EigenRowVector::operator =;
00134   using EigenRowVector::operator +=;
00135   using EigenRowVector::operator -=;
00136   using EigenRowVector::operator +;
00137   using EigenRowVector::operator -;
00138 
00139   virtual MyRowVector & operator+= (const MyRowVector& a);
00140   virtual MyRowVector & operator-= (const MyRowVector& a);
00141   virtual MyRowVector operator+ (const MyRowVector &a) const;
00142   virtual MyRowVector operator- (const MyRowVector &a) const;
00143 
00144   virtual MyRowVector& operator+= (double b);
00145   virtual MyRowVector& operator-= (double b);
00146   virtual MyRowVector& operator*= (double b);
00147   virtual MyRowVector& operator/= (double b);
00148   virtual MyRowVector operator+ (double b) const;
00149   virtual MyRowVector operator- (double b) const;
00150   virtual MyRowVector operator* (double b) const;
00151   virtual MyRowVector operator/ (double b) const;
00152 
00153   virtual double operator()(unsigned int) const;
00154   virtual bool operator==(const MyRowVector& a) const;
00155   virtual double& operator()(unsigned int);
00156   virtual MyRowVector sub(int j_start , int j_end) const;
00157   virtual MyColumnVector transpose() const;
00158   virtual double operator*(const MyColumnVector& a) const;
00159 
00160 };
00161 
00162 }
00163 
00164 #endif
00165 
00166 #endif


bfl_eigen
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. Eigen matrix library support added by Johannes Meyer.
autogenerated on Mon Oct 6 2014 00:20:35