CPPLapack
 All Classes Files Functions Variables Friends Pages
zrovector-_zrovector.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! zrovector=_zrovector operator */
4 {CPPL_VERBOSE_REPORT;
5  shallow_copy(vec);
6  return *this;
7 }
8 
9 ///////////////////////////////////////////////////////////////////////////////
10 ///////////////////////////////////////////////////////////////////////////////
11 ///////////////////////////////////////////////////////////////////////////////
12 
13 //=============================================================================
14 /*! zrovector+=_zrovector operator */
16 {CPPL_VERBOSE_REPORT;
17 #ifdef CPPL_DEBUG
18  if( l!=vec.l ){
19  ERROR_REPORT;
20  std::cerr << "These two vectors can not make a sumation." << std::endl
21  << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl;
22  exit(1);
23  }
24 #endif//CPPL_DEBUG
25 
26  for(CPPL_INT i=0; i<l; i++){
27  array[i] += vec.array[i];
28  }
29 
30  vec.destroy();
31  return *this;
32 }
33 
34 //=============================================================================
35 /*! zrovector operator-= */
37 {CPPL_VERBOSE_REPORT;
38 #ifdef CPPL_DEBUG
39  if( l!=vec.l ){
40  ERROR_REPORT;
41  std::cerr << "These two vectors can not make a subtraction." << std::endl
42  << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl;
43  exit(1);
44  }
45 #endif//CPPL_DEBUG
46 
47  for(CPPL_INT i=0; i<l; i++){
48  array[i] -= vec.array[i];
49  }
50 
51  vec.destroy();
52  return *this;
53 }
54 
55 ///////////////////////////////////////////////////////////////////////////////
56 ///////////////////////////////////////////////////////////////////////////////
57 ///////////////////////////////////////////////////////////////////////////////
58 
59 //=============================================================================
60 /*! zrovector+zrovector operator */
61 inline _zrovector operator+(const zrovector& vecA, const _zrovector& vecB)
62 {CPPL_VERBOSE_REPORT;
63 #ifdef CPPL_DEBUG
64  if(vecA.l!=vecB.l){
65  ERROR_REPORT;
66  std::cerr << "These two vectors can not make a sumation." << std::endl
67  << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl;
68  exit(1);
69  }
70 
71 #endif//CPPL_DEBUG
72 
73  for(CPPL_INT i=0; i<vecA.l; i++){
74  vecB.array[i] += vecA.array[i];
75  }
76 
77  return vecB;
78 }
79 
80 //=============================================================================
81 /*! zrovector-zrovector operator */
82 inline _zrovector operator-(const zrovector& vecA, const _zrovector& vecB)
83 {CPPL_VERBOSE_REPORT;
84 #ifdef CPPL_DEBUG
85  if(vecA.l!=vecB.l){
86  ERROR_REPORT;
87  std::cerr << "These two vectors can not make a subtraction." << std::endl
88  << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
89  exit(1);
90  }
91 #endif//CPPL_DEBUG
92 
93  for(CPPL_INT i=0; i<vecA.l; i++){
94  vecB.array[i] =vecA.array[i]-vecB.array[i];
95  }
96 
97  return vecB;
98 }
99 
100 //=============================================================================
101 /*! zrovector^T*zrovector operator (inner product) */
102 inline comple operator%(const zrovector& vecA, const _zrovector& vecB)
103 {CPPL_VERBOSE_REPORT;
104 #ifdef CPPL_DEBUG
105  if(vecA.l!=vecB.l){
106  ERROR_REPORT;
107  std::cerr << "These two vectors can not make a dot product." << std::endl
108  << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl;
109  exit(1);
110  }
111 #endif//CPPL_DEBUG
112 
113  CPPL_INT inc =1;
114  comple val =zdotu_( &vecA.l, vecA.array, &inc, vecB.array, &inc );
115 
116  vecB.destroy();
117  return val;
118 }
_zrovector operator-(const zrovector &vecA, const _zrovector &vecB)
void shallow_copy(const _zrovector &)
zrovector & operator-=(const zrovector &)
CPPL_INT l
vector size
Definition: zrovector.hpp:9
void destroy() const
_dgematrix i(const _dgbmatrix &mat)
zrovector & operator+=(const zrovector &)
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
zrovector & operator=(const zrovector &)
_zrovector operator+(const zrovector &vecA, const _zrovector &vecB)
comple operator%(const zrovector &vecA, const _zrovector &vecB)
comple * array
1D array to store vector data
Definition: zrovector.hpp:10