CPPLapack
 All Classes Files Functions Variables Friends Pages
zcovector-_zcovector.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! zcovector=_zcovector operator */
4 {CPPL_VERBOSE_REPORT;
5  shallow_copy(vec);
6  return *this;
7 }
8 
9 ///////////////////////////////////////////////////////////////////////////////
10 ///////////////////////////////////////////////////////////////////////////////
11 ///////////////////////////////////////////////////////////////////////////////
12 
13 //=============================================================================
14 /*! zcovector+=_zcovector 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 /*! zcovector 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 /*! zcovector+zcovector operator */
61 inline _zcovector operator+(const zcovector& vecA, const _zcovector& 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 #endif//CPPL_DEBUG
71 
72  for(CPPL_INT i=0; i<vecA.l; i++){
73  vecB.array[i] += vecA.array[i];
74  }
75 
76  return vecB;
77 }
78 
79 //=============================================================================
80 /*! zcovector-zcovector operator */
81 inline _zcovector operator-(const zcovector& vecA, const _zcovector& vecB)
82 {CPPL_VERBOSE_REPORT;
83 #ifdef CPPL_DEBUG
84  if(vecA.l!=vecB.l){
85  ERROR_REPORT;
86  std::cerr << "These two vectors can not make a subtraction." << std::endl
87  << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
88  exit(1);
89  }
90 #endif//CPPL_DEBUG
91 
92  for(CPPL_INT i=0; i<vecA.l; i++){
93  vecB.array[i] =vecA.array[i]-vecB.array[i];
94  }
95 
96  return vecB;
97 }
98 
99 //=============================================================================
100 /*! zcovector^T*zcovector operator (inner product) */
101 inline comple operator%(const zcovector& vecA, const _zcovector& vecB)
102 {CPPL_VERBOSE_REPORT;
103 #ifdef CPPL_DEBUG
104  if(vecA.l!=vecB.l){
105  ERROR_REPORT;
106  std::cerr << "These two vectors can not make a dot product." << std::endl
107  << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl;
108  exit(1);
109  }
110 #endif//CPPL_DEBUG
111 
112  CPPL_INT inc =1;
113  comple val =zdotu_( &vecA.l, vecA.array, &inc, vecB.array, &inc );
114 
115  vecB.destroy();
116  return val;
117 }
comple * array
1D array to store vector data
Definition: zcovector.hpp:10
CPPL_INT l
vector size
Definition: zcovector.hpp:9
zcovector & operator=(const zcovector &)
_dgematrix i(const _dgbmatrix &mat)
comple operator%(const zcovector &vecA, const _zcovector &vecB)
void destroy() const
void shallow_copy(const _zcovector &)
zcovector & operator-=(const zcovector &)
_zcovector operator+(const zcovector &vecA, const _zcovector &vecB)
_zcovector operator-(const zcovector &vecA, const _zcovector &vecB)
comple * array
1D array to store vector data
Definition: _zcovector.hpp:10
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
(DO NOT USE) Smart-temporary Complex Double-precision Column Vector Class
Definition: _zcovector.hpp:3
CPPL_INT l
vector size
Definition: _zcovector.hpp:9
zcovector & operator+=(const zcovector &)