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

(DO NOT USE) Smart-temporary Complex Double-precision Column Vector Class More...

#include <_zcovector.hpp>

List of all members.

Public Member Functions

 _zcovector ()
 _zcovector (const _zcovector &)
 ~_zcovector ()
comple & operator() (const long &) const
void write (const char *) const
void nullify () const
void destroy () const

Public Attributes

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

Friends

std::ostream & operator<< (std::ostream &, const _zcovector &)
_zrovector t (const _zcovector &)
_zcovector conj (const _zcovector &)
_zrovector conjt (const _zcovector &)
double nrm2 (const _zcovector &)
long idamax (const _zcovector &)
comple damax (const _zcovector &)
const _zcovectoroperator+ (const _zcovector &)
_zcovector operator- (const _zcovector &)
_zcovector operator+ (const _zcovector &, const zcovector &)
_zcovector operator+ (const _zcovector &, const _zcovector &)
_zcovector operator- (const _zcovector &, const zcovector &)
_zcovector operator- (const _zcovector &, const _zcovector &)
_zgematrix operator* (const _zcovector &, const zrovector &)
_zgematrix operator* (const _zcovector &, const _zrovector &)
_zcovector operator* (const _zcovector &, const double &)
_zcovector operator* (const _zcovector &, const comple &)
_zcovector operator/ (const _zcovector &, const double &)
_zcovector operator/ (const _zcovector &, const comple &)
comple operator% (const _zcovector &, const zcovector &)
comple operator% (const _zcovector &, const _zcovector &)
_zcovector operator* (const double &, const _zcovector &)
_zcovector operator* (const comple &, const _zcovector &)

Detailed Description

(DO NOT USE) Smart-temporary Complex Double-precision Column Vector Class

Definition at line 3 of file _zcovector.hpp.


Constructor & Destructor Documentation

_zcovector::_zcovector ( ) [inline]

_zcovector constructor

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

References array, and l.

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

_zcovector copy constructor

Definition at line 11 of file _zcovector-constructor.hpp.

References array, l, and nullify().

{VERBOSE_REPORT;
  l =vec.l;
  array =vec.array;
  
  vec.nullify();
}

_zcovector destructor

Definition at line 25 of file _zcovector-constructor.hpp.

References array.

{VERBOSE_REPORT;
  delete [] array;
}

Member Function Documentation

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

operator() for const object

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

References array, i(), and l.

Referenced by 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];
}
void _zcovector::write ( const char *  filename) const [inline]

Definition at line 37 of file _zcovector-io.hpp.

References destroy(), 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 << "#zcovector" << " " << l << std::endl;
  for(long i=0; i<l; i++){
    ofs << operator()(i) << std::endl;
  }
  
  ofs.close();
  destroy();
}
void _zcovector::nullify ( ) const [inline]

nullify all the vector data

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

References array, and l.

Referenced by _zcovector(), zcovector::shallow_copy(), and zcovector::zcovector().

{VERBOSE_REPORT;
  l=0;
  array=NULL;
}
void _zcovector::destroy ( ) const [inline]

destroy all the vector data

Definition at line 11 of file _zcovector-misc.hpp.

References array.

Referenced by conjt(), damax(), idamax(), nrm2(), operator%(), operator*(), operator+(), zcovector::operator+=(), operator-(), zcovector::operator-=(), operator<<(), and write().

{VERBOSE_REPORT;
  delete [] array;
  array=NULL;
}

Friends And Related Function Documentation

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

Definition at line 22 of file _zcovector-io.hpp.

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

return a transposed row vector

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

{VERBOSE_REPORT;
  _zrovector rovec;
  rovec.l =covec.l;
  delete [] rovec.array;
  rovec.array =covec.array;
  
  return rovec;
}
_zcovector conj ( const _zcovector vec) [friend]

return its conjugated vector

Definition at line 15 of file _zcovector-calc.hpp.

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

return a conjugate transposed row vector

Definition at line 23 of file _zcovector-calc.hpp.

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

return its Euclidean norm

Definition at line 38 of file _zcovector-calc.hpp.

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

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

Definition at line 48 of file _zcovector-calc.hpp.

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

return its largest absolute value

Definition at line 57 of file _zcovector-calc.hpp.

{VERBOSE_REPORT;
  comple val( vec.array[izamax_(vec.l, vec.array, 1)-1] );
  vec.destroy();
  return val;
}
const _zcovector& operator+ ( const _zcovector vec) [friend]

+_zcovector operator

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

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

-_zcovector operator

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

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

_zcovector+zcovector operator

Definition at line 3 of file _zcovector-zcovector.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++){ vecA.array[i]+=vecB.array[i]; }
  
  return vecA;
}
_zcovector operator+ ( const _zcovector vecA,
const _zcovector vecB 
) [friend]

_zcovector+_zcovector operator

Definition at line 3 of file _zcovector-_zcovector.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++){ vecA.array[i]+=vecB.array[i]; }
  
  vecB.destroy();
  return vecA;
}
_zcovector operator- ( const _zcovector vecA,
const zcovector vecB 
) [friend]

zcovector-zcovector operator

Definition at line 22 of file _zcovector-zcovector.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++){ vecA.array[i]-=vecB.array[i]; }
  
  return vecA;
}
_zcovector operator- ( const _zcovector vecA,
const _zcovector vecB 
) [friend]

_zcovector-_zcovector operator

Definition at line 23 of file _zcovector-_zcovector.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++){ vecA.array[i]-=vecB.array[i]; }
  
  vecB.destroy();
  return vecA;
}
_zgematrix operator* ( const _zcovector covec,
const zrovector rovec 
) [friend]

_zcovector*zrovector operator

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

{VERBOSE_REPORT;
  zgematrix newmat(covec.l, rovec.l);
  for(long i=0; i<newmat.m; i++){
    for(long j=0; j<newmat.n; j++){
      newmat(i,j) =covec(i)*rovec(j);
    }
  }
  
  covec.destroy();
  return _(newmat);
}
_zgematrix operator* ( const _zcovector covec,
const _zrovector rovec 
) [friend]

_zcovector*_zrovector operator

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

{VERBOSE_REPORT;
  zgematrix newmat(covec.l, rovec.l);
  for(long i=0; i<newmat.m; i++){
    for(long j=0; j<newmat.n; j++){
      newmat(i,j) =covec(i)*rovec(j);
    }
  }
  
  covec.destroy();
  rovec.destroy();
  return _(newmat);
}
_zcovector operator* ( const _zcovector vec,
const double &  d 
) [friend]

_zcovector*double operator

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

{VERBOSE_REPORT;
  zdscal_(vec.l, d, vec.array, 1);
  return vec;
}
_zcovector operator* ( const _zcovector vec,
const comple &  d 
) [friend]

_zcovector*comple operator

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

{VERBOSE_REPORT;
  zscal_(vec.l, d, vec.array, 1);
  return vec;
}
_zcovector operator/ ( const _zcovector vec,
const double &  d 
) [friend]

_zcovector/double operator

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

{VERBOSE_REPORT;
  zdscal_(vec.l, 1./d, vec.array, 1);
  return vec;
}
_zcovector operator/ ( const _zcovector vec,
const comple &  d 
) [friend]

_zcovector/comple operator

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

{VERBOSE_REPORT;
  zscal_(vec.l, 1./d, vec.array, 1);
  return vec;
}
comple operator% ( const _zcovector vecA,
const zcovector vecB 
) [friend]

zcovector^T*zcovector operator (inner product)

Definition at line 40 of file _zcovector-zcovector.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 ) );
  
  vecA.destroy();
  return val;
}
comple operator% ( const _zcovector vecA,
const _zcovector vecB 
) [friend]

_zcovector^T*_zcovector operator (inner product)

Definition at line 42 of file _zcovector-_zcovector.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 ) );
  
  vecA.destroy();
  vecB.destroy();
  return val;
}
_zcovector operator* ( const double &  d,
const _zcovector vec 
) [friend]

double*_zcovector operator

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

{VERBOSE_REPORT;
  zdscal_(vec.l, d, vec.array, 1);
  return vec;
}
_zcovector operator* ( const comple &  d,
const _zcovector vec 
) [friend]

comple*_zcovector operator

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

{VERBOSE_REPORT;
  zscal_(vec.l, d, vec.array, 1);  
  return vec;
}

Member Data Documentation

long _zcovector::l [mutable]
comple* _zcovector::array [mutable]

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