Menu

[r91]: / trunk / include / small / dcovector_small.hpp  Maximize  Restore  History

Download this file

34 lines (31 with data), 962 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//=============================================================================
//! Samll Real Double-precision Column Vector Class
template<long l> class dcovector_small
{
public:
//////// data ////////
double array[l];
//////// constructor ////////
dcovector_small(){;}
dcovector_small(const double& x){
for(long k=0; k<l; k++){ array[k]=x; }
}
dcovector_small(const double& x, const double& y, const double& z){
array[0]=x; array[1]=y; array[2]=z;
}
~dcovector_small(){;}
//////// function ////////
double& operator()(const long& k);
double operator()(const long& k) const;
//long get_m(){ return n; }
//long get_n(){ return n; }
void zero(){ for(long k=0; k<l; k++){array[k]=0.;} }
dcovector_small<l>& set(const long& k, const double& v){ (*this)(k)=v; return *this; }
_dcovector to_dcovector()const{
dcovector vec(l);
for(long k=0; k<l; k++){
vec(k)=(*this)(k);
}
return _(vec);
}
};
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.