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

Complex Double-precision Row Vector Class. More...

#include <zrovector.hpp>

List of all members.

Public Member Functions

 zrovector ()
 zrovector (const zrovector &)
 zrovector (const _zrovector &)
 zrovector (const long &)
 zrovector (const char *)
 ~zrovector ()
comple & operator() (const long &)
comple operator() (const long &) const
zrovectorset (const long &, const comple &)
void write (const char *) const
void read (const char *)
void clear ()
zrovectorzero ()
void chsign ()
void copy (const zrovector &)
void shallow_copy (const _zrovector &)
void alias (const zrovector &)
void unalias ()
void resize (const long &)
zrovectoroperator= (const zrovector &)
zrovectoroperator= (const _zrovector &)
zrovectoroperator+= (const zrovector &)
zrovectoroperator+= (const _zrovector &)
zrovectoroperator-= (const zrovector &)
zrovectoroperator-= (const _zrovector &)
zrovectoroperator*= (const double &)
zrovectoroperator*= (const comple &)
zrovectoroperator/= (const double &)
zrovectoroperator/= (const comple &)

Public Attributes

long l
 vector size
comple * array
 1D array to store vector data

Friends

std::ostream & operator<< (std::ostream &, const zrovector &)
_zcovector t (const zrovector &)
_zrovector conj (const zrovector &)
_zcovector conjt (const zrovector &)
double nrm2 (const zrovector &)
long idamax (const zrovector &)
comple damax (const zrovector &)
void swap (zrovector &, zrovector &)
_zrovector _ (zrovector &)
const zrovectoroperator+ (const zrovector &)
_zrovector operator- (const zrovector &)
_zrovector operator+ (const zrovector &, const zrovector &)
_zrovector operator+ (const zrovector &, const _zrovector &)
_zrovector operator- (const zrovector &, const zrovector &)
_zrovector operator- (const zrovector &, const _zrovector &)
comple operator* (const zrovector &, const zcovector &)
comple operator* (const zrovector &, const _zcovector &)
_zrovector operator* (const zrovector &, const zgematrix &)
_zrovector operator* (const zrovector &, const _zgematrix &)
_zrovector operator* (const zrovector &, const zhematrix &)
_zrovector operator* (const zrovector &, const _zhematrix &)
_zrovector operator* (const zrovector &, const zgbmatrix &)
_zrovector operator* (const zrovector &, const _zgbmatrix &)
_zrovector operator* (const zrovector &, const zgsmatrix &)
_zrovector operator* (const zrovector &, const _zgsmatrix &)
_zrovector operator* (const zrovector &, const zhsmatrix &)
_zrovector operator* (const zrovector &, const _zhsmatrix &)
_zrovector operator* (const zrovector &, const double &)
_zrovector operator* (const zrovector &, const comple &)
_zrovector operator/ (const zrovector &, const double &)
_zrovector operator/ (const zrovector &, const comple &)
comple operator% (const zrovector &, const zrovector &)
comple operator% (const zrovector &, const _zrovector &)
_zrovector operator* (const double &, const zrovector &)
_zrovector operator* (const comple &, const zrovector &)

Detailed Description

Complex Double-precision Row Vector Class.

Definition at line 3 of file zrovector.hpp.


Constructor & Destructor Documentation

zrovector::zrovector ( ) [inline]

zrovector constructor

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

References array, and l.

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

zrovector copy constructor

Definition at line 12 of file zrovector-constructor.hpp.

References array, and l.

{VERBOSE_REPORT;
  //////// initialize ////////
  l =vec.l;
  array =new comple[l];
  
  //////// copy ////////
  zcopy_(l, vec.array, 1, array, 1);
}
zrovector::zrovector ( const _zrovector vec) [inline]

zrovector constructor to cast _zrovector

Definition at line 24 of file zrovector-constructor.hpp.

References array, _zrovector::array, _zrovector::l, l, and _zrovector::nullify().

{VERBOSE_REPORT;
  //////// initialize ////////
  l =vec.l;
  array =vec.array;
  
  vec.nullify();
}
zrovector::zrovector ( const long &  _l) [inline]

zrovector constructor with size specification

Definition at line 35 of file zrovector-constructor.hpp.

References array, and l.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( _l<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;
  array =new comple[l];
}
zrovector::zrovector ( const char *  filename) [inline]

zrovector constructor with filename

Definition at line 53 of file zrovector-constructor.hpp.

References array, and read().

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

zrovector destructor

Definition at line 67 of file zrovector-constructor.hpp.

References array.

{VERBOSE_REPORT;
  //////// delete array ////////
  delete [] array;
}

Member Function Documentation

comple & zrovector::operator() ( const long &  i) [inline]

operator() for non-const object

Definition at line 3 of file zrovector-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];
}
comple zrovector::operator() ( const long &  i) const [inline]

operator() for const object

Definition at line 19 of file zrovector-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];
}
zrovector & zrovector::set ( const long &  i,
const comple &  v 
) [inline]

set value for const object

Definition at line 39 of file zrovector-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 zrovector::write ( const char *  filename) const [inline]

Definition at line 72 of file zrovector-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 << "#zrovector" << " " << l << std::endl;
  for(long i=0; i<l; i++){
    ofs << operator()(i) << " ";
  }
  ofs << std::endl;
  
  ofs.close();
}
void zrovector::read ( const char *  filename) [inline]

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

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

Referenced by zrovector().

{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 != "zrovector" && id != "#zrovector" ){
    ERROR_REPORT;
    std::cerr << "The type name of the file \"" << filename << "\" is not zrovector." << 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 not enough 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 zrovector::clear ( ) [inline]

clear vector

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

References array, and l.

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

make vector into zero vector

Definition at line 12 of file zrovector-misc.hpp.

References array, i(), and l.

Referenced by operator*().

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

change sign(+/-) of the vector

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

References array, i(), and l.

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

make a deep copy of the zrovector

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

References array, and l.

Referenced by operator=().

{VERBOSE_REPORT;
  delete [] array;
  l =vec.l;
  array =new comple[vec.l];
  zcopy_(vec.l, vec.array, 1, array, 1);
}
void zrovector::shallow_copy ( const _zrovector vec) [inline]

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

Definition at line 38 of file zrovector-misc.hpp.

References array, _zrovector::array, _zrovector::l, l, and _zrovector::nullify().

Referenced by operator=().

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

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

Definition at line 50 of file zrovector-misc.hpp.

References array, and l.

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

unalias the vector

Definition at line 60 of file zrovector-misc.hpp.

References array, and l.

{VERBOSE_REPORT;
  l =0;
  //cap =0;
  array =NULL;
}
void zrovector::resize ( const long &  _l) [inline]

resize vector

Definition at line 69 of file zrovector-misc.hpp.

References array, and l.

Referenced by read().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( _l<0 ){
    ERROR_REPORT;
    std::cerr << "Vector size must be positive integers." << std::endl
              << "Your input was (" << _l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  l =_l;
  delete [] array;
  array =new comple[_l];
}
zrovector & zrovector::operator= ( const zrovector vec) [inline]

zrovector=zrovector operator

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

References array, and copy().

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

zrovector=_zrovector operator

Definition at line 3 of file zrovector-_zrovector.hpp.

References shallow_copy().

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

zrovector+=zrovector operator

Definition at line 17 of file zrovector-zrovector.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;
}
zrovector & zrovector::operator+= ( const _zrovector vec) [inline]

zrovector+=_zrovector operator

Definition at line 15 of file zrovector-_zrovector.hpp.

References array, _zrovector::array, _zrovector::destroy(), i(), l, and _zrovector::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;
}
zrovector & zrovector::operator-= ( const zrovector vec) [inline]

zrovector operator-=

Definition at line 35 of file zrovector-zrovector.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;
}
zrovector & zrovector::operator-= ( const _zrovector vec) [inline]

zrovector operator-=

Definition at line 34 of file zrovector-_zrovector.hpp.

References array, _zrovector::array, _zrovector::destroy(), i(), l, and _zrovector::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;
}
zrovector & zrovector::operator*= ( const double &  d) [inline]

zrovector*=double operator

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

References array, and l.

{VERBOSE_REPORT;
  zdscal_(l, d, array, 1);
  return *this;
}
zrovector & zrovector::operator*= ( const comple &  d) [inline]

zrovector*=comple operator

Definition at line 3 of file zrovector-complex.hpp.

References array, and l.

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

zrovector/=double operator

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

References array, and l.

{VERBOSE_REPORT;
  zdscal_(l, 1./d, array, 1);
  return *this;
}
zrovector & zrovector::operator/= ( const comple &  d) [inline]

zrovector/=comple operator

Definition at line 11 of file zrovector-complex.hpp.

References array, and l.

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

Friends And Related Function Documentation

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

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

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

return a transposed column vector

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

{VERBOSE_REPORT;
  zcovector covec(rovec.l);
  zcopy_(rovec.l, rovec.array, 1, covec.array, 1);
  
  return _(covec);
}
_zrovector conj ( const zrovector vec) [friend]

return its conjugated vector

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

{VERBOSE_REPORT;
  zrovector newvec(vec.l);
  
  for(long i=0; i<vec.l; i++){
    newvec(i) =std::conj(vec(i));
  }
  
  return _(newvec);
}
_zcovector conjt ( const zrovector rovec) [friend]

return a conjugate transposed column vector

Definition at line 26 of file zrovector-calc.hpp.

{VERBOSE_REPORT;
  zcovector covec(rovec.l);
  
  for(long i=0; i<rovec.l; i++){
    covec(i) =std::conj(rovec(i));
  }
  
  return _(covec);
}
double nrm2 ( const zrovector vec) [friend]

return its Euclidean norm

Definition at line 43 of file zrovector-calc.hpp.

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

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

Definition at line 51 of file zrovector-calc.hpp.

{VERBOSE_REPORT;
  return izamax_(vec.l, vec.array, 1) -1;
}
comple damax ( const zrovector vec) [friend]

return its largest absolute value

Definition at line 58 of file zrovector-calc.hpp.

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

swap two vectors

Definition at line 87 of file zrovector-misc.hpp.

{VERBOSE_REPORT;
  long u_L(u.l);
  comple* u_Array(u.array);
  u.l=v.l; u.array=v.array;
  v.l=u_L; v.array=u_Array;
}
_zrovector _ ( zrovector vec) [friend]

convert user object to smart-temporary object

Definition at line 97 of file zrovector-misc.hpp.

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

+zrovector operator

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

{VERBOSE_REPORT;
  return vec;
}
_zrovector operator- ( const zrovector vec) [friend]

-zrovector operator

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

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

zrovector+zrovector operator

Definition at line 57 of file zrovector-zrovector.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
  
  zrovector newvec(vecA.l);
  for(long i=0; i<newvec.l; i++){
    newvec.array[i] =vecA.array[i]+vecB.array[i];
  }
  
  return _(newvec);
}
_zrovector operator+ ( const zrovector vecA,
const _zrovector vecB 
) [friend]

zrovector+zrovector operator

Definition at line 57 of file zrovector-_zrovector.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;
}
_zrovector operator- ( const zrovector vecA,
const zrovector vecB 
) [friend]

zrovector-zrovector operator

Definition at line 79 of file zrovector-zrovector.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
  
  zrovector newvec(vecA.l);
  for(long i=0; i<newvec.l; i++){
    newvec.array[i] =vecA.array[i]-vecB.array[i];
  }
  
  return _(newvec);
}
_zrovector operator- ( const zrovector vecA,
const _zrovector vecB 
) [friend]

zrovector-zrovector operator

Definition at line 76 of file zrovector-_zrovector.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;
}
comple operator* ( const zrovector rovec,
const zcovector covec 
) [friend]

zrovector*zcovector operator

Definition at line 3 of file zrovector-zcovector.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
  
  comple val( zdotu_( rovec.l, rovec.array, 1, covec.array, 1 ) );
  
  return val;
}
comple operator* ( const zrovector rovec,
const _zcovector covec 
) [friend]

zrovector*_zcovector operator

Definition at line 3 of file zrovector-_zcovector.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
  
  comple val( zdotu_( rovec.l, rovec.array, 1, covec.array, 1 ) );
  
  covec.destroy();
  return val;
}
_zrovector operator* ( const zrovector vec,
const zgematrix mat 
) [friend]

zrovector*zgematrix operator

Definition at line 3 of file zrovector-zgematrix.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
  
  zrovector newvec(mat.n);
  zgemv_( 'T', mat.m, mat.n, comple(1.0,0.0), mat.array, mat.m,
          vec.array, 1, comple(0.0,0.0), newvec.array, 1 );
  
  return _(newvec);
}
_zrovector operator* ( const zrovector vec,
const _zgematrix mat 
) [friend]

zrovector*_zgematrix operator

Definition at line 3 of file zrovector-_zgematrix.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
  
  zrovector newvec(mat.n);
  zgemv_( 'T', mat.m, mat.n, comple(1.0,0.0), mat.array, mat.m,
          vec.array, 1, comple(0.0,0.0), newvec.array, 1 );
  
  mat.destroy();
  return _(newvec);
}
_zrovector operator* ( const zrovector vec,
const zhematrix mat 
) [friend]

zrovector*zhematrix operator

Definition at line 3 of file zrovector-zhematrix.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
  
  zrovector newvec(mat.n);
  zhemv_( 'l', mat.n, comple(1.0,0.0), mat.array, mat.n,
          vec.array, 1, comple(0.0,0.0), newvec.array, 1 );
  
  return _(newvec);
}
_zrovector operator* ( const zrovector vec,
const _zhematrix mat 
) [friend]

zrovector*_zhematrix operator

Definition at line 3 of file zrovector-_zhematrix.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
  
  zrovector newvec(mat.n);
  zhemv_( 'l', mat.n, comple(1.0,0.0), mat.array, mat.n,
          vec.array, 1, comple(0.0,0.0), newvec.array, 1 );
  
  mat.destroy();
  return _(newvec);
}
_zrovector operator* ( const zrovector vec,
const zgbmatrix mat 
) [friend]

zrovector*zgbmatrix operator

Definition at line 3 of file zrovector-zgbmatrix.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
  
  zrovector newvec(mat.n);
  zgbmv_( 'T', mat.m, mat.n, mat.kl, mat.ku, comple(1.0,0.0),
          mat.array, mat.kl+mat.ku+1, vec.array, 1, comple(0.0,0.0), newvec.array, 1 );
  
  return _(newvec);
}
_zrovector operator* ( const zrovector vec,
const _zgbmatrix mat 
) [friend]

zrovector*_zgbmatrix operator

Definition at line 3 of file zrovector-_zgbmatrix.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
  
  zrovector newvec(mat.n);
  zgbmv_( 'T', mat.m, mat.n, mat.kl, mat.ku, comple(1.0,0.0),
          mat.array, mat.kl+mat.ku+1, vec.array, 1, comple(0.0,0.0), newvec.array, 1 );
  
  mat.destroy();
  return _(newvec);
}
_zrovector operator* ( const zrovector vec,
const zgsmatrix mat 
) [friend]

zrovector*zgsmatrix operator

Definition at line 3 of file zrovector-zgsmatrix.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
  
  zrovector newvec(mat.n);
  newvec.zero();
  
  for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    newvec(it->j) += vec(it->i)*it->v;
  }
  
  return _(newvec);
}
_zrovector operator* ( const zrovector vec,
const _zgsmatrix mat 
) [friend]

zrovector*_zgsmatrix operator

Definition at line 3 of file zrovector-_zgsmatrix.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
  
  zrovector newvec(mat.n);
  newvec.zero();
  
  for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    newvec(it->j) += vec(it->i)*it->v;
  }
  
  mat.destroy();
  return _(newvec);
}
_zrovector operator* ( const zrovector vec,
const zhsmatrix mat 
) [friend]

zrovector*zhsmatrix operator

Definition at line 3 of file zrovector-zhsmatrix.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
  
  zrovector newvec(mat.n);
  newvec.zero();
  
  for(std::vector<zcomponent>::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)*std::conj(it->v);
    }
  }
  
  return _(newvec);
}
_zrovector operator* ( const zrovector vec,
const _zhsmatrix mat 
) [friend]

zrovector*_zhsmatrix operator

Definition at line 3 of file zrovector-_zhsmatrix.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
  
  zrovector newvec(mat.n);
  newvec.zero();
  
  for(std::vector<zcomponent>::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)*std::conj(it->v);
    }
  }
  
  mat.destroy();
  return _(newvec);
}
_zrovector operator* ( const zrovector vec,
const double &  d 
) [friend]

zrovector*double operator

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

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

zrovector*comple operator

Definition at line 23 of file zrovector-complex.hpp.

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

zrovector/double operator

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

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

zrovector/comple operator

Definition at line 33 of file zrovector-complex.hpp.

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

zrovector^T*zrovector operator (inner product)

Definition at line 100 of file zrovector-zrovector.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
  
  comple val( zdotu_( vecA.l, vecA.array, 1, vecB.array, 1 ) );  
  return val;
}
comple operator% ( const zrovector vecA,
const _zrovector vecB 
) [friend]

zrovector^T*zrovector operator (inner product)

Definition at line 96 of file zrovector-_zrovector.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
  
  comple val( zdotu_( vecA.l, vecA.array, 1, vecB.array, 1 ) );
  
  vecB.destroy();
  return val;
}
_zrovector operator* ( const double &  d,
const zrovector vec 
) [friend]

double*zrovector operator

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

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

comple*zrovector operator

Definition at line 3 of file complex-zrovector.hpp.

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

Member Data Documentation


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