CPPLapack
Public Member Functions | Public Attributes | Friends
drovector Class Reference

Real 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 &, const long=0)
 drovector (const char *)
 ~drovector ()
_zrovector to_zrovector () const
double & operator() (const long &)
double operator() (const long &) const
drovectorset (const long &, const double &)
void write (const char *) const
void read (const char *)
void clear ()
drovectorzero ()
void chsign ()
void copy (const drovector &)
void shallow_copy (const _drovector &)
void alias (const drovector &)
void unalias ()
drovectorresize (const long &, const long=0)
void stretch (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 l
 vector size
long cap
 vector capacity
double * array
 1D array to store vector data

Friends

std::ostream & operator<< (std::ostream &, const drovector &)
_dcovector t (const drovector &)
double nrm2 (const drovector &)
long idamax (const drovector &)
double damax (const drovector &)
void swap (drovector &, drovector &)
_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 &)
double operator* (const drovector &, const dcovector &)
double operator* (const drovector &, const _dcovector &)
_drovector operator* (const drovector &, const dgematrix &)
_drovector operator* (const drovector &, const _dgematrix &)
_drovector operator* (const drovector &, const dsymatrix &)
_drovector operator* (const drovector &, const _dsymatrix &)
_drovector operator* (const drovector &, const dgbmatrix &)
_drovector operator* (const drovector &, const _dgbmatrix &)
_drovector operator* (const drovector &, const dgsmatrix &)
_drovector operator* (const drovector &, const _dgsmatrix &)
_drovector operator* (const drovector &, const dssmatrix &)
_drovector operator* (const drovector &, const _dssmatrix &)
_drovector operator* (const drovector &, const double &)
_drovector operator/ (const drovector &, const double &)
double operator% (const drovector &, const drovector &)
double operator% (const drovector &, const _drovector &)
_drovector operator* (const double &, const drovector &)

Detailed Description

Real 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, cap, and l.

{VERBOSE_REPORT;
  //////// initialize ////////
  l =0;
  cap =0;
  array =NULL;
}
drovector::drovector ( const drovector vec) [inline]

drovector copy constructor

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

References array, cap, and l.

{VERBOSE_REPORT;
  //////// initialize ////////
  l =vec.l;
  cap =vec.cap;
  array =new double[cap];
  
  //////// copy ////////
  dcopy_(l, vec.array, 1, array, 1);
}
drovector::drovector ( const _drovector vec) [inline]

drovector constructor to cast _drovector

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

References array, _drovector::array, cap, _drovector::cap, _drovector::l, l, and _drovector::nullify().

{VERBOSE_REPORT;
  //////// initialize ////////
  l =vec.l;
  cap =vec.cap;
  array =vec.array;
  
  vec.nullify();
}
drovector::drovector ( const long &  _l,
const long  margin = 0 
) [inline]

drovector constructor with size specification

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

References array, cap, and l.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( _l<0 || margin<0 ){
    ERROR_REPORT;
    std::cerr << "Vector size must be positive integers. " << std::endl
              << "Your input was (" << _l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  //////// initialize ////////
  l =_l;
  cap =l+margin;
  array =new double[cap];
}
drovector::drovector ( const char *  filename) [inline]

drovector constructor with filename

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

References array, and read().

{VERBOSE_REPORT;
  array =NULL;
  read(filename);
}
drovector::~drovector ( ) [inline]

drovector destructor

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

References array.

{VERBOSE_REPORT;
  delete [] array;
}

Member Function Documentation

_zrovector drovector::to_zrovector ( ) const [inline]

cast to _zrovector

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

References _, zrovector::array, array, i(), and l.

{VERBOSE_REPORT;
  zrovector newvec(l);
  
  for(long i=0; i<l; i++){
    newvec.array[i] =comple(array[i], 0.);
  }
  
  return _(newvec);
}
double & drovector::operator() ( const long &  i) [inline]

operator() for non-const object

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

References array, i(), and l.

Referenced by read(), and write().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( i<0 || l<=i ){
    ERROR_REPORT;
    std::cerr << "The required component is out of the vector size." << std::endl
              << "Your input was (" << i << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  return array[i];
}
double drovector::operator() ( const long &  i) const [inline]

operator() for const object

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

References array, i(), and l.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( i<0 || l<=i ){
    ERROR_REPORT;
    std::cerr << "The required component is out of the vector size." << std::endl
              << "Your input was (" << i << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  return array[i];
}
drovector & drovector::set ( const long &  i,
const double &  v 
) [inline]

set value for const object

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

References array, i(), and l.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( i<0 || l<=i ){
    ERROR_REPORT;
    std::cerr << "The required component is out of the vector size." << std::endl
              << "Your input was (" << i << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  array[i] =v;
  return *this;
}
void drovector::write ( const char *  filename) const [inline]

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

References i(), l, and operator()().

{VERBOSE_REPORT;
  std::ofstream ofs(filename, std::ios::trunc);
  ofs.setf(std::cout.flags());
  ofs.precision(std::cout.precision());
  ofs.width(std::cout.width());
  ofs.fill(std::cout.fill());
  
  ofs << "#drovector" << " " << l << std::endl;
  for(long i=0; i<l; i++){
    ofs << operator()(i) << " ";
  }
  ofs << std::endl;
  
  ofs.close();
}
void drovector::read ( const char *  filename) [inline]

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

References i(), l, operator()(), and resize().

Referenced by drovector().

{VERBOSE_REPORT;
  std::ifstream s( filename );
  if(!s){
    ERROR_REPORT;
    std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl;
    exit(1);
  }

  std::string id;
  s >> id;
  if( id != "drovector" && id != "#drovector" ){
    ERROR_REPORT;
    std::cerr << "The type name of the file \"" << filename << "\" is not drovector." << std::endl
              << "Its type name was " << id << " ." << std::endl;
    exit(1);
  }
  
  s >> l;
  resize(l);
  for(long i=0; i<l; i++) { s >> operator()(i); }
  if(s.eof()){
    ERROR_REPORT;
    std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl
              << "Most likely, there is a lack of data components, or a linefeed code or space code is missing at the end of the last line." << std::endl;
    exit(1);
  }
  
  s >> id;
  if(!s.eof()){
    ERROR_REPORT;
    std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl
              << "Most likely, there are extra data components." << std::endl;
    exit(1);
  }
  
  s.close();
}
void drovector::clear ( ) [inline]

clear vector

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

References array, cap, and l.

{VERBOSE_REPORT;
  l =0;
  cap =0;
  delete [] array;
  array =NULL;
}
drovector & drovector::zero ( ) [inline]

make vector into zero vector

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

References array, i(), and l.

Referenced by dgematrix::dgels(), operator%(), operator*(), dssmatrix::row(), dgsmatrix::row(), and zgematrix::zgels().

{VERBOSE_REPORT;
  for(long i=0; i<l; i++){ array[i] =0.0; }
  return *this;
}
void drovector::chsign ( ) [inline]

change sign(+/-) of the vector

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

References array, i(), and l.

{VERBOSE_REPORT;
  for(long i=0; i<l; i++){ array[i] =-array[i]; }
}
void drovector::copy ( const drovector vec) [inline]

make a deep copy of the drovector

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

References array, cap, and l.

Referenced by operator=().

{VERBOSE_REPORT;
  l =vec.l;
  cap =vec.cap;
  delete [] array;
  array =new double[vec.cap];
  dcopy_(vec.l, vec.array, 1, array, 1);
}
void drovector::shallow_copy ( const _drovector vec) [inline]

make a shallow copy of the vector
This function is not desinged to be used in project codes.

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

References array, _drovector::array, cap, _drovector::cap, _drovector::l, l, and _drovector::nullify().

Referenced by operator=().

{VERBOSE_REPORT;
  l =vec.l;
  cap =vec.cap;
  delete [] array;
  array =vec.array;
  
  vec.nullify();
}
void drovector::alias ( const drovector vec) [inline]

make an alias of the vector
Be carefull to use this function not to cause double free.

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

References array, cap, and l.

{VERBOSE_REPORT;
  l =vec.l;
  cap =vec.cap;
  delete [] array;
  array =vec.array;
}
void drovector::unalias ( ) [inline]

unalias the vector

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

References array, cap, and l.

{VERBOSE_REPORT;
  l =0;
  cap =0;
  array =NULL;
}
drovector & drovector::resize ( const long &  _l,
const long  margin = 0 
) [inline]

resize vector

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

References array, cap, and l.

Referenced by dgematrix::dgels(), read(), and zgematrix::zgels().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( _l<0 || margin<0 ){
    ERROR_REPORT;
    std::cerr << "Vector size must be positive integers." << std::endl
              << "Your input was (" << _l << ", " << margin << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  l =_l;
  cap =l+margin;
  delete [] array;
  array =new double[cap];
  
  return *this;
}
void drovector::stretch ( const long &  dl) [inline]

stretch or shrink vector

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

References array, cap, and l.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( l+dl<0 ){
    ERROR_REPORT;
    std::cerr << "Vector size must be positive integers." << std::endl
              << "Your input was (" << dl << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  //////// zero ////////
  if(dl==0){ return; }
  
  //////// non-zero ////////
  l +=dl;

  if(l>cap){
    while(l>cap){
      cap++;
      cap*=2;
    }
    double* newArray(new double[cap]);
    dcopy_(l-dl, array, 1, newArray, 1);
    delete [] array;
    array =newArray;
  }
}
drovector & drovector::operator= ( const drovector vec) [inline]

drovector=drovector operator

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

References array, and copy().

{VERBOSE_REPORT;
  if(array!=vec.array){ // if it is NOT self substitution
    copy(vec);
  }
  return *this;
}
drovector & drovector::operator= ( const _drovector vec) [inline]

drovector=_drovector operator

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

References shallow_copy().

{VERBOSE_REPORT;
  shallow_copy(vec);
  return *this;
}
drovector & drovector::operator+= ( const drovector vec) [inline]

drovector+=drovector operator

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

References array, i(), and l.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( l!=vec.l ){
    ERROR_REPORT;
    std::cerr << "These two vectors can not make a sumation." << std::endl
              << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(long i=0; i<l; i++){ array[i]+=vec.array[i]; }
  
  return *this;
}
drovector & drovector::operator+= ( const _drovector vec) [inline]

drovector+=_drovector operator

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

References array, _drovector::array, _drovector::destroy(), i(), l, and _drovector::l.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( l!=vec.l ){
    ERROR_REPORT;
    std::cerr << "These two vectors can not make a sumation." << std::endl
              << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(long i=0; i<l; i++){ array[i]+=vec.array[i]; }
  
  vec.destroy();
  return *this;
}
drovector & drovector::operator-= ( const drovector vec) [inline]

drovector operator-=

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

References array, i(), and l.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( l!=vec.l ){
    ERROR_REPORT;
    std::cerr << "These two vectors can not make a subtraction." << std::endl
              << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(long i=0; i<l; i++){ array[i]-=vec.array[i]; }
  
  return *this;
}
drovector & drovector::operator-= ( const _drovector vec) [inline]

drovector operator-=

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

References array, _drovector::array, _drovector::destroy(), i(), l, and _drovector::l.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( l!=vec.l ){
    ERROR_REPORT;
    std::cerr << "These two vectors can not make a subtraction." << std::endl
              << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(long i=0; i<l; i++){ array[i]-=vec.array[i]; }
  
  vec.destroy();
  return *this;
}
drovector & drovector::operator*= ( const double &  d) [inline]

drovector*=double operator

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

References array, and l.

{VERBOSE_REPORT;
  dscal_(l, d, array, 1);
  return *this;
}
drovector & drovector::operator/= ( const double &  d) [inline]

drovector/=double operator

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

References array, and l.

{VERBOSE_REPORT;
  dscal_(l, 1./d, array, 1);
  return *this;
}

Friends And Related Function Documentation

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

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

{VERBOSE_REPORT;
  for(long i=0; i<vec.l; i++){ s << " " << vec.array[i]; }
  s << std::endl;
  
  return s;
}
_dcovector t ( const drovector rovec) [friend]

return a transposed column vector

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

{VERBOSE_REPORT;
  dcovector covec(rovec.l);
  dcopy_(rovec.l, rovec.array, 1, covec.array, 1);
  
  return _(covec);
}
double nrm2 ( const drovector vec) [friend]

return its Euclidean norm

Definition at line 13 of file drovector-calc.hpp.

{VERBOSE_REPORT;
  return dnrm2_(vec.l, vec.array, 1);
}
long idamax ( const drovector vec) [friend]

return the index of element having the largest absolute value in 0-based numbering system

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

{VERBOSE_REPORT;
  return idamax_(vec.l, vec.array, 1) -1;
}
double damax ( const drovector vec) [friend]

return its largest absolute value

Definition at line 28 of file drovector-calc.hpp.

{VERBOSE_REPORT;
  return vec.array[idamax_(vec.l, vec.array, 1) -1];
}
void swap ( drovector u,
drovector v 
) [friend]

swap two vectors

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

{VERBOSE_REPORT;
  long u_cap(u.cap), u_l(u.l);
  double* u_array(u.array);
  u.l=v.l; u.cap=v.cap; u.array=v.array;
  v.l=u_l; v.cap=u_cap; v.array=u_array;
}
_drovector _ ( drovector vec) [friend]

convert user object to smart-temporary object

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

Referenced by to_zrovector().

{VERBOSE_REPORT;
  _drovector newvec;
  
  //////// shallow copy ////////
  newvec.l =vec.l;
  newvec.cap =vec.cap;
  newvec.array =vec.array;
  
  //////// nullify ////////
  vec.l =0;
  vec.cap =0;
  vec.array =NULL;
  
  return newvec;
}
const drovector& operator+ ( const drovector vec) [friend]

+drovector operator

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

{VERBOSE_REPORT;
  return vec;
}
_drovector operator- ( const drovector vec) [friend]

-drovector operator

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

{VERBOSE_REPORT;
  drovector newvec(vec.l);
  for(long i=0; i<newvec.l; i++){ newvec.array[i]=-vec.array[i]; }
  
  return _(newvec);
}
_drovector operator+ ( const drovector vecA,
const drovector vecB 
) [friend]

drovector+drovector operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vecA.l!=vecB.l){
    ERROR_REPORT;
    std::cerr << "These two vectors can not make a sumation." << std::endl
              << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl;
    exit(1);
  }
  
#endif//CPPL_DEBUG
  
  drovector newvec(vecA.l);
  for(long i=0; i<newvec.l; i++){
    newvec.array[i] =vecA.array[i]+vecB.array[i];
  }
  
  return _(newvec);
}
_drovector operator+ ( const drovector vecA,
const _drovector vecB 
) [friend]

drovector+drovector operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vecA.l!=vecB.l){
    ERROR_REPORT;
    std::cerr << "These two vectors can not make a sumation." << std::endl
              << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl;
    exit(1);
  }
  
#endif//CPPL_DEBUG
  
  for(long i=0; i<vecA.l; i++){ vecB.array[i]+=vecA.array[i]; }
  
  return vecB;
}
_drovector operator- ( const drovector vecA,
const drovector vecB 
) [friend]

drovector-drovector operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vecA.l!=vecB.l){
    ERROR_REPORT;
    std::cerr << "These two vectors can not make a subtraction." << std::endl
              << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  drovector newvec(vecA.l);
  for(long i=0; i<newvec.l; i++){
    newvec.array[i] =vecA.array[i]-vecB.array[i];
  }
  
  return _(newvec);
}
_drovector operator- ( const drovector vecA,
const _drovector vecB 
) [friend]

drovector-drovector operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vecA.l!=vecB.l){
    ERROR_REPORT;
    std::cerr << "These two vectors can not make a subtraction." << std::endl
              << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(long i=0; i<vecA.l; i++){
    vecB.array[i] =vecA.array[i]-vecB.array[i];
  }
  
  return vecB;
}
double operator* ( const drovector rovec,
const dcovector covec 
) [friend]

drovector*dcovector operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(rovec.l!=covec.l){
    ERROR_REPORT;
    std::cerr << "These two vectors can not make a product." << std::endl
              << "Your input was (" << rovec.l << ") * (" << covec.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  double val( ddot_( rovec.l, rovec.array, 1, covec.array, 1 ) );
  
  return val;
}
double operator* ( const drovector rovec,
const _dcovector covec 
) [friend]

drovector*_dcovector operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(rovec.l!=covec.l){
    ERROR_REPORT;
    std::cerr << "These two vectors can not make a product." << std::endl
              << "Your input was (" << rovec.l << ") * (" << covec.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  double val( ddot_( rovec.l, rovec.array, 1, covec.array, 1 ) );
  
  covec.destroy();
  return val;
}
_drovector operator* ( const drovector vec,
const dgematrix mat 
) [friend]

drovector*dgematrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vec.l!=mat.m){
    ERROR_REPORT;
    std::cerr << "These vector and matrix can not make a product." << std::endl
              << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  drovector newvec(mat.n);
  dgemv_( 'T', mat.m, mat.n, 1.0, mat.array, mat.m,
          vec.array, 1, 0.0, newvec.array, 1 );
  
  return _(newvec);
}
_drovector operator* ( const drovector vec,
const _dgematrix mat 
) [friend]

drovector*_dgematrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vec.l!=mat.m){
    ERROR_REPORT;
    std::cerr << "These vector and matrix can not make a product." << std::endl
              << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  drovector newvec(mat.n);
  dgemv_( 'T', mat.m, mat.n, 1.0, mat.array, mat.m,
          vec.array, 1, 0.0, newvec.array, 1 );
  
  mat.destroy();
  return _(newvec);
}
_drovector operator* ( const drovector vec,
const dsymatrix mat 
) [friend]

drovector*dsymatrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vec.l!=mat.n){
    ERROR_REPORT;
    std::cerr << "These vector and matrix can not make a product." << std::endl
              << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  drovector newvec(mat.n);
  dsymv_( 'l', mat.n, 1.0, mat.array, mat.n, vec.array, 1, 0.0, newvec.array, 1 );
  
  return _(newvec);
}
_drovector operator* ( const drovector vec,
const _dsymatrix mat 
) [friend]

drovector*_dsymatrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vec.l!=mat.n){
    ERROR_REPORT;
    std::cerr << "These vector and matrix can not make a product." << std::endl
              << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  drovector newvec(mat.n);
  dsymv_( 'l', mat.n, 1.0, mat.array, mat.n,
          vec.array, 1, 0.0, newvec.array, 1 );
  
  mat.destroy();
  return _(newvec);
}
_drovector operator* ( const drovector vec,
const dgbmatrix mat 
) [friend]

drovector*dgbmatrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vec.l!=mat.m){
    ERROR_REPORT;
    std::cerr << "These vector and matrix can not make a product." << std::endl
              << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  drovector newvec(mat.n);
  dgbmv_( 'T', mat.m, mat.n, mat.kl, mat.ku, 1.0,
          mat.array, mat.kl+mat.ku+1, vec.array, 1, 0.0, newvec.array, 1 );
  
  return _(newvec);
}
_drovector operator* ( const drovector vec,
const _dgbmatrix mat 
) [friend]

drovector*_dgbmatrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vec.l!=mat.m){
    ERROR_REPORT;
    std::cerr << "These vector and matrix can not make a product." << std::endl
              << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  drovector newvec(mat.n);
  dgbmv_( 'T', mat.m, mat.n, mat.kl, mat.ku, 1.0,
          mat.array, mat.kl+mat.ku+1, vec.array, 1, 0.0, newvec.array, 1 );
  
  mat.destroy();
  return _(newvec);
}
_drovector operator* ( const drovector vec,
const dgsmatrix mat 
) [friend]

drovector*dgsmatrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vec.l!=mat.m){
    ERROR_REPORT;
    std::cerr << "These vector and matrix can not make a product." << std::endl
              << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  drovector newvec(mat.n);
  newvec.zero();
  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    newvec(it->j) += vec(it->i)*it->v;
  }
  
  return _(newvec);
}
_drovector operator* ( const drovector vec,
const _dgsmatrix mat 
) [friend]

drovector*_dgsmatrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vec.l!=mat.m){
    ERROR_REPORT;
    std::cerr << "These vector and matrix can not make a product." << std::endl
              << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  drovector newvec(mat.n);
  newvec.zero();
  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    newvec(it->j) += vec(it->i)*it->v;
  }
  
  mat.destroy();
  return _(newvec);
}
_drovector operator* ( const drovector vec,
const dssmatrix mat 
) [friend]

drovector*dssmatrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vec.l!=mat.n){
    ERROR_REPORT;
    std::cerr << "These vector and matrix can not make a product." << std::endl
              << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  drovector newvec(mat.n);
  newvec.zero();  
  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    newvec(it->j) += vec(it->i)*it->v;
    if(it->i!=it->j){
      newvec(it->i) +=vec(it->j)*it->v;
    }
  }
  
  return _(newvec);
}
_drovector operator* ( const drovector vec,
const _dssmatrix mat 
) [friend]

drovector*_dssmatrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vec.l!=mat.n){
    ERROR_REPORT;
    std::cerr << "These vector and matrix can not make a product." << std::endl
              << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  drovector newvec(mat.n);
  newvec.zero();
  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    newvec(it->j) += vec(it->i)*it->v;
    if(it->i!=it->j){
      newvec(it->i) += vec(it->j)*it->v;
    }
  }
  
  mat.destroy();
  return _(newvec);
}
_drovector operator* ( const drovector vec,
const double &  d 
) [friend]

drovector*double operator

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

{VERBOSE_REPORT;
  drovector newvec(vec.l);
  for(long i=0; i<vec.l; i++){ newvec.array[i] =vec.array[i]*d; }
  
  return _(newvec);
}
_drovector operator/ ( const drovector vec,
const double &  d 
) [friend]

drovector/double operator

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

{VERBOSE_REPORT;
  drovector newvec(vec.l);
  for(long i=0; i<vec.l; i++){ newvec.array[i] =vec.array[i]/d; }
  
  return _(newvec);
}
double operator% ( const drovector vecA,
const drovector vecB 
) [friend]

drovector^T*drovector operator (inner product)

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vecA.l!=vecB.l){
    ERROR_REPORT;
    std::cerr << "These two vectors can not make a dot product." << std::endl
              << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  double val( ddot_( vecA.l, vecA.array, 1, vecB.array, 1 ) );
  
  return val;
}
double operator% ( const drovector vecA,
const _drovector vecB 
) [friend]

drovector^T*drovector operator (inner product)

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(vecA.l!=vecB.l){
    ERROR_REPORT;
    std::cerr << "These two vectors can not make a dot product." << std::endl
              << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  double val( ddot_( vecA.l, vecA.array, 1, vecB.array, 1 ) );
  
  vecB.destroy();
  return val;
}
_drovector operator* ( const double &  d,
const drovector vec 
) [friend]

double*drovector operator

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

{VERBOSE_REPORT;
  drovector newvec(vec.l);
  for(long i=0; i<vec.l; i++){ newvec.array[i] =d*vec.array[i]; }  
  return _(newvec);
}

Member Data Documentation

vector capacity

Definition at line 10 of file drovector.hpp.

Referenced by _(), alias(), clear(), copy(), drovector(), resize(), shallow_copy(), stretch(), swap(), and unalias().


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Friends