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

dcovector Class Reference

double-precision column vector class More...

#include <dcovector.hpp>

List of all members.

Public Member Functions

 dcovector ()
 dcovector (const dcovector &)
 dcovector (const _dcovector &)
 dcovector (const long &)
 ~dcovector ()
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 dcovector &)
void shallow_copy (const _dcovector &)
void resize (const long &)
dcovectoroperator= (const dcovector &)
dcovectoroperator+= (const dcovector &)
dcovectoroperator-= (const dcovector &)
dcovectoroperator= (const _dcovector &)
dcovectoroperator+= (const _dcovector &)
dcovectoroperator-= (const _dcovector &)
dcovectoroperator *= (const double &)
dcovectoroperator/= (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 drovector
class _drovector
std::ostream & operator<< (std::ostream &, const dcovector &)
void swap (dcovector &, dcovector &)
const dcovectoroperator+ (const dcovector &)
_dcovector operator- (const dcovector &)
_dcovector operator+ (const dcovector &, const dcovector &)
_dcovector operator+ (const dcovector &, const _dcovector &)
_dcovector operator+ (const _dcovector &, const dcovector &)
_dcovector operator- (const dcovector &, const dcovector &)
_dcovector operator- (const dcovector &, const _dcovector &)
_dcovector operator- (const _dcovector &, const dcovector &)
_dcovector operator * (const dgematrix &, const dcovector &)
_dcovector operator * (const _dgematrix &, const dcovector &)
_dgematrix operator * (const dcovector &, const _drovector &)
_dgematrix operator * (const dcovector &, const drovector &)
_dcovector operator * (const double &, const dcovector &)
_dcovector operator * (const dcovector &, const double &)
double operator * (const _drovector &, const dcovector &)
double operator * (const drovector &, const dcovector &)
_dcovector operator/ (const dcovector &, const double &)
double operator% (const dcovector &, const dcovector &)
double operator% (const dcovector &, const _dcovector &)
double operator% (const _dcovector &, const dcovector &)


Detailed Description

double-precision column vector class

Definition at line 3 of file dcovector.hpp.


Constructor & Destructor Documentation

dcovector::dcovector  )  [inline]
 

dcovector constructor

Definition at line 3 of file dcovector-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]=max(1,Ll);
00011   Array =new double[0];
00012   
00013 #ifdef  CPPSL_DEBUG
00014   std::cerr << "# [NOTE] dcovector::dcovector() "
00015             << "A new 0x0 vector at " << Array << " has been made."
00016             << std::endl;
00017 #endif//CPPSL_DEBUG
00018 }

dcovector::dcovector const dcovector vec  )  [inline]
 

dcovector copy constructor

Definition at line 22 of file dcovector-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] dcovector::dcovector(const dcovector&) "
00036             << "A new vector at " << Array << " has been made." << std::endl;
00037 #endif//CPPSL_DEBUG
00038 }

dcovector::dcovector const _dcovector vec  )  [inline]
 

dcovector constructor to cast _dcovector

Definition at line 42 of file dcovector-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] dcovector::dcovector(const _dcovector&) "
00053             << "A new vector pointing at " << Array << " has been made."
00054             << std::endl;
00055 #endif//CPPSL_DEBUG
00056 }

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

dcovector constructor with size specification

Definition at line 60 of file dcovector-constructor.hpp.

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

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

dcovector::~dcovector  )  [inline]
 

dcovector destructor

Definition at line 92 of file dcovector-constructor.hpp.

References Array.

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


Member Function Documentation

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

operator() for non-const object

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

References Array, Desc, and L.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if( i<0 || L<=i ){
00007     std::cerr << "[ERROR] dcovector::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, i, 0, Desc );
00017 }

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

operator() for const object

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

References Array, Desc, and L.

00022 {
00023 #ifdef  CPPSL_DEBUG
00024   if( i<0 || L<=i ){
00025     std::cerr << "[ERROR] dcovector::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, i+1, 1, Desc);
00036   return alpha;
00037 }

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

set value for const object

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

References Array, Desc, and L.

00046 {
00047 #ifdef  CPPSL_DEBUG
00048   if( i<0 || L<=i ){
00049     std::cerr << "[ERROR] dcovector::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, i+1, 1, Desc, v);
00059 }

void dcovector::clear  )  [inline]
 

clear vector

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

References Array, Desc, L, and Ll.

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   std::cerr << "# [NOTE] dcovector::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]=max(1,Ll);
00014   delete [] Array;
00015   Array =new double[0];
00016 }

void dcovector::zero  )  [inline]
 

make vector into zero vector

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

References Array, and Ll.

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

void dcovector::chsign  )  [inline]
 

change sign(+/-) of the vector

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

References Array, and Ll.

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

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

make a deep copy of the dcovector

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

References Array, Desc, L, and Ll.

Referenced by operator=().

00035 {
00036 #ifdef  CPPSL_DEBUG
00037   std::cerr << "# [NOTE] dcovector::copy(const dcovector&) "
00038             << "A dcovector 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 dcovector has been cleated at "
00050             << Array << "." << std::endl;
00051 #endif//CPPSL_DEBUG
00052 }

void dcovector::shallow_copy const _dcovector vec  )  [inline]
 

make a shallow copy of the vector

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

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

Referenced by operator=().

00057 {
00058 #ifdef  CPPSL_DEBUG
00059   std::cerr << "# [NOTE] dcovector::shallow_copy(const dcovector&) "
00060             << "A dcovector 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 dcovector::resize const long &  _l  )  [inline]
 

resize vector

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

References Array, Desc, L, and Ll.

00074 {
00075 #ifdef  CPPSL_DEBUG
00076   if( _l<0 ){
00077     std::cerr << "[ERROR] dcovector::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   delete [] Array;
00085   L =_l;
00086   long ml(numroc_(L, mb, myrow, 0, nprow));
00087   if(mycol==0){ Ll=ml; } else{ Ll=0; }
00088   Desc[0]=1; Desc[1]=icontxt; Desc[2]=L; Desc[3]=1; Desc[4]=mb; Desc[5]=nb;
00089   Desc[6]=0; Desc[7]=0; Desc[8]=max(1,Ll);
00090   Array =new double[Ll];
00091 }

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

dcovector=dcovector operator

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

References Array, and copy().

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   std::cerr << "# [NOTE] dcovector::operator=(const dcovector&) 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 }

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

dcovector+=dcovector operator

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

References Array, L, and Ll.

00023 {
00024 #ifdef  CPPSL_DEBUG
00025   if( L!=vec.L ){
00026     std::cerr << "[ERROR] dcovector::operator+=(const dcovector&)" << 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(int i=0; i<Ll; i++){ Array[i] +=vec.Array[i]; }
00035   
00036   return *this;
00037 }

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

dcovector operator-=

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

References Array, L, and Ll.

00042 {
00043 #ifdef  CPPSL_DEBUG
00044   if( L!=vec.L ){
00045     std::cerr << "[ERROR] dcovector::operator-=(const dcovector&)" << 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(int i=0; i<Ll; i++){ Array[i] -=vec.Array[i]; }
00054   
00055   return *this;
00056 }

dcovector & dcovector::operator= const _dcovector vec  )  [inline]
 

dcovector=_dcovector operator

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

References shallow_copy().

00004 {
00005 #ifdef  CPPL_DEBUG
00006   std::cerr << "# [NOTE] dcovector::operator=(const _dcovector&) was called."
00007             << std::endl;
00008 #endif//CPPL_DEBUG
00009   
00010   shallow_copy(vec);
00011   return *this;
00012 }

dcovector & dcovector::operator+= const _dcovector vec  )  [inline]
 

dcovector+=_dcovector operator

Definition at line 20 of file dcovector-_dcovector.hpp.

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

00021 {
00022 #ifdef  CPPSL_DEBUG
00023   if( L!=vec.L ){
00024     std::cerr << "[ERROR] dcovector::operator+=(const _dcovector&)" << 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(int i=0; i<Ll; i++){ Array[i] +=vec.Array[i]; }
00033   
00034   vec.destroy();
00035   return *this;
00036 }

dcovector & dcovector::operator-= const _dcovector vec  )  [inline]
 

dcovector-=_dcovector operator

Definition at line 40 of file dcovector-_dcovector.hpp.

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

00041 {
00042 #ifdef  CPPSL_DEBUG
00043   if( L!=vec.L ){
00044     std::cerr << "[ERROR] dcovector::operator-=(const _dcovector&)" << 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(int i=0; i<Ll; i++){ Array[i] -=vec.Array[i]; }
00053   
00054   vec.destroy();
00055   return *this;
00056 }

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

dcovector*=double operator

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

References Array, and Ll.

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

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

dcovector/=double operator

Definition at line 11 of file dcovector-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 95 of file dcovector.hpp.

friend class _dgematrix [friend]
 

Definition at line 96 of file dcovector.hpp.

friend class _dcovector [friend]
 

Definition at line 99 of file dcovector.hpp.

friend class drovector [friend]
 

Definition at line 100 of file dcovector.hpp.

friend class _drovector [friend]
 

Definition at line 101 of file dcovector.hpp.

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

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

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

void swap dcovector u,
dcovector v
[friend]
 

swap two vectors

Definition at line 95 of file dcovector-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 dcovector& operator+ const dcovector vec  )  [friend]
 

+dcovector operator

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

00004 {
00005   return vec;
00006 }

_dcovector operator- const dcovector vec  )  [friend]
 

-dcovector operator

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

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

_dcovector operator+ const dcovector vecA,
const dcovector vecB
[friend]
 

dcovector+dcovector operator

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

00065 {
00066 #ifdef  CPPSL_DEBUG
00067   if(vecA.L!=vecB.L){
00068     std::cerr
00069       << "[ERROR] operator+(const dcovector&, const dcovector&)" << 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   
00076 #endif//CPPSL_DEBUG
00077 
00078   _dcovector newvec(vecA.L);
00079   for(int i=0; i<newvec.Ll; i++){
00080     newvec.Array[i] =vecA.Array[i]+vecB.Array[i];
00081   }
00082   
00083   return newvec;
00084 }

_dcovector operator+ const dcovector vecA,
const _dcovector vecB
[friend]
 

dcovector+_dcovector operator

Definition at line 64 of file dcovector-_dcovector.hpp.

00065 {
00066 #ifdef  CPPSL_DEBUG
00067   if(vecA.L!=vecB.L){
00068     std::cerr
00069       << "[ERROR] operator+(const dcovector&, const _dcovector&)" << 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(int i=0; i<vecA.Ll; i++){ vecB.Array[i] +=vecA.Array[i]; }
00078   
00079   return vecB;
00080 }

_dcovector operator+ const _dcovector vecA,
const dcovector vecB
[friend]
 

_dcovector+dcovector operator

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

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(vecA.L!=vecB.L){
00007     std::cerr
00008       << "[ERROR] operator+(const _dcovector&, const dcovector&)" << 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   
00015 #endif//CPPSL_DEBUG
00016 
00017   for(int i=0; i<vecA.Ll; i++){ vecA.Array[i] +=vecB.Array[i]; }
00018   
00019   return vecA;
00020 }

_dcovector operator- const dcovector vecA,
const dcovector vecB
[friend]
 

dcovector-dcovector operator

Definition at line 88 of file dcovector-dcovector.hpp.

00089 {
00090 #ifdef  CPPSL_DEBUG
00091   if(vecA.L!=vecB.L){
00092     std::cerr
00093       << "[ERROR] operator-(const dcovector&, const dcovector&)" << std::endl
00094       << "These two vectors can not make a subtraction." << std::endl
00095       << "Your input was (" << vecA.L << ") - (" << vecB.L << ")."
00096       << std::endl;
00097     exit(1);
00098   }
00099 #endif//CPPSL_DEBUG
00100   
00101   _dcovector newvec(vecA.L);
00102   for(int i=0; i<newvec.Ll; i++){
00103     newvec.Array[i] =vecA.Array[i]-vecB.Array[i];
00104   }
00105   
00106   return newvec;
00107 }

_dcovector operator- const dcovector vecA,
const _dcovector vecB
[friend]
 

dcovector-_dcovector operator

Definition at line 84 of file dcovector-_dcovector.hpp.

00085 {
00086 #ifdef  CPPSL_DEBUG
00087   if(vecA.L!=vecB.L){
00088     std::cerr
00089       << "[ERROR] operator-(const dcovector&, const _dcovector&)" << 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(int i=0; i<vecA.Ll; i++){
00098     vecB.Array[i] =vecA.Array[i]-vecB.Array[i];
00099   }
00100   
00101   return vecB;
00102 }

_dcovector operator- const _dcovector vecA,
const dcovector vecB
[friend]
 

_dcovector-dcovector operator

Definition at line 24 of file _dcovector-dcovector.hpp.

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

_dcovector operator * const dgematrix mat,
const dcovector vec
[friend]
 

dgematrix*dcovector operator

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

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(mat.N!=vec.L){
00007     std::cerr << "[ERROR] operator*(const dgematrix&, const dcovector&)"
00008               << std::endl
00009               << "These matrix and vector can not make a product." << std::endl
00010               << "Your input was (" << mat.m << "x" << mat.n << ") * ("
00011               << vec.l << ")." << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _dcovector newvec(mat.M);
00017   pdgemv_( 'N', 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 }

_dcovector operator * const _dgematrix mat,
const dcovector vec
[friend]
 

_dgematrix*dcovector operator

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

00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(mat.N!=vec.L){
00007     std::cerr << "[ERROR] operator*(const _dgematrix&, const dcovector&)"
00008               << std::endl
00009               << "These matrix and vector can not make a product." << std::endl
00010               << "Your input was (" << mat.M << "x" << mat.N << ") * ("
00011               << vec.L << ")." << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   _dcovector newvec(mat.M);
00017   pdgemv_( 'N', 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 }

_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   rovec.destroy();
00022   return newmat;
00023 }

_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 }

_dcovector operator * const double &  d,
const dcovector vec
[friend]
 

double*dcovector operator

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

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

_dcovector operator * const dcovector vec,
const double &  d
[friend]
 

dcovector*double operator

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

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

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   rovec.destroy();
00021   return val;
00022 }

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 }

_dcovector operator/ const dcovector vec,
const double &  d
[friend]
 

dcovector/double operator

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

00034 {
00035   double inv_d(1./d);
00036   
00037   _dcovector 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 dcovector vecA,
const dcovector vecB
[friend]
 

dcovector^T*dcovector operator (inner product)

Definition at line 111 of file dcovector-dcovector.hpp.

00112 {
00113 #ifdef  CPPSL_DEBUG
00114   if(vecA.L!=vecB.L){
00115     std::cerr
00116       << "[ERROR] operator%(const dcovector&, const dcovector&)" << std::endl
00117       << "These two vectors can not make a dot product." << std::endl
00118       << "Your input was (" << vecA.L << ") % (" << vecB.L << ")."
00119       << std::endl;
00120     exit(1);
00121   }
00122 #endif//CPPSL_DEBUG
00123   
00124   double val;
00125   pddot_( vecA.L, val,
00126           vecA.Array, 1, 1, vecA.Desc, 1, vecB.Array, 1, 1, vecB.Desc, 1 );
00127   
00128   return val;
00129 }

double operator% const dcovector vecA,
const _dcovector vecB
[friend]
 

dcovector^T*_dcovector operator (inner product)

Definition at line 106 of file dcovector-_dcovector.hpp.

00107 {
00108 #ifdef  CPPSL_DEBUG
00109   if(vecA.L!=vecB.L){
00110     std::cerr
00111       << "[ERROR] operator%(const dcovector&, const _dcovector&)" << 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 _dcovector vecA,
const dcovector vecB
[friend]
 

_dcovector^T*dcovector operator (inner product)

Definition at line 44 of file _dcovector-dcovector.hpp.

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


Member Data Documentation

long dcovector::L [private]
 

global vector size (NOT accessible)

Definition at line 7 of file dcovector.hpp.

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

long dcovector::Ll [private]
 

local vector size (NOT accessible)

Definition at line 8 of file dcovector.hpp.

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

long dcovector::Desc[9] [private]
 

vector description (NOT accessible)

Definition at line 9 of file dcovector.hpp.

Referenced by _dcovector::_dcovector(), clear(), copy(), dcovector(), dgematrix::dgesv(), operator *(), operator%(), operator()(), resize(), set(), shallow_copy(), and swap().

double* dcovector::Array [private]
 

1D array to store vector data (NOT accessible)

Definition at line 10 of file dcovector.hpp.

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

long const& dcovector::l
 

global vector size (readable)

Definition at line 14 of file dcovector.hpp.

Referenced by dcovector(), dgematrix::dgesv(), and operator *().

long const& dcovector::ll
 

local vector size (readable)

Definition at line 15 of file dcovector.hpp.

long* const& dcovector::desc
 

vector description (readable)

Definition at line 16 of file dcovector.hpp.

double* const& dcovector::array
 

1D array to store vector data (readable)

Definition at line 17 of file dcovector.hpp.


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