00001
00002
00003 inline drovector& drovector::operator=(const drovector& vec)
00004 {
00005 #ifdef CPPSL_DEBUG
00006 std::cerr << "# [NOTE] drovector::operator=(const drovector&) was called."
00007 << std::endl;
00008 #endif//CPPSL_DEBUG
00009
00010 if(Array!=vec.Array){
00011 copy(vec);
00012 }
00013 return *this;
00014 }
00015
00016
00017
00018
00019
00020
00021
00022 inline drovector& drovector::operator+=(const drovector& vec)
00023 {
00024 #ifdef CPPSL_DEBUG
00025 if( L!=vec.L ){
00026 std::cerr << "[ERROR] drovector::operator+=(const drovector&)" << std::endl
00027 << "These two vectors can not make a sumation." << std::endl
00028 << "Your input was (" << L << ") += (" << vec.L << ")."
00029 << std::endl;
00030 exit(1);
00031 }
00032 #endif//CPPSL_DEBUG
00033
00034 for(long i=0; i<Ll; i++){ Array[i] +=vec.Array[i]; }
00035
00036 return *this;
00037 }
00038
00039
00040
00041 inline drovector& drovector::operator-=(const drovector& vec)
00042 {
00043 #ifdef CPPSL_DEBUG
00044 if( L!=vec.L ){
00045 std::cerr << "[ERROR] drovector::operator-=(const drovector&)" << std::endl
00046 << "These two vectors can not make a subtraction." << std::endl
00047 << "Your input was (" << L << ") -= (" << vec.L << ")."
00048 << std::endl;
00049 exit(1);
00050 }
00051 #endif//CPPSL_DEBUG
00052
00053 for(long i=0; i<Ll; i++){ Array[i] -=vec.Array[i]; }
00054
00055 return *this;
00056 }
00057
00058
00059
00060
00061
00062
00063
00064 inline _drovector operator+(const drovector& vecA, const drovector& vecB)
00065 {
00066 #ifdef CPPSL_DEBUG
00067 if( vecA.L!=vecB.L ){
00068 std::cerr << "[ERROR] operator+(const drovector&, const drovector&)"
00069 << std::endl
00070 << "These two vectors can not make a sumation." << std::endl
00071 << "Your input was (" << vecA.L << ") + (" << vecB.L << ")."
00072 << std::endl;
00073 exit(1);
00074 }
00075 #endif//CPPSL_DEBUG
00076
00077 _drovector newvec(vecA.L);
00078 for(long i=0; i<newvec.Ll; i++){
00079 newvec.Array[i] =vecA.Array[i]+vecB.Array[i];
00080 }
00081
00082 return newvec;
00083 }
00084
00085
00086
00087 inline _drovector operator-(const drovector& vecA, const drovector& vecB)
00088 {
00089 #ifdef CPPSL_DEBUG
00090 if( vecA.L!=vecB.L ){
00091 std::cerr << "[ERROR] operator-(const drovector&, const drovector&)"
00092 << std::endl
00093 << "These two vectors can not make a subtraction." << std::endl
00094 << "Your input was (" << vecA.L << ") - (" << vecB.L << ")."
00095 << std::endl;
00096 exit(1);
00097 }
00098 #endif//CPPSL_DEBUG
00099
00100 _drovector newvec(vecA.L);
00101 for(long i=0; i<newvec.Ll; i++){
00102 newvec.Array[i] =vecA.Array[i]-vecB.Array[i];
00103 }
00104
00105 return newvec;
00106 }
00107
00108
00109
00110 inline double operator%(const drovector& vecA, const drovector& vecB)
00111 {
00112 #ifdef CPPSL_DEBUG
00113 if( vecA.L!=vecB.L ){
00114 std::cerr << "[ERROR] operator%(const drovector&, const drovector&)"
00115 << std::endl
00116 << "These two vectors can not make a dot product." << std::endl
00117 << "Your input was (" << vecA.L << ") % (" << vecB.L << ")."
00118 << std::endl;
00119 exit(1);
00120 }
00121 #endif//CPPSL_DEBUG
00122
00123 double val;
00124 pddot_( vecA.L, val,
00125 vecA.Array, 1, 1, vecA.Desc, 1, vecB.Array, 1, 1, vecB.Desc, 1 );
00126
00127 return val;
00128 }