CPPLapack
 All Classes Files Functions Variables Friends Pages
_dcovector-dcovector.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! _dcovector+dcovector operator */
3 inline _dcovector operator+(const _dcovector& vecA, const dcovector& vecB)
4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(vecA.l!=vecB.l){
7  ERROR_REPORT;
8  std::cerr << "These two vectors can not make a sumation." << std::endl
9  << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl;
10  exit(1);
11  }
12 
13 #endif//CPPL_DEBUG
14 
15  for(CPPL_INT i=0; i<vecA.l; i++){ vecA.array[i]+=vecB.array[i]; }
16 
17  return vecA;
18 }
19 
20 //=============================================================================
21 /*! dcovector-dcovector operator */
22 inline _dcovector operator-(const _dcovector& vecA, const dcovector& vecB)
23 {CPPL_VERBOSE_REPORT;
24 #ifdef CPPL_DEBUG
25  if(vecA.l!=vecB.l){
26  ERROR_REPORT;
27  std::cerr << "These two vectors can not make a subtraction." << std::endl
28  << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
29  exit(1);
30  }
31 #endif//CPPL_DEBUG
32 
33  for(CPPL_INT i=0; i<vecA.l; i++){ vecA.array[i]-=vecB.array[i]; }
34 
35  return vecA;
36 }
37 
38 //=============================================================================
39 /*! dcovector^T*dcovector operator (inner product) */
40 inline double operator%(const _dcovector& vecA, const dcovector& vecB)
41 {CPPL_VERBOSE_REPORT;
42 #ifdef CPPL_DEBUG
43  if(vecA.l!=vecB.l){
44  ERROR_REPORT;
45  std::cerr << "These two vectors can not make a dot product." << std::endl
46  << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl;
47  exit(1);
48  }
49 #endif//CPPL_DEBUG
50  CPPL_INT inc =1;
51 
52  double val =ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc );
53 
54  vecA.destroy();
55  return val;
56 }
CPPL_INT l
vector size
Definition: _dcovector.hpp:9
_dcovector operator+(const _dcovector &vecA, const dcovector &vecB)
CPPL_INT l
vector size
Definition: dcovector.hpp:9
_dgematrix i(const _dgbmatrix &mat)
double * array
1D array to store vector data
Definition: dcovector.hpp:11
double operator%(const _dcovector &vecA, const dcovector &vecB)
_dcovector operator-(const _dcovector &vecA, const dcovector &vecB)
void destroy() const
Real Double-precision Column Vector Class.
Definition: dcovector.hpp:3
(DO NOT USE) Smart-temporary Real Double-precision Column Vector Class
Definition: _dcovector.hpp:3
double * array
1D array to store vector data
Definition: _dcovector.hpp:11