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

vectorI.h

Go to the documentation of this file.
00001 #ifndef VECTORI_H
00002 #define VECTORI_H
00003 /*------------------------------------------------------------------------------
00004  * vectorI.h    A simple, easy to use and efficient Matrix library.
00005  *              Definition and partial implementation of class VectorI.
00006  *              
00007  *              Copyright 1997,1998,1999,2000 Roland Krause
00008  * -----------------------------------------------------------------------------
00009  * RCS/CVS history of changes
00010  *  
00011  * $Log: vectorI.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:54:39  rokrau
00017  * minor updates
00018  *
00019  * Revision 1.2  2000/10/27 17:08:09  rokrau
00020  * some fixes for integer matrices
00021  *
00022  * Revision 1.1  2000/10/24 06:03:04  rokrau
00023  * Split header files, made Ref constructor private w/ some drastic consequences for
00024  * Ref operators. A lot of minor changes.
00025  *
00026  * -----------------------------------------------------------------------------
00027  * $Date: 2000/11/09 18:41:32 $
00028  * $Revision: 1.3 $
00029  * $Author: rokrau $
00030  * $State: Exp $
00031  * -----------------------------------------------------------------------------
00032  */
00033 // standard includes
00034 // project includes
00035 #include    "matrix.h"
00042 #define REF_CV(A,I)     (((A).D)->m[(I)])
00043 #define THIS_CV(I)      (((*this).D)->m[(I)])
00044 //  namespaces
00045 //using namespace std;
00046 #ifdef USE_NAMESPACE_LINAL
00047 namespace LinAl {
00048 #endif
00049 
00055 class VectorI:public MatrixC<int>
00056 {
00057 public:
00059     explicit VectorI() : MatrixC<int>() {}
00061     explicit VectorI(const int nr, const int value=0) : MatrixC<int>(nr,1,value) {}
00063     explicit VectorI(const int* A, const int nr) : MatrixC<int>(A,nr,1) {}
00065     VectorI(const VectorI& B) : MatrixC<int>(B) {} ;
00067     ~VectorI() {} ;
00069     VectorI& operator= (const int value)
00070         {this->MatrixC<int>::operator=(value); return *this;}
00072     void resize(const int nr, const int value=0)
00073     {
00074         if (nr==D->nrow)    return ;
00075         D=D->get_own_copy() ;
00076         D->m.resize(nr,value) ;
00077         D->nrow=nr ;
00078     }
00080     virtual Ref<int> operator() (const int i, const int) {return MatrixC<int>::operator()(i);}
00082     virtual int operator() (const int i, const int) const {return THIS_CV(i);}
00083 protected:
00085     virtual int* ref(const int i) const {return &THIS_CV(i);}
00087     virtual int  read(const int i) const {return THIS_CV(i);}
00089     virtual void write(const int i, const int v) {D=D->get_own_copy();THIS_CV(i)=v;}
00091     virtual void add(const int i, const int v) {D=D->get_own_copy();THIS_CV(i)+=v;}
00093     virtual void sub(const int i, const int v) {D=D->get_own_copy();THIS_CV(i)-=v;}
00095     virtual void mul(const int i, const int v) {D=D->get_own_copy();THIS_CV(i)*=v;}
00097     virtual void div(const int i, const int v) {D=D->get_own_copy();THIS_CV(i)/=v;}
00098 public:
00100     virtual void stream(ostream& s);
00102     int multiply (const VectorI& B) const ;
00103 };
00104 #ifdef USE_NAMESPACE_LINAL
00105 } // namespace LinAl
00106 #endif
00107 #endif // #ifndef VECTORI_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