Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

vectorD.h

Go to the documentation of this file.
00001 #ifndef VECTORD_H
00002 #define VECTORD_H
00003 /*------------------------------------------------------------------------------
00004  * vectorD.h    A simple, easy to use and efficient Matrix library.
00005  *              Definition and partial implementation of class VectorD.
00006  *              
00007  *              Copyright 1997,1998,1999,2000 Roland Krause
00008  * -----------------------------------------------------------------------------
00009  * RCS/CVS history of changes
00010  *  
00011  * $Log: vectorD.h,v $
00012  * Revision 1.3  2000/11/09 18:41:32  rokrau
00013  * The first commit to the sourceforge repostory. Update of all
00014  * intermediate changes makes this the official repository from now on.
00015  *
00016  * Revision 1.3  2000/11/09 17:53:57  rokrau
00017  * Added a correct resize method and removed a redundant multiplication
00018  * method.
00019  *
00020  * Revision 1.2  2000/10/27 17:08:09  rokrau
00021  * some fixes for integer matrices
00022  *
00023  * Revision 1.1  2000/10/24 06:03:04  rokrau
00024  * Split header files, made Ref constructor private w/ some drastic consequences for
00025  * Ref operators. A lot of minor changes.
00026  *
00027  * -----------------------------------------------------------------------------
00028  * $Date: 2000/11/09 18:41:32 $
00029  * $Revision: 1.3 $
00030  * $Author: rokrau $
00031  * $State: Exp $
00032  * -----------------------------------------------------------------------------
00033  */
00034 // standard includes
00035 // project includes
00036 #include    "matrix.h"
00043 #define REF_CV(A,I)     (((A).D)->m[(I)])
00044 #define THIS_CV(I)      (((*this).D)->m[(I)])
00045 //  namespaces
00046 //using namespace std;
00047 #ifdef USE_NAMESPACE_LINAL
00048 namespace LinAl {
00049 #endif
00050 
00056 class VectorD:public MatrixC<double>
00057 {
00058 public:
00060     explicit VectorD() : MatrixC<double>() {}
00062     explicit VectorD(const int nr, const double value=0.0) : MatrixC<double>(nr,1,value) {}
00064     explicit VectorD(const double* A, const int nr) : MatrixC<double>(A,nr,1) {}
00066     VectorD(const VectorD& B) : MatrixC<double>(B) {} ;
00068     ~VectorD() {} ;
00070     VectorD& operator= (const double value)
00071         {this->MatrixC<double>::operator=(value); return *this;}
00073     void resize(const int nr, const double value=0.0);
00075     virtual Ref<double> operator() (const int i, const int=0) {return MatrixC<double>::operator()(i);}
00077     virtual double operator() (const int i, const int=0) const {return THIS_CV(i);}
00078 protected:
00080     double* ref(const int i) const {return &THIS_CV(i);}
00082     double read(const int i) const {return THIS_CV(i);}
00084     void write(const int i, const double v) {D=D->get_own_copy();THIS_CV(i)=v;}
00086     void add(const int i, const double v) {D=D->get_own_copy();THIS_CV(i)+=v;}
00088     void sub(const int i, const double v) {D=D->get_own_copy();THIS_CV(i)-=v;}
00090     void mul(const int i, const double v) {D=D->get_own_copy();THIS_CV(i)*=v;}
00092     void div(const int i, const double v) {D=D->get_own_copy();THIS_CV(i)/=v;}
00093 public:
00095     virtual void stream(ostream& s);
00099 
00100     VectorD transpose() const ;
00102     void multiply(const MatrixFD& A, const VectorD& x, const char TRANS='N',
00103                     const double ALPHA=1.0, const double BETA=0.0) ;
00105     void multiply(const MatrixSD& A, const VectorD& x,
00106                     const double ALPHA=1.0, const double BETA=0.0) ;
00108     void multiply(const MatrixBD& A, const VectorD& x, const char TRANS='N',
00109                     const double ALPHA=1.0, const double BETA=0.0) ;
00111     double multiply(const VectorD& B) const;
00113     void multiply(const double value);
00115     double norm2() const ;
00116 };
00117 #ifdef USE_NAMESPACE_LINAL
00118 } // namespace LinAl
00119 #endif
00120 #endif // #ifndef VECTORD_H

Generated at Wed Nov 22 08:38:29 2000 for LinAl - a simple and efficient Matrix library - by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000