CPPLapack
|
Complex Double-precision Row Vector Class. More...
#include <zrovector.hpp>
Complex Double-precision Row Vector Class.
Definition at line 3 of file zrovector.hpp.
zrovector::zrovector | ( | ) | [inline] |
zrovector::zrovector | ( | const zrovector & | vec | ) | [inline] |
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().
zrovector::zrovector | ( | const long & | _l | ) | [inline] |
zrovector constructor with size specification
Definition at line 35 of file zrovector-constructor.hpp.
zrovector::zrovector | ( | const char * | filename | ) | [inline] |
zrovector::~zrovector | ( | ) | [inline] |
zrovector destructor
Definition at line 67 of file zrovector-constructor.hpp.
References array.
{VERBOSE_REPORT; //////// delete array //////// delete [] array; }
comple & zrovector::operator() | ( | const long & | i | ) | [inline] |
operator() for non-const object
Definition at line 3 of file zrovector-io.hpp.
comple zrovector::operator() | ( | const long & | i | ) | const [inline] |
operator() for const object
Definition at line 19 of file zrovector-io.hpp.
zrovector & zrovector::set | ( | const long & | i, |
const comple & | v | ||
) | [inline] |
set value for const object
Definition at line 39 of file zrovector-io.hpp.
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] |
zrovector & zrovector::zero | ( | ) | [inline] |
void zrovector::chsign | ( | ) | [inline] |
void zrovector::copy | ( | const zrovector & | vec | ) | [inline] |
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=().
void zrovector::alias | ( | const zrovector & | vec | ) | [inline] |
void zrovector::unalias | ( | ) | [inline] |
void zrovector::resize | ( | const long & | _l | ) | [inline] |
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
Definition at line 17 of file zrovector-zrovector.hpp.
{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 operator-=
Definition at line 35 of file zrovector-zrovector.hpp.
{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 & zrovector::operator*= | ( | const comple & | d | ) | [inline] |
zrovector & zrovector::operator/= | ( | const double & | d | ) | [inline] |
zrovector & zrovector::operator/= | ( | const comple & | d | ) | [inline] |
std::ostream& operator<< | ( | std::ostream & | s, |
const zrovector & | vec | ||
) | [friend] |
_zcovector t | ( | const zrovector & | rovec | ) | [friend] |
_zrovector conj | ( | const zrovector & | vec | ) | [friend] |
_zcovector conjt | ( | const zrovector & | rovec | ) | [friend] |
return its Euclidean norm
Definition at line 43 of file zrovector-calc.hpp.
return the index of element having the largest absolute value in 0-based numbering system
Definition at line 51 of file zrovector-calc.hpp.
return its largest absolute value
Definition at line 58 of file zrovector-calc.hpp.
_zrovector _ | ( | zrovector & | vec | ) | [friend] |
convert user object to smart-temporary object
Definition at line 97 of file zrovector-misc.hpp.
+zrovector operator
Definition at line 3 of file zrovector-unary.hpp.
{VERBOSE_REPORT;
return vec;
}
_zrovector operator- | ( | const zrovector & | vec | ) | [friend] |
_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; }
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 operator* | ( | const zrovector & | vec, |
const comple & | d | ||
) | [friend] |
_zrovector operator/ | ( | const zrovector & | vec, |
const double & | d | ||
) | [friend] |
_zrovector operator/ | ( | const zrovector & | vec, |
const comple & | d | ||
) | [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] |
_zrovector operator* | ( | const comple & | d, |
const zrovector & | vec | ||
) | [friend] |
long zrovector::l |
vector size
Definition at line 9 of file zrovector.hpp.
Referenced by _(), alias(), chsign(), clear(), conj(), conjt(), copy(), damax(), idamax(), nrm2(), operator%(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), read(), resize(), set(), shallow_copy(), swap(), t(), unalias(), write(), zero(), zrovector(), and zrovector_small< l >::zrovector_small().
comple* zrovector::array |
1D array to store vector data
Definition at line 10 of file zrovector.hpp.
Referenced by _(), alias(), chsign(), clear(), copy(), damax(), idamax(), nrm2(), operator%(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), operator=(), resize(), set(), shallow_copy(), swap(), t(), _drovector::to_zrovector(), drovector::to_zrovector(), unalias(), zero(), zrovector(), zrovector_small< l >::zrovector_small(), and ~zrovector().