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