lib_ex_pour_HZpp/Partie_2/algebre_lineaire/MV++/mv/include/mvvtp.h

1 line
14 KiB
C
Raw Normal View History

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* */ /* */ /* MV++ Numerical Matrix/Vector C++ Library */ /* MV++ Version 1.5 */ /* */ /* R. Pozo */ /* National Institute of Standards and Technology */ /* */ /* NOTICE */ /* */ /* Permission to use, copy, modify, and distribute this software and */ /* its documentation for any purpose and without fee is hereby granted */ /* provided that this permission notice appear in all copies and */ /* supporting documentation. */ /* */ /* Neither the Institution (National Institute of Standards and Technology) */ /* nor the author makes any representations about the suitability of this */ /* software for any purpose. This software is provided ``as is''without */ /* expressed or implied warranty. */ /* */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ // // mvvtp.h Basic templated vector class // // modif g<>rard Rio : // - introduction de la surcharge d'<27>criture dans la classe MVvecteur #ifndef _MV_VECTOR_TPL_H_ #define _MV_VECTOR_TPL_H_ #include <iostream.h> // for formatted printing of vecteur : GR #include <stdlib.h> #ifdef MV_VECTOR_BOUNDS_CHECK # include <assert.h> #endif #include "mvvind.h" #include "mvvrf.h" template <class TYPE> class MV_Vector { protected: TYPE *p_; unsigned int dim_; int ref_; // 0 or 1; does this own its own memory space? public: /*::::::::::::::::::::::::::*/ /* Constructors/Destructors */ /*::::::::::::::::::::::::::*/ MV_Vector(); MV_Vector(unsigned int); MV_Vector(unsigned int, const TYPE&); MV_Vector(TYPE*, unsigned int); MV_Vector(const TYPE*, unsigned int); // reference of an exisiting data structure // MV_Vector(TYPE*, unsigned int, MV_Vector_::ref_type i); MV_Vector(const MV_Vector<TYPE>&); ~MV_Vector(); /*::::::::::::::::::::::::::::::::*/ /* Indices and access operations */ /*::::::::::::::::::::::::::::::::*/ inline TYPE& operator()(unsigned int i) { # ifdef MV_VECTOR_BOUNDS_CHECK assert(i < dim_); # endif return p_[i]; } inline const TYPE& operator()(unsigned int i) const { # ifdef MV_VECTOR_BOUNDS_CHECK assert(i < dim_); #