00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _MV_VECTOR_double_H
00030 #define _MV_VECTOR_double_H
00031
00032
00033
00034 #include <stdlib.h>
00035
00036
00037 #include <sstream>
00038
00039
00040 #ifdef MV_VECTOR_BOUNDS_CHECK
00041 # include <assert.h>
00042 #endif
00043
00044 #include "mvvind.h"
00045
00046
00047
00048
00049
00050
00051
00052 #include "mvvrf.h"
00053
00054 class MV_Vector_double
00055 {
00056 protected:
00057 double *p_;
00058 int dim_;
00059 int ref_;
00060 public:
00061
00062
00063
00064
00065
00066
00067 MV_Vector_double();
00068 MV_Vector_double( int);
00069 MV_Vector_double( int, const double&);
00070
00071
00072 MV_Vector_double(double*, int);
00073 MV_Vector_double(const double*, int);
00074 MV_Vector_double(const MV_Vector_double &);
00075
00076
00077
00078
00079
00080
00081
00082
00083 MV_Vector_double(double* d, int N, MV_Vector_::ref_type i) :
00084 p_(d), dim_(N), ref_(i) {}
00085
00086 MV_Vector_double(const MV_Vector_double &V, MV_Vector_::ref_type i) :
00087 p_(V.p_), dim_(V.dim_), ref_(i) {}
00088
00089 ~MV_Vector_double();
00090
00091
00092
00093
00094
00095
00096 double& operator()( int i)
00097 {
00098 # ifdef MV_VECTOR_BOUNDS_CHECK
00099 assert(i < dim_);
00100 # endif
00101 return p_[i];
00102 }
00103 const double& operator()( int i) const
00104 {
00105 # ifdef MV_VECTOR_BOUNDS_CHECK
00106 assert(i < dim_);
00107 # endif
00108 return p_[i];
00109 }
00110
00111 double& operator[]( int i)
00112 {
00113 # ifdef MV_VECTOR_BOUNDS_CHECK
00114 assert(i < dim_);
00115 # endif
00116 return p_[i];
00117 }
00118 const double& operator[]( int i) const
00119 {
00120 # ifdef MV_VECTOR_BOUNDS_CHECK
00121 assert(i < dim_);
00122 # endif
00123 return p_[i];
00124 }
00125
00126
00127 MV_Vector_double operator()(const MV_VecIndex &I) ;
00128 MV_Vector_double operator()(void);
00129 const MV_Vector_double operator()(void) const;
00130 const MV_Vector_double operator()(const MV_VecIndex &I) const;
00131
00132 inline int size() const { return dim_;}
00133 inline int dim() const { return dim_;}
00134 inline int ref() const { return ref_;}
00135 inline int null() const {return dim_== 0;}
00136
00137
00138 MV_Vector_double & newsize( int );
00139
00140
00141
00142
00143
00144 MV_Vector_double & operator=(const MV_Vector_double&);
00145 MV_Vector_double & operator=(const double&);
00146
00147
00148 friend std::ostream& operator<<(std::ostream &s, const MV_Vector_double &A);
00149
00150 };
00151
00152
00153
00154 #endif