Main Page | Class List | File List | Class Members | File Members | Related Pages

drovector-_drovector.hpp

Go to the documentation of this file.
00001 //=============================================================================
00002 /*! drovector=_drovector operator */
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   shallow_copy(vec);
00011   return *this;
00012 }
00013 
00014 ///////////////////////////////////////////////////////////////////////////////
00015 ///////////////////////////////////////////////////////////////////////////////
00016 ///////////////////////////////////////////////////////////////////////////////
00017 
00018 //=============================================================================
00019 /*! drovector+=_drovector operator */
00020 inline drovector& drovector::operator+=(const _drovector& vec)
00021 {
00022 #ifdef  CPPSL_DEBUG
00023   if( L!=vec.L ){
00024     std::cerr << "[ERROR] drovector::operator+=(const _drovector&)" << std::endl
00025               << "These two vectors can not make a sumation." << std::endl
00026               << "Your input was (" << L << ") += (" << vec.L << ")."
00027               << std::endl;
00028     exit(1);
00029   }
00030 #endif//CPPSL_DEBUG
00031   
00032   for(long i=0; i<Ll; i++){ Array[i] +=vec.Array[i]; }
00033   
00034   vec.destroy();
00035   return *this;
00036 }
00037 
00038 //=============================================================================
00039 /*! drovector-=_drovector operator */
00040 inline drovector& drovector::operator-=(const _drovector& vec)
00041 {
00042 #ifdef  CPPSL_DEBUG
00043   if( L!=vec.L ){
00044     std::cerr << "[ERROR] drovector::operator-=(const drovector&)" << std::endl
00045               << "These two vectors can not make a subtraction." << std::endl
00046               << "Your input was (" << L << ") -= (" << vec.L << ")."
00047               << std::endl;
00048     exit(1);
00049   }
00050 #endif//CPPSL_DEBUG
00051   
00052   for(long i=0; i<Ll; i++){ Array[i] -=vec.Array[i]; }
00053   
00054   vec.destroy();
00055   return *this;
00056 }
00057 
00058 ///////////////////////////////////////////////////////////////////////////////
00059 ///////////////////////////////////////////////////////////////////////////////
00060 ///////////////////////////////////////////////////////////////////////////////
00061 
00062 //=============================================================================
00063 /*! drovector+_drovector operator */
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   for(long i=0; i<vecA.Ll; i++){ vecB.Array[i] +=vecA.Array[i]; }
00078   
00079   return vecB;
00080 }
00081 
00082 //=============================================================================
00083 /*! drovector-_drovector operator */
00084 inline _drovector operator-(const drovector& vecA, const _drovector& vecB)
00085 {
00086 #ifdef  CPPSL_DEBUG
00087   if( vecA.L!=vecB.L ){
00088     std::cerr << "[ERROR] operator-(const drovector&, const _drovector&)"
00089               << std::endl
00090               << "These two vectors can not make a subtraction." << std::endl
00091               << "Your input was (" << vecA.L << ") - (" << vecB.L << ")."
00092               << std::endl;
00093     exit(1);
00094   }
00095 #endif//CPPSL_DEBUG
00096   
00097   for(long i=0; i<vecA.Ll; i++){
00098     vecB.Array[i] =vecA.Array[i]-vecB.Array[i];
00099   }
00100   
00101   return vecB;
00102 }
00103 
00104 //=============================================================================
00105 /*! drovector*_drovector^T operator (inner product) */
00106 inline double operator%(const drovector& vecA, const _drovector& vecB)
00107 {
00108 #ifdef  CPPSL_DEBUG
00109   if( vecA.L!=vecB.L ){
00110     std::cerr << "[ERROR] operator%(const drovector&, const _drovector&)"
00111               << std::endl
00112               << "These two vectors can not make a dot product." << std::endl
00113               << "Your input was (" << vecA.L << ") % (" << vecB.L << ")."
00114               << std::endl;
00115     exit(1);
00116   }
00117 #endif//CPPSL_DEBUG
00118   
00119   double val;
00120   pddot_( vecA.L, val,
00121           vecA.Array, 1, 1, vecA.Desc, 1, vecB.Array, 1, 1, vecB.Desc, 1 );
00122   
00123   vecB.destroy();
00124   return val;
00125 }

Generated on Sat Jan 31 19:25:44 2004 for CPPScaLapack by doxygen 1.3.5