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  vecB.destroy();
20  return vecA;
21 }
22 
23 //=============================================================================
24 /*! _zrovector-_zrovector operator */
25 inline _zrovector operator-(const _zrovector& vecA, const _zrovector& vecB)
26 {CPPL_VERBOSE_REPORT;
27 #ifdef CPPL_DEBUG
28  if(vecA.l!=vecB.l){
29  ERROR_REPORT;
30  std::cerr << "These two vectors can not make a subtraction." << std::endl
31  << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
32  exit(1);
33  }
34 #endif//CPPL_DEBUG
35 
36  for(CPPL_INT i=0; i<vecA.l; i++){
37  vecA.array[i] -= vecB.array[i];
38  }
39 
40  vecB.destroy();
41  return vecA;
42 }
43 
44 //=============================================================================
45 /*! _zrovector^T*_zrovector operator (inner product) */
46 inline comple operator%(const _zrovector& vecA, const _zrovector& vecB)
47 {CPPL_VERBOSE_REPORT;
48 #ifdef CPPL_DEBUG
49  if(vecA.l!=vecB.l){
50  ERROR_REPORT;
51  std::cerr << "These two vectors can not make a dot product." << std::endl
52  << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl;
53  exit(1);
54  }
55 #endif//CPPL_DEBUG
56 
57  CPPL_INT inc =1;
58  comple val =zdotu_( &vecA.l, vecA.array, &inc, vecB.array, &inc );
59 
60  vecA.destroy();
61  vecB.destroy();
62  return val;
63 }
void destroy() const
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT l
vector size
Definition: _zrovector.hpp:9
(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
_zrovector operator+(const _zrovector &vecA, const _zrovector &vecB)
_zrovector operator-(const _zrovector &vecA, const _zrovector &vecB)
comple operator%(const _zrovector &vecA, const _zrovector &vecB)