00001
00003 inline zcovector& zcovector::operator=(const _zcovector& vec)
00004 {
00005 #ifdef CPPL_VERBOSE
00006 std::cerr << "# [MARK] zcovector::operator=(const _zcovector&)"
00007 << std::endl;
00008 #endif//CPPL_VERBOSE
00009
00010 shallow_copy(vec);
00011 return *this;
00012 }
00013
00017
00018
00020 inline zcovector& zcovector::operator+=(const _zcovector& vec)
00021 {
00022 #ifdef CPPL_VERBOSE
00023 std::cerr << "# [MARK] zcovector::operator+=(const _zcovector&)"
00024 << std::endl;
00025 #endif//CPPL_VERBOSE
00026
00027 #ifdef CPPL_DEBUG
00028 if( L!=vec.L ){
00029 std::cerr << "[ERROR] zcovector::operator+=(const _zcovector&)" << std::endl
00030 << "These two vectors can not make a sumation." << std::endl
00031 << "Your input was (" << L << ") += (" << vec.L << ")."
00032 << std::endl;
00033 exit(1);
00034 }
00035 #endif//CPPL_DEBUG
00036
00037 for(long i=0; i<L; i++){ Array[i]+=vec.Array[i]; }
00038
00039 vec.destroy();
00040 return *this;
00041 }
00042
00043
00045 inline zcovector& zcovector::operator-=(const _zcovector& vec)
00046 {
00047 #ifdef CPPL_VERBOSE
00048 std::cerr << "# [MARK] zcovector::operator-=(const _zcovector&)"
00049 << std::endl;
00050 #endif//CPPL_VERBOSE
00051
00052 #ifdef CPPL_DEBUG
00053 if( L!=vec.L ){
00054 std::cerr << "[ERROR] zcovector::operator-=(const _zcovector&)" << std::endl
00055 << "These two vectors can not make a subtraction." << std::endl
00056 << "Your input was (" << L << ") -= (" << vec.L << ")."
00057 << std::endl;
00058 exit(1);
00059 }
00060 #endif//CPPL_DEBUG
00061
00062 for(long i=0; i<L; i++){ Array[i]-=vec.Array[i]; }
00063
00064 vec.destroy();
00065 return *this;
00066 }
00067
00071
00072
00074 inline _zcovector operator+(const zcovector& vecA, const _zcovector& vecB)
00075 {
00076 #ifdef CPPL_VERBOSE
00077 std::cerr << "# [MARK] operator+(const zcovector&, const _zcovector&)"
00078 << std::endl;
00079 #endif//CPPL_VERBOSE
00080
00081 #ifdef CPPL_DEBUG
00082 if(vecA.L!=vecB.L){
00083 std::cerr << "[ERROR] operator+(const zcovector&, const _zcovector&)"
00084 << std::endl
00085 << "These two vectors can not make a sumation." << std::endl
00086 << "Your input was (" << vecA.L << ") + (" << vecB.L << ")."
00087 << std::endl;
00088 exit(1);
00089 }
00090 #endif//CPPL_DEBUG
00091
00092 for(long i=0; i<vecA.L; i++){ vecB.Array[i]+=vecA.Array[i]; }
00093
00094 return vecB;
00095 }
00096
00097
00099 inline _zcovector operator-(const zcovector& vecA, const _zcovector& vecB)
00100 {
00101 #ifdef CPPL_VERBOSE
00102 std::cerr << "# [MARK] operator-(const zcovector&, const _zcovector&)"
00103 << std::endl;
00104 #endif//CPPL_VERBOSE
00105
00106 #ifdef CPPL_DEBUG
00107 if(vecA.L!=vecB.L){
00108 std::cerr << "[ERROR] operator-(const zcovector&, const _zcovector&)"
00109 << std::endl
00110 << "These two vectors can not make a subtraction." << std::endl
00111 << "Your input was (" << vecA.L << ") - (" << vecB.L << ")."
00112 << std::endl;
00113 exit(1);
00114 }
00115 #endif//CPPL_DEBUG
00116
00117 for(long i=0; i<vecA.L; i++){
00118 vecB.Array[i] =vecA.Array[i]-vecB.Array[i];
00119 }
00120
00121 return vecB;
00122 }
00123
00124
00126 inline std::complex<double> operator%(const zcovector& vecA, const _zcovector& vecB)
00127 {
00128 #ifdef CPPL_VERBOSE
00129 std::cerr << "# [MARK] operator%(const zcovector&, const _zcovector&)"
00130 << std::endl;
00131 #endif//CPPL_VERBOSE
00132
00133 #ifdef CPPL_DEBUG
00134 if(vecA.L!=vecB.L){
00135 std::cerr << "[ERROR] operator%(const zcovector&, const _zcovector&)"
00136 << std::endl
00137 << "These two vectors can not make a dot product." << std::endl
00138 << "Your input was (" << vecA.L << ") % (" << vecB.L << ")."
00139 << std::endl;
00140 exit(1);
00141 }
00142 #endif//CPPL_DEBUG
00143
00144 std::complex<double> val( zdotu_( vecA.L, vecA.Array, 1, vecB.Array, 1 ) );
00145
00146 vecB.destroy();
00147 return val;
00148 }