Menu

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

Download this file

50 lines (45 with data), 1.4 kB

 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//=============================================================================
//! Samll Real Double-precision Column Vector Class
template<long L> class dcovector_small
{
public:
//////// data ////////
static const long l =L;
double array[L];
//////// constructor ////////
dcovector_small(){;}
//// ////
dcovector_small(const dcovector& v){
for(long k=0; k<L; k++){ array[k]=v(k); }
}
dcovector_small(const _dcovector& v){
for(long k=0; k<L; k++){ array[k]=v(k); }
v.destroy();
}
//// ////
dcovector_small(const double& x){
for(long k=0; k<L; k++){ array[k]=x; }
}
dcovector_small(const double& x, const double& y){
array[0]=x; array[1]=y;
}
dcovector_small(const double& x, const double& y, const double& z){
array[0]=x; array[1]=y; array[2]=z;
}
dcovector_small(const double& x, const double& y, const double& z, const double& r){
array[0]=x; array[1]=y; array[2]=z; array[3]=r;
}
~dcovector_small(){;}
//////// function ////////
double& operator()(const long& k);
double operator()(const long& k) const;
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.