My Project
drovector-double.hpp
1 //=============================================================================
3 inline drovector& drovector::operator*=(const double& d)
4 {
5 #ifdef CPPL_VERBOSE
6  std::cerr << "# [MARK] drovector::operator*=(const double&)"
7  << std::endl;
8 #endif//CPPL_VERBOSE
9 
10  dscal_(L, d, Array, 1);
11  return *this;
12 }
13 
14 //=============================================================================
16 inline drovector& drovector::operator/=(const double& d)
17 {
18 #ifdef CPPL_VERBOSE
19  std::cerr << "# [MARK] drovector::operator/=(const double&)"
20  << std::endl;
21 #endif//CPPL_VERBOSE
22 
23  dscal_(L, 1./d, Array, 1);
24  return *this;
25 }
26 
30 
31 //=============================================================================
33 inline _drovector operator*(const drovector& vec, const double& d)
34 {
35 #ifdef CPPL_VERBOSE
36  std::cerr << "# [MARK] operator*(const drovector&, const double&)"
37  << std::endl;
38 #endif//CPPL_VERBOSE
39 
40  drovector newvec(vec.L);
41  for(long i=0; i<vec.L; i++){ newvec.array[i] =vec.Array[i]*d; }
42 
43  return _(newvec);
44 }
45 
46 //=============================================================================
48 inline _drovector operator/(const drovector& vec, const double& d)
49 {
50 #ifdef CPPL_VERBOSE
51  std::cerr << "# [MARK] operator/(const drovector&, const double&)"
52  << std::endl;
53 #endif//CPPL_VERBOSE
54 
55  double inv_d(1./d);
56 
57  drovector newvec(vec.L);
58  for(long i=0; i<vec.L; i++){ newvec.array[i] =vec.Array[i]*inv_d; }
59 
60  return _(newvec);
61 }
double *const & array
1D array to store vector data (readable)
Definition: drovector.hpp:13
drovector & operator/=(const double &)
Definition: drovector-double.hpp:16
double * Array
1D Array to store vector data
Definition: _drovector.hpp:8
Real Double-precision Row Vector Class.
Definition: drovector.hpp:3
(DO NOT USE) Smart-temporary Real Double-precision Row Vector Class
Definition: _drovector.hpp:3
drovector & operator*=(const double &)
Definition: drovector-double.hpp:3
friend _drovector operator/(const drovector &, const double &)
Definition: drovector-double.hpp:48
friend _drovector operator*(const drovector &, const dgematrix &)
Definition: drovector-dgematrix.hpp:3
long L
vector size
Definition: _drovector.hpp:7