VERB_code_2.3
_zrovector-zrovector.hpp
1 //=============================================================================
3 inline _zrovector operator+(const _zrovector& vecA, const zrovector& vecB)
4 {
5 #ifdef CPPL_VERBOSE
6  std::cerr << "# [MARK] operator+(const _zrovector&, const zrovector&)"
7  << std::endl;
8 #endif//CPPL_VERBOSE
9 
10 #ifdef CPPL_DEBUG
11  if(vecA.L!=vecB.L){
12  std::cerr << "[ERROR] operator+(const _zrovector&, const zrovector&)"
13  << std::endl
14  << "These two vectors can not make a sumation." << std::endl
15  << "Your input was (" << vecA.L << ") + (" << vecB.L << ")."
16  << std::endl;
17  exit(1);
18  }
19 
20 #endif//CPPL_DEBUG
21 
22  for(long i=0; i<vecA.L; i++){ vecA.Array[i]+=vecB.Array[i]; }
23 
24  return vecA;
25 }
26 
27 //=============================================================================
29 inline _zrovector operator-(const _zrovector& vecA, const zrovector& vecB)
30 {
31 #ifdef CPPL_VERBOSE
32  std::cerr << "# [MARK] operator-(const _zrovector&, const zrovector&)"
33  << std::endl;
34 #endif//CPPL_VERBOSE
35 
36 #ifdef CPPL_DEBUG
37  if(vecA.L!=vecB.L){
38  std::cerr << "[ERROR] operator-(const _zrovector&, const zrovector&)"
39  << std::endl
40  << "These two vectors can not make a subtraction." << std::endl
41  << "Your input was (" << vecA.L << ") - (" << vecB.L << ")."
42  << std::endl;
43  exit(1);
44  }
45 #endif//CPPL_DEBUG
46 
47  for(long i=0; i<vecA.L; i++){ vecA.Array[i]-=vecB.Array[i]; }
48 
49  return vecA;
50 }
51 
52 //=============================================================================
54 inline std::complex<double> operator%(const _zrovector& vecA, const zrovector& vecB)
55 {
56 #ifdef CPPL_VERBOSE
57  std::cerr << "# [MARK] operator%(const _zrovector&, const zrovector&)"
58  << std::endl;
59 #endif//CPPL_VERBOSE
60 
61 #ifdef CPPL_DEBUG
62  if(vecA.L!=vecB.L){
63  std::cerr << "[ERROR] operator%(const _zrovector&, const zrovector&)"
64  << std::endl
65  << "These two vectors can not make a dot product." << std::endl
66  << "Your input was (" << vecA.L << ") % (" << vecB.L << ")."
67  << std::endl;
68  exit(1);
69  }
70 #endif//CPPL_DEBUG
71 
72  std::complex<double> val( zdotu_( vecA.L, vecA.Array, 1, vecB.Array, 1 ) );
73 
74  vecA.destroy();
75  return val;
76 }
void destroy() const
Definition: _zrovector-misc.hpp:3
long L
vector size
Definition: _zrovector.hpp:7
friend _zrovector operator-(const _zrovector &)
Definition: _zrovector-unary.hpp:15
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
std::complex< double > * Array
1D Array to store vector data
Definition: _zrovector.hpp:8
friend std::complex< double > operator%(const zrovector &, const _zrovector &)
Definition: zrovector-_zrovector.hpp:127
friend const _zrovector & operator+(const _zrovector &)
Definition: _zrovector-unary.hpp:3