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

drovector Class Reference

double-precision row vector class More...

#include <drovector.hpp>

List of all members.

Public Member Functions

 drovector ()
 drovector (const drovector &)
 drovector (const _drovector &)
 drovector (const long &)
 ~drovector ()
CPPSL_double operator() (const long &)
double operator() (const long &) const
void set (const long &, const double &) const
void clear ()
void zero ()
void chsign ()
void copy (const drovector &)
void shallow_copy (const _drovector &)
void resize (const long &)
drovectoroperator= (const drovector &)
drovectoroperator+= (const drovector &)
drovectoroperator-= (const drovector &)
drovectoroperator= (const _drovector &)
drovectoroperator+= (const _drovector &)
drovectoroperator-= (const _drovector &)
drovectoroperator *= (const double &)
drovectoroperator/= (const double &)

Public Attributes

long const & l
 global vector size (readable)

long const & ll
 local vector size (readable)

long *const & desc
 vector description (readable)

double *const & array
 1D array to store vector data (readable)


Private Attributes

long L
 global vector size (NOT accessible)

long Ll
 local vector size (NOT accessible)

long Desc [9]
 vector description (NOT accessible)

double * Array
 1D array to store vector data (NOT accessible)


Friends

class dgematrix
class _dgematrix
class dcovector
class _dcovector
class _drovector
std::ostream & operator<< (std::ostream &, const drovector &)
void swap (drovector &, drovector &)
const drovectoroperator+ (const drovector &)
_drovector operator- (const drovector &)
_drovector operator+ (const drovector &, const drovector &)
_drovector operator+ (const drovector &, const _drovector &)
_drovector operator+ (const _drovector &, const drovector &)
_drovector operator- (const drovector &, const drovector &)
_drovector operator- (const drovector &, const _drovector &)
_drovector operator- (const _drovector &, const drovector &)
_drovector operator * (const drovector &, const dgematrix &)
_drovector operator * (const drovector &, const _dgematrix &)
_drovector operator * (const drovector &, const double &)
_drovector operator * (const double &, const drovector &)
_dgematrix operator * (const dcovector &, const drovector &)
_dgematrix operator * (const _dcovector &, const drovector &)
double operator * (const drovector &, const dcovector &)
double operator * (const drovector &, const _dcovector &)
_drovector operator/ (const drovector &, const double &)
double operator% (const drovector &, const drovector &)
double operator% (const drovector &, const _drovector &)
double operator% (const _drovector &, const drovector &)


Detailed Description

double-precision row vector class

Definition at line 3 of file drovector.hpp.


Constructor & Destructor Documentation

drovector::drovector  )  [inline]
 

drovector constructor

Definition at line 3 of file drovector-constructor.hpp.

References Array, Desc, L, and Ll.

00004   : l(L), ll(Ll), desc(Desc), array(Array)
00005 {
00006   //////// initialize ////////
00007   L =0;
00008   Ll =0;
00009   Desc[0]=1; Desc[1]=icontxt; Desc[2]=0; Desc[3]=0; Desc[4]=mb; Desc[5]=nb;
00010   Desc[6]=0; Desc[7]=0; Desc[8]=1;
00011   Array =new double[0];
00012   
00013 #ifdef  CPPSL_DEBUG
00014   std::cerr << "# [NOTE] drovector::drovector() "
00015             << "A new 0x0 vector at " << Array << " has been made."
00016             << std::endl;
00017 #endif//CPPSL_DEBUG
00018 }

drovector::drovector const drovector vec  )  [inline]
 

drovector copy constructor

Definition at line 22 of file drovector-constructor.hpp.

References Array, Desc, L, and Ll.

00023   : l(L), ll(Ll), desc(Desc), array(Array)
00024 {
00025   //////// initialize ////////
00026   L =vec.L;
00027   Ll =vec.Ll;
00028   for(int i=0; i<9; i++){ Desc[i] =vec.Desc[i]; }
00029   Array =new double[Ll];
00030   
00031   //////// copy ////////
00032   dcopy_(Ll, vec.Array, 1, Array, 1);
00033   
00034 #ifdef  CPPSL_DEBUG
00035   std::cerr << "# [NOTE] drovector::drovector(const drovector&) "
00036             << "A new vector at " << Array << " has been made." << std::endl;
00037 #endif//CPPSL_DEBUG
00038 }

drovector::drovector const _drovector vec  )  [inline]
 

drovector constructor to cast _drovector

Definition at line 42 of file drovector-constructor.hpp.

References Array, Desc, L, and Ll.

00043   : l(L), ll(Ll), desc(Desc), array(Array)
00044 {
00045   //////// initialize ////////
00046   L =vec.L;
00047   Ll =vec.Ll;
00048   for(int i=0; i<9; i++){ Desc[i] =vec.Desc[i]; }
00049   Array =vec.Array;
00050   
00051 #ifdef  CPPSL_DEBUG
00052   std::cerr << "# [NOTE] drovector::drovector(const _drovector&) "
00053             << "A new vector at " << Array << " has been made." << std::endl;
00054 #endif//CPPSL_DEBUG
00055 }

drovector::drovector const long &  _l  )  [inline]
 

drovector constructor with size specification

Definition at line 59 of file drovector-constructor.hpp.

References Array, Desc, L, and Ll.

00060   : l(L), ll(Ll), desc(Desc), array(Array)
00061 {
00062 #ifdef  CPPSL_DEBUG
00063   if( _l<0 ){
00064     std::cerr << "[ERROR] drovector::drovector(const long&)" << std::endl
00065               << "Vector size must be positive integers. " << std::endl
00066               << "Your input was (" << _l << ")." << std::endl;
00067     exit(1);
00068   }
00069 #endif//CPPSL_DEBUG
00070   
00071   //////// initialize ////////
00072   L =_l;
00073   long nl(numroc_(L, nb, mycol, 0, npcol));
00074   if(myrow==0){ Ll=nl; } else{ Ll=0; }
00075   Desc[0]=1; Desc[1]=icontxt; Desc[2]=L; Desc[3]=1; Desc[4]=mb; Desc[5]=nb;
00076   Desc[6]=0; Desc[7]=0; Desc[8]=1;
00077   Array =new double[Ll];
00078   
00079 #ifdef  CPPSL_DEBUG
00080   std::cerr << "# [NOTE] drovector::drovector(const long&) "
00081             << "A new vector at " << Array << " has been made." << std::endl;
00082 #endif//CPPSL_DEBUG
00083 }

drovector::~drovector  )  [inline]
 

drovector destructor

Definition at line 91 of file drovector-constructor.hpp.

References Array.

00092 {
00093 #ifdef  CPPSL_DEBUG
00094   std::cerr << "# [NOTE] drovector::~drovector "
00095             << "A vector at " << Array << " is going to be deleted."
00096             << std::endl;
00097 #endif//CPPSL_DEBUG
00098   //////// delete array ////////
00099   delete [] Array;
00100 }


Member Function Documentation

CPPSL_double drovector::operator() const long &  i  )  [inline]
 

operator() for non-const object

Definition at line 3 of file drovector-io.hpp.

References Array, Desc, and L.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if( i<0 || L<=i ){
00007     std::cerr << "[ERROR] drovector::operator()(const long&)"
00008               << std::endl
00009               << "The required component is out of the vector size."
00010               << std::endl
00011               << "Your input was (" << i << ")." << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   return CPPSL_double( Array, 0, i, Desc );
00017 }

double drovector::operator() const long &  i  )  const [inline]
 

operator() for const object

Definition at line 21 of file drovector-io.hpp.

References Array, Desc, and L.

00022 {
00023 #ifdef  CPPSL_DEBUG
00024   if( i<0 || L<=i ){
00025     std::cerr << "[ERROR] drovector::operator()(const long&) const"
00026               << std::endl
00027               << "The required component is out of the vector size."
00028               << std::endl
00029               << "Your input was (" << i << ")." << std::endl;
00030     exit(1);
00031   }
00032 #endif//CPPSL_DEBUG
00033   
00034   double alpha;
00035   pdelget_('A', ' ', alpha, Array, 1, i+1, Desc);
00036   return alpha;
00037 }

void drovector::set const long &  i,
const double &  v
const [inline]
 

set value for const object

Definition at line 45 of file drovector-io.hpp.

References Array, Desc, and L.

00046 {
00047 #ifdef  CPPSL_DEBUG
00048   if( i<0 || L<=i ){
00049     std::cerr << "[ERROR] drovector::set(const long&, const double&) const"
00050               << std::endl
00051               << "The required component is out of the vector size."
00052               << std::endl
00053               << "Your input was (" << i << ")." << std::endl;
00054     exit(1);
00055   }
00056 #endif//CPPSL_DEBUG
00057   
00058   pdelset_(Array, 1, i+1, Desc, v);
00059 }

void drovector::clear  )  [inline]
 

clear vector

Definition at line 3 of file drovector-misc.hpp.

References Array, array, Desc, L, and Ll.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   std::cerr << "# [NOTE] drovector::clear() "
00007        << "An array at " << array << " is going to be cleared." << std::endl;
00008 #endif//CPPSL_DEBUG
00009   
00010   L =0;
00011   Ll =0;
00012   Desc[0]=1; Desc[1]=icontxt; Desc[2]=0; Desc[3]=0; Desc[4]=mb; Desc[5]=nb;
00013   Desc[6]=0; Desc[7]=0; Desc[8]=1;
00014   delete [] Array;
00015   Array =new double[0];
00016 }

void drovector::zero  )  [inline]
 

make vector into zero vector

Definition at line 20 of file drovector-misc.hpp.

References Array, and Ll.

00021 {
00022   for(long i=0; i<Ll; i++){ Array[i] =0.0; }
00023 }

void drovector::chsign  )  [inline]
 

change sign(+/-) of the vector

Definition at line 27 of file drovector-misc.hpp.

References Array, and Ll.

00028 {
00029   for(long i=0; i<Ll; i++){ Array[i] =-Array[i]; }
00030 }

void drovector::copy const drovector vec  )  [inline]
 

make a deep copy of the drovector

Definition at line 34 of file drovector-misc.hpp.

References Array, Desc, L, and Ll.

Referenced by operator=().

00035 {
00036 #ifdef  CPPSL_DEBUG
00037   std::cerr << "# [NOTE] drovector::copy(const drovector&) "
00038             << "A drovector at " << Array << " is going to be deleted. ";
00039 #endif//CPPSL_DEBUG
00040   
00041   delete [] Array;
00042   L =vec.L;
00043   Ll =vec.Ll;
00044   for(int i=0; i<9; i++){ Desc[i] =vec.Desc[i]; }
00045   Array =new double[Ll];
00046   dcopy_(Ll, vec.Array, 1, Array, 1);
00047   
00048 #ifdef  CPPSL_DEBUG
00049   std::cerr << "Then, a COPY of a drovector has been cleated at "
00050             << Array << "." << std::endl;
00051 #endif//CPPSL_DEBUG
00052 }

void drovector::shallow_copy const _drovector vec  )  [inline]
 

make a shaLlow copy of the vector

Definition at line 56 of file drovector-misc.hpp.

References _drovector::Array, Array, _drovector::Desc, Desc, _drovector::L, L, _drovector::Ll, and Ll.

Referenced by operator=().

00057 {
00058 #ifdef  CPPSL_DEBUG
00059   std::cerr << "# [NOTE] drovector::shaLlow_copy(const _drovector&) "
00060             << "A drovector at " << Array << " is going to be deleted "
00061             << "and point to " << vec.Array << " instead." << std::endl;
00062 #endif//CPPSL_DEBUG
00063   
00064   delete [] Array;
00065   L =vec.L;
00066   Ll =vec.Ll;
00067   for(int i=0; i<9; i++){ Desc[i] =vec.Desc[i]; }
00068   Array =vec.Array;
00069 }

void drovector::resize const long &  _l  )  [inline]
 

resize vector

Definition at line 73 of file drovector-misc.hpp.

References Array, Desc, L, and Ll.

00074 {
00075 #ifdef  CPPSL_DEBUG
00076   if( _l<0 ){
00077     std::cerr << "[ERROR] drovector::resize(const long&)" << std::endl
00078               << "Vector size must be positive integers." << std::endl
00079               << "Your input was (" << _l << ")." << std::endl;
00080     exit(1);
00081   }
00082 #endif//CPPSL_DEBUG
00083   
00084   L =_l;
00085   long nl(numroc_(L, nb, mycol, 0, npcol));
00086   if(myrow==0){ Ll=nl; } else{ Ll=0; }
00087   Desc[0]=1; Desc[1]=icontxt; Desc[2]=L; Desc[3]=1; Desc[4]=mb; Desc[5]=nb;
00088   Desc[6]=0; Desc[7]=0; Desc[8]=1;
00089   delete [] Array;
00090   Array =new double[Ll];
00091 }

drovector & drovector::operator= const drovector vec  )  [inline]
 

drovector=drovector operator

Definition at line 3 of file drovector-drovector.hpp.

References Array, and copy().

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){ // if it is NOT self substitution
00011     copy(vec);
00012   }
00013   return *this;
00014 }

drovector & drovector::operator+= const drovector vec  )  [inline]
 

drovector+=drovector operator

Definition at line 22 of file drovector-drovector.hpp.

References Array, L, and Ll.

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 }

drovector & drovector::operator-= const drovector vec  )  [inline]
 

drovector-=drovector operator

Definition at line 41 of file drovector-drovector.hpp.

References Array, L, and Ll.

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 }

drovector & drovector::operator= const _drovector vec  )  [inline]
 

drovector=_drovector operator

Definition at line 3 of file drovector-_drovector.hpp.

References shallow_copy().

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 }

drovector & drovector::operator+= const _drovector vec  )  [inline]
 

drovector+=_drovector operator

Definition at line 20 of file drovector-_drovector.hpp.

References _drovector::Array, Array, _drovector::destroy(), _drovector::L, L, and Ll.

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 }

drovector & drovector::operator-= const _drovector vec  )  [inline]
 

drovector-=_drovector operator

Definition at line 40 of file drovector-_drovector.hpp.

References _drovector::Array, Array, _drovector::destroy(), _drovector::L, L, and Ll.

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 }

drovector & drovector::operator *= const double &  d  )  [inline]
 

drovector*=double operator

Definition at line 3 of file drovector-double.hpp.

References Array, and Ll.

00004 {
00005   dscal_(Ll, d, Array, 1);
00006   return *this;
00007 }

drovector & drovector::operator/= const double &  d  )  [inline]
 

drovector/=double operator

Definition at line 11 of file drovector-double.hpp.

References Array, and Ll.

00012 {
00013   dscal_(Ll, 1./d, Array, 1);
00014   return *this;
00015 }


Friends And Related Function Documentation

friend class dgematrix [friend]
 

Definition at line 94 of file drovector.hpp.

friend class _dgematrix [friend]
 

Definition at line 95 of file drovector.hpp.

friend class dcovector [friend]
 

Definition at line 98 of file drovector.hpp.

friend class _dcovector [friend]
 

Definition at line 99 of file drovector.hpp.

friend class _drovector [friend]
 

Definition at line 100 of file drovector.hpp.

std::ostream& operator<< std::ostream &  s,
const drovector vec
[friend]
 

Definition at line 66 of file drovector-io.hpp.

00067 {
00068   for(long i=0; i<vec.Ll; i++){ s << " " << vec(i); }
00069   s << std::endl;
00070   
00071   return s;
00072 }

void swap drovector u,
drovector v
[friend]
 

swap two vectors

Definition at line 95 of file drovector-misc.hpp.

00096 {
00097   long u_L(u.L), u_Ll(u.Ll), u_Desc[9];
00098   double* u_Array(u.Array);
00099   u.L=v.L; u.Ll=v.Ll;  u.Array=v.Array;
00100   v.L=u_L; v.Ll=u_Ll;  v.Array=u_Array;
00101   for(int i=0; i<9; i++){
00102     u_Desc[i] =u.Desc[i];
00103     u.Desc[i] =v.Desc[i];
00104     v.Desc[i] =u_Desc[i];
00105   }
00106 }

const drovector& operator+ const drovector vec  )  [friend]
 

+drovector operator

Definition at line 3 of file drovector-unary.hpp.

00004 {
00005   return vec;
00006 }

_drovector operator- const drovector vec  )  [friend]
 

-drovector operator

Definition at line 10 of file drovector-unary.hpp.

00011 {
00012   _drovector newvec(vec.L);
00013   for(long i=0; i<vec.Ll; i++){ newvec.Array[i]=-vec.Array[i]; }
00014   
00015   return newvec;
00016 }

_drovector operator+ const drovector vecA,
const drovector vecB
[friend]
 

drovector+drovector operator

Definition at line 64 of file drovector-drovector.hpp.

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 }

_drovector operator+ const drovector vecA,
const _drovector vecB
[friend]
 

drovector+_drovector operator

Definition at line 64 of file drovector-_drovector.hpp.

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 }

_drovector operator+ const _drovector vecA,
const drovector vecB
[friend]
 

_drovector+drovector operator

Definition at line 3 of file _drovector-drovector.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if( vecA.L!=vecB.L ){
00007     std::cerr << "[ERROR] operator+(const _drovector&, const drovector&)"
00008               << std::endl
00009               << "These two vectors can not make a sumation." << std::endl
00010               << "Your input was (" << vecA.L << ") + (" << vecB.L << ")."
00011               << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   for(int i=0; i<vecA.Ll; i++){ vecA.Array[i] +=vecB.Array[i]; }
00017   
00018   return vecA;
00019 }

_drovector operator- const drovector vecA,
const drovector vecB
[friend]
 

drovector-drovector operator

Definition at line 87 of file drovector-drovector.hpp.

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 }

_drovector operator- const drovector vecA,
const _drovector vecB
[friend]
 

drovector-_drovector operator

Definition at line 84 of file drovector-_drovector.hpp.

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 }

_drovector operator- const _drovector vecA,
const drovector vecB
[friend]
 

_drovector-drovector operator

Definition at line 23 of file _drovector-drovector.hpp.

00024 {
00025 #ifdef  CPPSL_DEBUG
00026   if( vecA.L!=vecB.L ){
00027     std::cerr << "[ERROR] operator-(const _drovector&, const drovector&)"
00028               << std::endl
00029               << "These two vectors can not make a subtraction." << std::endl
00030               << "Your input was (" << vecA.L << ") - (" << vecB.L << ")."
00031               << std::endl;
00032     exit(1);
00033   }
00034 #endif//CPPSL_DEBUG
00035   
00036   for(int i=0; i<vecA.Ll; i++){ vecA.Array[i] -=vecB.Array[i]; }
00037   
00038   return vecA;
00039 }

_drovector operator * const drovector vec,
const dgematrix mat
[friend]
 

drovector*dgematrix operator

Definition at line 3 of file drovector-dgematrix.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if( vec.L!=mat.M ){
00007     std::cerr << "[ERROR] operator*(const drovector&, const dgematrix&)"
00008               << std::endl
00009               << "These vector and matrix can not make a product." << std::endl
00010               << "Your input was (" << vec.L << ") * ("
00011               << mat.M << "x" << mat.N << ")." << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _drovector newvec(mat.N);
00017   pdgemv_( 'T', mat.M, mat.N, 1.0, mat.Array, 1, 1, mat.Desc,
00018            vec.Array, 1, 1, vec.Desc, 1, 0.0,
00019            newvec.Array, 1, 1, newvec.Desc, 1 );
00020   
00021   return newvec;
00022 }

_drovector operator * const drovector vec,
const _dgematrix mat
[friend]
 

drovector*_dgematrix operator

Definition at line 3 of file drovector-_dgematrix.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if( vec.L!=mat.M ){
00007     std::cerr << "[ERROR] operator*(const drovector&, const _dgematrix&)"
00008               << std::endl
00009               << "These vector and matrix can not make a product." << std::endl
00010               << "Your input was (" << vec.L << ") * ("
00011               << mat.M << "x" << mat.N << ")." << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _drovector newvec(mat.N);
00017   pdgemv_( 'T', mat.M, mat.N, 1.0, mat.Array, 1, 1, mat.Desc,
00018            vec.Array, 1, 1, vec.Desc, 1, 0.0,
00019            newvec.Array, 1, 1, newvec.Desc, 1 );
00020   
00021   mat.destroy();
00022   return newvec;
00023 }

_drovector operator * const drovector vec,
const double &  d
[friend]
 

drovector*double operator

Definition at line 23 of file drovector-double.hpp.

00024 {
00025   _drovector newvec(vec.L);
00026   for(int i=0; i<vec.Ll; i++){ newvec.Array[i] =vec.Array[i]*d; }
00027   
00028   return newvec;
00029 }

_drovector operator * const double &  d,
const drovector vec
[friend]
 

double*drovector operator

Definition at line 3 of file double-drovector.hpp.

00004 {
00005   _drovector newvec(vec.L);
00006   for(int i=0; i<vec.Ll; i++){ newvec.Array[i] =d*vec.Array[i]; }
00007   
00008   return newvec;
00009 
00010 }

_dgematrix operator * const dcovector covec,
const drovector rovec
[friend]
 

dcovector*drovector operator

Definition at line 3 of file dcovector-drovector.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(covec.L!=rovec.L){
00007     std::cerr << "[ERROR] operator*(const dcovector&, const drovector&)"
00008               << std::endl
00009               << "These two vectors can not make a product." << std::endl
00010               << "Your input was (" << covec.L << ") * (" << rovec.L << ")."
00011               << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _dgematrix newmat(covec.L, covec.L);
00017   for(long i=0; i<newmat.M; i++){ for(long j=0; j<newmat.N; j++){
00018     newmat(i,j) =covec(i)*rovec(j);
00019   }}
00020   
00021   return newmat;
00022 }

_dgematrix operator * const _dcovector covec,
const drovector rovec
[friend]
 

_dcovector*drovector operator

Definition at line 3 of file _dcovector-drovector.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(covec.L!=rovec.L){
00007     std::cerr << "[ERROR] operator*(const _dcovector&, const drovector&)"
00008               << std::endl
00009               << "These two vectors can not make a product." << std::endl
00010               << "Your input was (" << covec.L << ") * (" << rovec.L << ")."
00011               << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _dgematrix newmat(covec.L, covec.L);
00017   for(long i=0; i<newmat.M; i++){ for(long j=0; j<newmat.N; j++){
00018     newmat(i,j) =covec(i)*rovec(j);
00019   }}
00020   
00021   covec.destroy();
00022   return newmat;
00023 }

double operator * const drovector rovec,
const dcovector covec
[friend]
 

drovector*dcovector operator

Definition at line 3 of file drovector-dcovector.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(rovec.L!=covec.L){
00007     std::cerr << "[ERROR] operator*(const drovector&, const dcovector&)"
00008               << std::endl
00009               << "These two vectors can not make a product." << std::endl
00010               << "Your input was (" << rovec.L << ") * (" << covec.L << ")."
00011               << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   double val;
00017   pddot_( rovec.L, val,
00018           rovec.Array, 1, 1, rovec.Desc, 1, covec.Array, 1, 1, covec.Desc, 1 );
00019   
00020   return val;
00021 }

double operator * const drovector rovec,
const _dcovector covec
[friend]
 

drovector*_dcovector operator

Definition at line 3 of file drovector-_dcovector.hpp.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(rovec.L!=covec.L){
00007     std::cerr << "[ERROR] operator*(const drovector&, const _dcovector&)"
00008               << std::endl
00009               << "These two vectors can not make a product." << std::endl
00010               << "Your input was (" << rovec.L << ") * (" << covec.L << ")."
00011               << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   double val;
00017   pddot_( rovec.L, val,
00018           rovec.Array, 1, 1, rovec.Desc, 1, covec.Array, 1, 1, covec.Desc, 1 );
00019   
00020   covec.destroy();
00021   return val;
00022 }

_drovector operator/ const drovector vec,
const double &  d
[friend]
 

drovector/double operator

Definition at line 33 of file drovector-double.hpp.

00034 {
00035   double inv_d(1./d);
00036   
00037   _drovector newvec(vec.L);
00038   for(int i=0; i<vec.Ll; i++){ newvec.Array[i] =vec.Array[i]*inv_d; }
00039   
00040   return newvec;
00041 }

double operator% const drovector vecA,
const drovector vecB
[friend]
 

drovector*drovector^T operator (inner product)

Definition at line 110 of file drovector-drovector.hpp.

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 }

double operator% const drovector vecA,
const _drovector vecB
[friend]
 

drovector*_drovector^T operator (inner product)

Definition at line 106 of file drovector-_drovector.hpp.

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 }

double operator% const _drovector vecA,
const drovector vecB
[friend]
 

_drovector*drovector^T operator (inner product)

Definition at line 43 of file _drovector-drovector.hpp.

00044 {
00045 #ifdef  CPPSL_DEBUG
00046   if( vecA.L!=vecB.L ){
00047     std::cerr << "[ERROR] operator%(const _drovector&, const drovector&)"
00048               << std::endl
00049               << "These two vectors can not make a dot product." << std::endl
00050               << "Your input was (" << vecA.L << ") % (" << vecB.L << ")."
00051               << std::endl;
00052     exit(1);
00053   }
00054 #endif//CPPSL_DEBUG
00055   
00056   double val;
00057   pddot_( vecA.L, val,
00058           vecA.Array, 1, 1, vecA.Desc, 1, vecB.Array, 1, 1, vecB.Desc, 1 );
00059   
00060   vecA.destroy();
00061   return val;
00062 }


Member Data Documentation

long drovector::L [private]
 

global vector size (NOT accessible)

Definition at line 7 of file drovector.hpp.

Referenced by _drovector::_drovector(), clear(), copy(), drovector(), operator *(), operator%(), operator()(), operator+(), operator+=(), operator-(), operator-=(), operator/(), resize(), set(), shallow_copy(), and swap().

long drovector::Ll [private]
 

local vector size (NOT accessible)

Definition at line 8 of file drovector.hpp.

Referenced by _drovector::_drovector(), chsign(), clear(), copy(), drovector(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), resize(), shallow_copy(), swap(), and zero().

long drovector::Desc[9] [private]
 

vector description (NOT accessible)

Definition at line 9 of file drovector.hpp.

Referenced by _drovector::_drovector(), clear(), copy(), drovector(), operator *(), operator%(), operator()(), resize(), set(), shallow_copy(), and swap().

double* drovector::Array [private]
 

1D array to store vector data (NOT accessible)

Definition at line 10 of file drovector.hpp.

Referenced by _drovector::_drovector(), chsign(), clear(), copy(), drovector(), operator *(), operator *=(), operator%(), operator()(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), resize(), set(), shallow_copy(), swap(), zero(), and ~drovector().

long const& drovector::l
 

global vector size (readable)

Definition at line 14 of file drovector.hpp.

long const& drovector::ll
 

local vector size (readable)

Definition at line 15 of file drovector.hpp.

long* const& drovector::desc
 

vector description (readable)

Definition at line 16 of file drovector.hpp.

double* const& drovector::array
 

1D array to store vector data (readable)

Definition at line 17 of file drovector.hpp.

Referenced by clear().


The documentation for this class was generated from the following files:
Generated on Sat Jan 31 19:25:46 2004 for CPPScaLapack by doxygen 1.3.5