VERB_code_2.3
zcovector-zcovector.hpp
1 //=============================================================================
4 {
5 #ifdef CPPL_VERBOSE
6  std::cerr << "# [MARK] zcovector::operator=(const zcovector&)"
7  << std::endl;
8 #endif//CPPL_VERBOSE
9 
10  if(Array!=vec.Array){ // if it is NOT self substitution
11  copy(vec);
12  }
13  return *this;
14 }
15 
19 
20 //=============================================================================
23 {
24 #ifdef CPPL_VERBOSE
25  std::cerr << "# [MARK] zcovector::operator+=(const zcovector&)"
26  << std::endl;
27 #endif//CPPL_VERBOSE
28 
29 #ifdef CPPL_DEBUG
30  if( L!=vec.L ){
31  std::cerr << "[ERROR] zcovector::operator+=(const zcovector&)" << std::endl
32  << "These two vectors can not make a sumation." << std::endl
33  << "Your input was (" << L << ") += (" << vec.L << ")."
34  << std::endl;
35  exit(1);
36  }
37 #endif//CPPL_DEBUG
38 
39  for(long i=0; i<L; i++){ Array[i]+=vec.Array[i]; }
40 
41  return *this;
42 }
43 
44 //=============================================================================
47 {
48 #ifdef CPPL_VERBOSE
49  std::cerr << "# [MARK] zcovector::operator-=(const zcovector&)"
50  << std::endl;
51 #endif//CPPL_VERBOSE
52 
53 #ifdef CPPL_DEBUG
54  if( L!=vec.L ){
55  std::cerr << "[ERROR] zcovector::operator-=(const zcovector&)" << std::endl
56  << "These two vectors can not make a subtraction." << std::endl
57  << "Your input was (" << L << ") -= (" << vec.L << ")."
58  << std::endl;
59  exit(1);
60  }
61 #endif//CPPL_DEBUG
62 
63  for(long i=0; i<L; i++){ Array[i]-=vec.Array[i]; }
64 
65  return *this;
66 }
67 
71 
72 //=============================================================================
74 inline _zcovector operator+(const zcovector& vecA, const zcovector& vecB)
75 {
76 #ifdef CPPL_VERBOSE
77  std::cerr << "# [MARK] operator+(const zcovector&, const zcovector&)"
78  << std::endl;
79 #endif//CPPL_VERBOSE
80 
81 #ifdef CPPL_DEBUG
82  if(vecA.L!=vecB.L){
83  std::cerr << "[ERROR] operator+(const zcovector&, const zcovector&)"
84  << std::endl
85  << "These two vectors can not make a sumation." << std::endl
86  << "Your input was (" << vecA.L << ") + (" << vecB.L << ")."
87  << std::endl;
88  exit(1);
89  }
90 
91 #endif//CPPL_DEBUG
92 
93  zcovector newvec(vecA.L);
94  for(long i=0; i<newvec.L; i++){
95  newvec.array[i] =vecA.Array[i]+vecB.Array[i];
96  }
97 
98  return _(newvec);
99 }
100 
101 //=============================================================================
103 inline _zcovector operator-(const zcovector& vecA, const zcovector& vecB)
104 {
105 #ifdef CPPL_VERBOSE
106  std::cerr << "# [MARK] operator-(const zcovector&, const zcovector&)"
107  << std::endl;
108 #endif//CPPL_VERBOSE
109 
110 #ifdef CPPL_DEBUG
111  if(vecA.L!=vecB.L){
112  std::cerr << "[ERROR] operator-(const zcovector&, const zcovector&)"
113  << std::endl
114  << "These two vectors can not make a subtraction." << std::endl
115  << "Your input was (" << vecA.L << ") - (" << vecB.L << ")."
116  << std::endl;
117  exit(1);
118  }
119 #endif//CPPL_DEBUG
120 
121  zcovector newvec(vecA.L);
122  for(long i=0; i<newvec.L; i++){
123  newvec.array[i] =vecA.Array[i]-vecB.Array[i];
124  }
125 
126  return _(newvec);
127 }
128 
129 //=============================================================================
131 inline std::complex<double> operator%(const zcovector& vecA, const zcovector& vecB)
132 {
133 #ifdef CPPL_VERBOSE
134  std::cerr << "# [MARK] operator%(const zcovector&, const zcovector&)"
135  << std::endl;
136 #endif//CPPL_VERBOSE
137 
138 #ifdef CPPL_DEBUG
139  if(vecA.L!=vecB.L){
140  std::cerr << "[ERROR] operator%(const zcovector&, const zcovector&)"
141  << std::endl
142  << "These two vectors can not make a dot product." << std::endl
143  << "Your input was (" << vecA.L << ") % (" << vecB.L << ")."
144  << std::endl;
145  exit(1);
146  }
147 #endif//CPPL_DEBUG
148 
149  std::complex<double> val( zdotu_( vecA.L, vecA.Array, 1, vecB.Array, 1 ) );
150 
151  return val;
152 }
friend double operator%(const drovector &, const _drovector &)
Definition: drovector-_drovector.hpp:132
zcovector & operator=(const zcovector &)
Definition: zcovector-zcovector.hpp:3
std::complex< double > *const & array
1D array to store vector data (readable)
Definition: zcovector.hpp:13
zcovector & operator-=(const zcovector &)
Definition: zcovector-zcovector.hpp:46
void copy(const zcovector &)
Definition: zcovector-misc.hpp:47
friend _drovector operator-(const _drovector &)
Definition: _drovector-unary.hpp:15
long L
vector size
Definition: _drovector.hpp:7
double * Array
1D Array to store vector data
Definition: _drovector.hpp:8
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
friend const _drovector & operator+(const _drovector &)
Definition: _drovector-unary.hpp:3
zcovector & operator+=(const zcovector &)
Definition: zcovector-zcovector.hpp:22