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