00001
00003 inline void zrovector::clear()
00004 {
00005 #ifdef CPPL_VERBOSE
00006 std::cerr << "# [MARK] zrovector::clear()"
00007 << std::endl;
00008 #endif//CPPL_VERBOSE
00009
00010 #ifdef CPPL_DEBUG
00011 std::cerr << "# [NOTE] zrovector::clear() "
00012 << " An array at " << Array
00013 << " is going to be cleared." << std::endl;
00014 #endif//CPPL_DEBUG
00015
00016 L =0;
00017 delete [] Array;
00018 Array =NULL;
00019 }
00020
00021
00023 inline void zrovector::zero()
00024 {
00025 #ifdef CPPL_VERBOSE
00026 std::cerr << "# [MARK] zrovector::zero()"
00027 << std::endl;
00028 #endif//CPPL_VERBOSE
00029
00030 for(long i=0; i<L; i++){ Array[i] =std::complex<double>(0.0,0.0); }
00031 }
00032
00033
00035 inline void zrovector::chsign()
00036 {
00037 #ifdef CPPL_VERBOSE
00038 std::cerr << "# [MARK] zrovector::chsign()"
00039 << std::endl;
00040 #endif//CPPL_VERBOSE
00041
00042 for(long i=0; i<L; i++){ Array[i] =-Array[i]; }
00043 }
00044
00045
00047 inline void zrovector::copy(const zrovector& vec)
00048 {
00049 #ifdef CPPL_VERBOSE
00050 std::cerr << "# [MARK] zrovector::copy(const zrovector&)"
00051 << std::endl;
00052 #endif//CPPL_VERBOSE
00053
00054 #ifdef CPPL_DEBUG
00055 std::cerr << "# [NOTE] zrovector::copy(const zrovector&) "
00056 << "A zrovector at " << Array << " is going to be deleted. ";
00057 #endif//CPPL_DEBUG
00058
00059 delete [] Array;
00060 L =vec.L;
00061 Array =new std::complex<double>[vec.L];
00062 zcopy_(vec.L, vec.Array, 1, Array, 1);
00063
00064 #ifdef CPPL_DEBUG
00065 std::cerr << "Then, a COPY of a zrovector has been cleated at "
00066 << Array << "." << std::endl;
00067 #endif//CPPL_DEBUG
00068 }
00069
00070
00073 inline void zrovector::shallow_copy(const _zrovector& vec)
00074 {
00075 #ifdef CPPL_VERBOSE
00076 std::cerr << "# [MARK] zrovector::shallow_copy(const _zrovector&)"
00077 << std::endl;
00078 #endif//CPPL_VERBOSE
00079
00080 #ifdef CPPL_DEBUG
00081 std::cerr << "# [NOTE] zrovector::shallow_copy(const _zrovector&) "
00082 << "A zrovector at " << Array << " is going to be deleted "
00083 << "and point at " << vec.Array << " instead." << std::endl;
00084 #endif//CPPL_DEBUG
00085
00086 delete [] Array;
00087 L =vec.L;
00088 Array =vec.Array;
00089 }
00090
00091
00093 inline void zrovector::resize(const long& _l)
00094 {
00095 #ifdef CPPL_VERBOSE
00096 std::cerr << "# [MARK] zrovector::resize(const long&)"
00097 << std::endl;
00098 #endif//CPPL_VERBOSE
00099
00100 #ifdef CPPL_DEBUG
00101 if( _l<0 ){
00102 std::cerr << "[ERROR] zrovector::resize(const long&)" << std::endl
00103 << "Vector size must be positive integers." << std::endl
00104 << "Your input was (" << _l << ")." << std::endl;
00105 exit(1);
00106 }
00107 #endif//CPPL_DEBUG
00108
00109 L =_l;
00110 delete [] Array;
00111 Array =new std::complex<double>[_l];
00112 }
00113
00114
00116 inline void swap(zrovector& u, zrovector& v)
00117 {
00118 #ifdef CPPL_VERBOSE
00119 std::cerr << "# [MARK] swap(zrovector&, zrovector&)"
00120 << std::endl;
00121 #endif//CPPL_VERBOSE
00122
00123 long u_L(u.L);
00124 std::complex<double>* u_Array(u.Array);
00125 u.L=v.L; u.Array=v.Array;
00126 v.L=u_L; v.Array=u_Array;
00127 }
00128
00129
00131 inline _zrovector _(zrovector& vec)
00132 {
00133 #ifdef CPPL_VERBOSE
00134 std::cerr << "# [MARK] _(zrovector&)"
00135 << std::endl;
00136 #endif//CPPL_VERBOSE
00137
00138 _zrovector newvec;
00139
00140 newvec.L =vec.L;
00141 newvec.Array =vec.Array;
00142
00143 vec.L =0;
00144 vec.Array =NULL;
00145
00146 return newvec;
00147 }