00001
00003 inline zrovector& zrovector::operator=(const _zrovector& vec)
00004 {
00005 #ifdef CPPL_VERBOSE
00006 std::cerr << "# [MARK] zrovector::operator=(const _zrovector&)"
00007 << std::endl;
00008 #endif//CPPL_VERBOSE
00009
00010 shallow_copy(vec);
00011 return *this;
00012 }
00013
00017
00018
00020 inline zrovector& zrovector::operator+=(const _zrovector& vec)
00021 {
00022 #ifdef CPPL_VERBOSE
00023 std::cerr << "# [MARK] zrovector::operator+=(const _zrovector&)"
00024 << std::endl;
00025 #endif//CPPL_VERBOSE
00026
00027 #ifdef CPPL_DEBUG
00028 if( L!=vec.L ){
00029 std::cerr << "[ERROR] zrovector::operator+=(const _zrovector&)" << 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 zrovector& zrovector::operator-=(const _zrovector& vec)
00046 {
00047 #ifdef CPPL_VERBOSE
00048 std::cerr << "# [MARK] zrovector::operator-=(const _zrovector&)"
00049 << std::endl;
00050 #endif//CPPL_VERBOSE
00051
00052 #ifdef CPPL_DEBUG
00053 if( L!=vec.L ){
00054 std::cerr << "[ERROR] zrovector::operator-=(const _zrovector&)" << 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 _zrovector operator+(const zrovector& vecA, const _zrovector& vecB)
00075 {
00076 #ifdef CPPL_VERBOSE
00077 std::cerr << "# [MARK] operator+(const zrovector&, const _zrovector&)"
00078 << std::endl;
00079 #endif//CPPL_VERBOSE
00080
00081 #ifdef CPPL_DEBUG
00082 if(vecA.L!=vecB.L){
00083 std::cerr << "[ERROR] operator+(const zrovector&, const _zrovector&)"
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
00091 #endif//CPPL_DEBUG
00092
00093 for(long i=0; i<vecA.L; i++){ vecB.Array[i]+=vecA.Array[i]; }
00094
00095 return vecB;
00096 }
00097
00098
00100 inline _zrovector operator-(const zrovector& vecA, const _zrovector& vecB)
00101 {
00102 #ifdef CPPL_VERBOSE
00103 std::cerr << "# [MARK] operator-(const zrovector&, const _zrovector&)"
00104 << std::endl;
00105 #endif//CPPL_VERBOSE
00106
00107 #ifdef CPPL_DEBUG
00108 if(vecA.L!=vecB.L){
00109 std::cerr << "[ERROR] operator-(const zrovector&, const _zrovector&)"
00110 << std::endl
00111 << "These two vectors can not make a subtraction." << std::endl
00112 << "Your input was (" << vecA.L << ") - (" << vecB.L << ")."
00113 << std::endl;
00114 exit(1);
00115 }
00116 #endif//CPPL_DEBUG
00117
00118 for(long i=0; i<vecA.L; i++){
00119 vecB.Array[i] =vecA.Array[i]-vecB.Array[i];
00120 }
00121
00122 return vecB;
00123 }
00124
00125
00127 inline std::complex<double> operator%(const zrovector& vecA, const _zrovector& vecB)
00128 {
00129 #ifdef CPPL_VERBOSE
00130 std::cerr << "# [MARK] operator%(const zrovector&, const _zrovector&)"
00131 << std::endl;
00132 #endif//CPPL_VERBOSE
00133
00134 #ifdef CPPL_DEBUG
00135 if(vecA.L!=vecB.L){
00136 std::cerr << "[ERROR] operator%(const zrovector&, const _zrovector&)"
00137 << std::endl
00138 << "These two vectors can not make a dot product." << std::endl
00139 << "Your input was (" << vecA.L << ") % (" << vecB.L << ")."
00140 << std::endl;
00141 exit(1);
00142 }
00143 #endif//CPPL_DEBUG
00144
00145 std::complex<double> val( zdotu_( vecA.L, vecA.Array, 1, vecB.Array, 1 ) );
00146
00147 vecB.destroy();
00148 return val;
00149 }