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

(DO NOT USE) Smart-temporary Real Double-precision General Sparse Matrix Class More...

#include <_zgsmatrix.hpp>

List of all members.

Public Member Functions

 _zgsmatrix ()
 _zgsmatrix (const _zgsmatrix &)
 ~_zgsmatrix ()
_zgematrix to_zgematrix () const
comple operator() (const long &, const long &) const
void write (const char *) const
void nullify () const
void destroy () const

Public Attributes

long m
 matrix row size
long n
 matrix column size
std::vector< zcomponentdata
 matrix data
std::vector< std::vector
< uint32_t > > 
rows
 array of vector to store the entry information of component for each row
std::vector< std::vector
< uint32_t > > 
cols
 array of vector to store the entry information of component for each column

Friends

std::ostream & operator<< (std::ostream &, const _zgsmatrix &)
_zgsmatrix t (const zgsmatrix &)
void idamax (long &, long &, const zgsmatrix &)
comple damax (const zgsmatrix &)
const _zgsmatrixoperator+ (const _zgsmatrix &)
_zgsmatrix operator- (const _zgsmatrix &)
_zgematrix operator+ (const _zgsmatrix &, const zgematrix &)
_zgematrix operator+ (const _zgsmatrix &, const _zgematrix &)
_zgematrix operator+ (const _zgsmatrix &, const zhematrix &)
_zgematrix operator+ (const _zgsmatrix &, const _zhematrix &)
_zgematrix operator+ (const _zgsmatrix &, const zgbmatrix &)
_zgematrix operator+ (const _zgsmatrix &, const _zgbmatrix &)
_zgsmatrix operator+ (const _zgsmatrix &, const zgsmatrix &)
_zgsmatrix operator+ (const _zgsmatrix &, const _zgsmatrix &)
_zgsmatrix operator+ (const _zgsmatrix &, const zhsmatrix &)
_zgsmatrix operator+ (const _zgsmatrix &, const _zhsmatrix &)
_zgematrix operator- (const _zgsmatrix &, const zgematrix &)
_zgematrix operator- (const _zgsmatrix &, const _zgematrix &)
_zgematrix operator- (const _zgsmatrix &, const zhematrix &)
_zgematrix operator- (const _zgsmatrix &, const _zhematrix &)
_zgematrix operator- (const _zgsmatrix &, const zgbmatrix &)
_zgematrix operator- (const _zgsmatrix &, const _zgbmatrix &)
_zgsmatrix operator- (const _zgsmatrix &, const zgsmatrix &)
_zgsmatrix operator- (const _zgsmatrix &, const _zgsmatrix &)
_zgsmatrix operator- (const _zgsmatrix &, const zhsmatrix &)
_zgsmatrix operator- (const _zgsmatrix &, const _zhsmatrix &)
_zcovector operator* (const _zgsmatrix &, const zcovector &)
_zcovector operator* (const _zgsmatrix &, const _zcovector &)
_zgematrix operator* (const _zgsmatrix &, const zgematrix &)
_zgematrix operator* (const _zgsmatrix &, const _zgematrix &)
_zgematrix operator* (const _zgsmatrix &, const zhematrix &)
_zgematrix operator* (const _zgsmatrix &, const _zhematrix &)
_zgematrix operator* (const _zgsmatrix &, const zgbmatrix &)
_zgematrix operator* (const _zgsmatrix &, const _zgbmatrix &)
_zgsmatrix operator* (const _zgsmatrix &, const zgsmatrix &)
_zgsmatrix operator* (const _zgsmatrix &, const _zgsmatrix &)
_zgsmatrix operator* (const _zgsmatrix &, const zhsmatrix &)
_zgsmatrix operator* (const _zgsmatrix &, const _zhsmatrix &)
_zgsmatrix operator* (const _zgsmatrix &, const double &)
_zgsmatrix operator* (const _zgsmatrix &, const comple &)
_zgsmatrix operator/ (const _zgsmatrix &, const double &)
_zgsmatrix operator/ (const _zgsmatrix &, const comple &)
_zgsmatrix operator* (const double &, const _zgsmatrix &)
_zgsmatrix operator* (const comple &, const _zgsmatrix &)

Detailed Description

(DO NOT USE) Smart-temporary Real Double-precision General Sparse Matrix Class

Definition at line 3 of file _zgsmatrix.hpp.


Constructor & Destructor Documentation

_zgsmatrix::_zgsmatrix ( ) [inline]

_zgsmatrix constructor without arguments

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

References cols, data, m, n, and rows.

{VERBOSE_REPORT;
  //////// initialize ////////
  m =0;
  n =0;
  data.clear();
  rows.clear();
  cols.clear();
}
_zgsmatrix::_zgsmatrix ( const _zgsmatrix mat) [inline]

_zgsmatrix copy constructor

Definition at line 15 of file _zgsmatrix-constructor.hpp.

References cols, data, m, n, nullify(), and rows.

{VERBOSE_REPORT;
  //////// initialize ////////
  m =mat.m;
  n =mat.n;
  data.swap(mat.data);
  rows.swap(mat.rows);
  cols.swap(mat.cols);
  
  mat.nullify();
}

_zgsmatrix destructor

Definition at line 33 of file _zgsmatrix-constructor.hpp.

References cols, data, and rows.

{VERBOSE_REPORT;
  data.clear();
  rows.clear();
  cols.clear();
}

Member Function Documentation

convert to _zgematrix

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

References _(), data, destroy(), m, n, and zgematrix::zero().

Referenced by operator+(), and operator-().

{VERBOSE_REPORT;
  zgematrix newmat(m,n);
  newmat.zero();
  
  for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){
    newmat(it->i,it->j) = it->v;
  }
  
  destroy();
  return _(newmat);
}
comple _zgsmatrix::operator() ( const long &  i,
const long &  j 
) const [inline]

operator() for const object

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

References data, i(), m, n, and rows.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( i<0 || j<0 || m<=i || n<=j ){
    ERROR_REPORT;
    std::cerr << "The required component is out of the matrix size." << std::endl
              << "Your input was (" << i << "," << j << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  //////// search (i,j) component ////////
  for(std::vector<uint32_t>::iterator p=rows[i].begin(); p!=rows[i].end(); p++){
    if( long(data[*p].j)==j ){ return data[*p].v; }
  }
  
  //////// (i,j) component was not found ////////
  return comple(0.0,0.0);
}
void _zgsmatrix::write ( const char *  filename) const [inline]

Definition at line 51 of file _zgsmatrix-io.hpp.

References data, destroy(), m, and n.

{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 << "#zgsmatrix" << " " << m << " " << n << std::endl;
  for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){
    ofs << it->i << " " << it->j << " " << it->v << std::endl;
  }
  
  ofs.close();
  destroy();
}
void _zgsmatrix::nullify ( ) const [inline]

nullify all the matrix data

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

References cols, data, m, n, and rows.

Referenced by _zgsmatrix(), zgsmatrix::shallow_copy(), and zgsmatrix::zgsmatrix().

{VERBOSE_REPORT;
  m=0;
  n=0;
  data.clear();
  rows.clear();
  cols.clear();
}
void _zgsmatrix::destroy ( ) const [inline]

destroy all the matrix data

Definition at line 14 of file _zgsmatrix-misc.hpp.

References cols, data, and rows.

Referenced by damax(), idamax(), operator*(), zgsmatrix::operator*=(), operator+(), zgsmatrix::operator+=(), operator-(), zgsmatrix::operator-=(), operator<<(), to_zgematrix(), and write().

{VERBOSE_REPORT;
  data.clear();
  rows.clear();
  cols.clear();
}

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const _zgsmatrix mat 
) [friend]

Definition at line 28 of file _zgsmatrix-io.hpp.

{VERBOSE_REPORT;
  for(long i=0; i<mat.m; i++){
    for(long j=0; j<mat.n; j++){
      std::vector<uint32_t>::iterator q;
      for(q=mat.rows[i].begin(); q!=mat.rows[i].end(); q++){
        if( long(mat.data[*q].j)==j ){ break; }
      }
      if(q!=mat.rows[i].end()){ s << " " << mat.data[*q].v; }
      else{ s << " x"; }
    }
    s << std::endl;
  }
  
  mat.destroy();
  return s;
}
_zgsmatrix t ( const zgsmatrix mat) [friend]

return transposed zgsmatrix

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

{VERBOSE_REPORT;
  zgsmatrix newmat(mat);
  std::swap(newmat.rows,newmat.cols);
  
  for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat.data.end(); it++){
    std::swap(it->i,it->j);
  }
  
  return _(newmat);
}
void idamax ( long &  i,
long &  j,
const zgsmatrix mat 
) [friend]

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

Definition at line 53 of file zgsmatrix-calc.hpp.

{VERBOSE_REPORT;
  std::vector<zcomponent>::const_iterator itx(mat.data.begin());
  double vmax =0.;
  for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    if( vmax < norm(it->v) ){
      vmax =norm(it->v);
      itx =it;
    }
  }
  i=itx->i;
  j=itx->j;
}
comple damax ( const zgsmatrix mat) [friend]

return its largest absolute value

Definition at line 69 of file zgsmatrix-calc.hpp.

{VERBOSE_REPORT;
  std::vector<zcomponent>::const_iterator itx(mat.data.begin());
  double vmax =0.;
  for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    if( vmax < norm(it->v) ){
      vmax =norm(it->v);
      itx =it;
    }
  }
  return itx->v;
}
const _zgsmatrix& operator+ ( const _zgsmatrix mat) [friend]

+_zgsmatrix operator

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

{VERBOSE_REPORT;
  return mat;
}
_zgsmatrix operator- ( const _zgsmatrix mat) [friend]

-_zgsmatrix operator

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

{VERBOSE_REPORT;
  for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    it->v = -it->v;
  }
  
  return mat;
}
_zgematrix operator+ ( const _zgsmatrix matA,
const zgematrix matB 
) [friend]

_zgsmatrix+zgematrix operator

Definition at line 3 of file _zgsmatrix-zgematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.m!=matB.m || matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat(matB);
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  return _(newmat);
}
_zgematrix operator+ ( const _zgsmatrix matA,
const _zgematrix matB 
) [friend]

_zgsmatrix+_zgematrix operator

Definition at line 3 of file _zgsmatrix-_zgematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.m!=matB.m || matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    matB(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  return matB;
}
_zgematrix operator+ ( const _zgsmatrix matA,
const zhematrix matB 
) [friend]

_zgsmatrix+zhematrix operator

Definition at line 3 of file _zgsmatrix-zhematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.m!=matB.n || matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat( matB.to_zgematrix() );
  
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  return _(newmat);
}
_zgematrix operator+ ( const _zgsmatrix matA,
const _zhematrix matB 
) [friend]

_zgsmatrix+_zhematrix operator

Definition at line 3 of file _zgsmatrix-_zhematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.m!=matB.n || matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat( matB.to_zgematrix() );
  
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_zgematrix operator+ ( const _zgsmatrix matA,
const zgbmatrix matB 
) [friend]

_zgsmatrix+zgbmatrix operator

Definition at line 3 of file _zgsmatrix-zgbmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.m!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat( matA.to_zgematrix() );
  
  for(long i=0; i<matB.m; i++){
    for(long j=std::max(0l,i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){
      newmat(i,j) +=matB(i,j);
    }
  }
  
  matA.destroy();
  return _(newmat);
}
_zgematrix operator+ ( const _zgsmatrix matA,
const _zgbmatrix matB 
) [friend]

_zgsmatrix+_zgbmatrix operator

Definition at line 3 of file _zgsmatrix-_zgbmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.m!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat( matA.to_zgematrix() );
  
  for(long i=0; i<matB.m; i++){
    for(long j=std::max(0l,i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){
      newmat(i,j) +=matB(i,j);
    }
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_zgsmatrix operator+ ( const _zgsmatrix matA,
const zgsmatrix matB 
) [friend]

_zgsmatrix+zgsmatrix operator

Definition at line 3 of file _zgsmatrix-zgsmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.m!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG

  zgsmatrix newmat(matA);
  
  for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    newmat(it->i, it->j) +=it->v;
  }
  
  return _(newmat);
}
_zgsmatrix operator+ ( const _zgsmatrix matA,
const _zgsmatrix matB 
) [friend]

_zgsmatrix+_zgsmatrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.m!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgsmatrix newmat(matA);
  
  for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matB.destroy();
  return _(newmat);
}
_zgsmatrix operator+ ( const _zgsmatrix ,
const zhsmatrix  
) [friend]
_zgsmatrix operator+ ( const _zgsmatrix ,
const _zhsmatrix  
) [friend]
_zgematrix operator- ( const _zgsmatrix matA,
const zgematrix matB 
) [friend]

_zgsmatrix-zgematrix operator

Definition at line 25 of file _zgsmatrix-zgematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.m!=matB.m || matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a subtraction." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat(-matB);
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  return _(newmat);
}
_zgematrix operator- ( const _zgsmatrix matA,
const _zgematrix matB 
) [friend]

_zgsmatrix-_zgematrix operator

Definition at line 24 of file _zgsmatrix-_zgematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.m!=matB.m || matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a subtraction." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  //// change sign ////
  for(int i=0; i<matB.m*matB.n; i++){
    matB.array[i] = -matB.array[i];
  }
  
  //// add ////
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    matB(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  return matB;
}
_zgematrix operator- ( const _zgsmatrix matA,
const zhematrix matB 
) [friend]

_zgsmatrix-zhematrix operator

Definition at line 26 of file _zgsmatrix-zhematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.m!=matB.n || matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a subtraction." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  //// shallow copy to zgematrix ////
  zgematrix newmat( (-matB).to_zgematrix() );
  //// add ////
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  //// return ////
  matA.destroy();
  return _(newmat);
}
_zgematrix operator- ( const _zgsmatrix matA,
const _zhematrix matB 
) [friend]

_zgsmatrix-_zhematrix operator

Definition at line 27 of file _zgsmatrix-_zhematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.m!=matB.n || matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a subtraction." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  //// shallow copy to zgematrix  ////
  zgematrix newmat( (-matB).to_zgematrix() );
  //// add ////
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  ////////
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_zgematrix operator- ( const _zgsmatrix matA,
const zgbmatrix matB 
) [friend]

_zgsmatrix-zgbmatrix operator

Definition at line 28 of file _zgsmatrix-zgbmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.m!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat( matA.to_zgematrix() );
  
  for(long i=0; i<matB.m; i++){
    for(long j=std::max(0l,i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){
      newmat(i,j) -=matB(i,j);
    }
  }
  
  matA.destroy();
  return _(newmat);
}
_zgematrix operator- ( const _zgsmatrix matA,
const _zgbmatrix matB 
) [friend]

_zgsmatrix-_zgbmatrix operator

Definition at line 29 of file _zgsmatrix-_zgbmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.m!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat( matA.to_zgematrix() );
  
  for(long i=0; i<matB.m; i++){
    for(long j=std::max(0l,i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){
      newmat(i,j) -=matB(i,j);
    }
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_zgsmatrix operator- ( const _zgsmatrix matA,
const zgsmatrix matB 
) [friend]

_zgsmatrix-zgsmatrix operator

Definition at line 25 of file _zgsmatrix-zgsmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.m!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a subtraction." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG

  zgsmatrix newmat(matA);
  
  for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    newmat(it->i, it->j) -=it->v;
  }
  
  return _(newmat);
}
_zgsmatrix operator- ( const _zgsmatrix matA,
const _zgsmatrix matB 
) [friend]

_zgsmatrix-_zgsmatrix operator

Definition at line 26 of file _zgsmatrix-_zgsmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.m!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a subtraction." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgsmatrix newmat(matA);
  
  for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    newmat(it->i,it->j) -= it->v;
  }
  
  matB.destroy();
  return _(newmat);
}
_zgsmatrix operator- ( const _zgsmatrix ,
const zhsmatrix  
) [friend]
_zgsmatrix operator- ( const _zgsmatrix ,
const _zhsmatrix  
) [friend]
_zcovector operator* ( const _zgsmatrix mat,
const zcovector vec 
) [friend]

_zgsmatrix*zcovector operator

Definition at line 3 of file _zgsmatrix-zcovector.hpp.

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

_zgsmatrix*_zcovector operator

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

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

_zgsmatrix*zgematrix operator

Definition at line 47 of file _zgsmatrix-zgematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat(matA.m, matB.n);
  newmat.zero();
  
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    for(long j=0; j<matB.n; j++){
      newmat(it->i,j) += it->v*matB(it->j,j);
    }
  }
  
  matA.destroy();
  return _(newmat);
}
_zgematrix operator* ( const _zgsmatrix matA,
const _zgematrix matB 
) [friend]

_zgsmatrix*_zgematrix operator

Definition at line 51 of file _zgsmatrix-_zgematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat(matA.m, matB.n);
  newmat.zero();
  
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    for(long j=0; j<matB.n; j++){
      newmat(it->i,j) += it->v *matB(it->j,j);
    }
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_zgematrix operator* ( const _zgsmatrix matA,
const zhematrix matB 
) [friend]

_zgsmatrix*zhematrix operator

Definition at line 50 of file _zgsmatrix-zhematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat(matA.m, matB.n);
  newmat.zero();
  
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    for(long i=0; i<matB.n; i++){
      newmat(it->i,i) += it->v*matB(it->j,i);
    }
  }
  
  matA.destroy();
  return _(newmat);
}
_zgematrix operator* ( const _zgsmatrix matA,
const _zhematrix matB 
) [friend]

_zgsmatrix*_zhematrix operator

Definition at line 52 of file _zgsmatrix-_zhematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat(matA.m, matB.n);
  newmat.zero();
  
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    for(long i=0; i<matB.n; i++){
      newmat(it->i,i) += it->v*matB(it->j,i);
    }
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_zgematrix operator* ( const _zgsmatrix matA,
const zgbmatrix matB 
) [friend]

_zgsmatrix*zgbmatrix operator

Definition at line 53 of file _zgsmatrix-zgbmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat( matA.m, matB.n );
  newmat.zero();
  
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    for(long j=std::max(0l,long(it->j)-matB.kl); j<std::min(matB.n,long(it->j)+matB.ku+1); j++){
      newmat(it->i,j) += it->v*matB(it->j,j);
    }
  }
  
  matA.destroy();
  return _(newmat);
}
_zgematrix operator* ( const _zgsmatrix matA,
const _zgbmatrix matB 
) [friend]

_zgsmatrix*_zgbmatrix operator

Definition at line 55 of file _zgsmatrix-_zgbmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat( matA.m, matB.n );
  newmat.zero();
  
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    for(long j=std::max(0l,long(it->j)-matB.kl); j<std::min(matB.n,long(it->j)+matB.ku+1); j++){
      newmat(it->i,j) += it->v*matB(it->j,j);
    }
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_zgsmatrix operator* ( const _zgsmatrix matA,
const zgsmatrix matB 
) [friend]

_zgsmatrix*zgsmatrix operator

Definition at line 47 of file _zgsmatrix-zgsmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgsmatrix newmat(matA.m, matB.n);
  
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    long k(it->j);
    std::vector<uint32_t>::const_iterator p;
    for(p=matB.rows[k].begin(); p!=matB.rows[k].end(); p++){
      newmat(it->i,matB.data[*p].j) +=it->v*matB.data[*p].v;
    }
  }
  
  matA.destroy();
  return _(newmat);
}
_zgsmatrix operator* ( const _zgsmatrix matA,
const _zgsmatrix matB 
) [friend]

_zgsmatrix*_zgsmatrix operator

Definition at line 49 of file _zgsmatrix-_zgsmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgsmatrix newmat(matA.m, matB.n);
  
  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    long k(it->j);
    std::vector<uint32_t>::iterator p;
    for(p=matB.rows[k].begin(); p!=matB.rows[k].end(); p++){
      newmat(it->i,matB.data[*p].j) += it->v*matB.data[*p].v;
    }
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_zgsmatrix operator* ( const _zgsmatrix ,
const zhsmatrix  
) [friend]
_zgsmatrix operator* ( const _zgsmatrix ,
const _zhsmatrix  
) [friend]
_zgsmatrix operator* ( const _zgsmatrix mat,
const double &  d 
) [friend]

_zgsmatrix*double operator

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

{VERBOSE_REPORT;
  for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    it->v *=d;
  }
  return mat;
}
_zgsmatrix operator* ( const _zgsmatrix mat,
const comple &  d 
) [friend]

_zgsmatrix*comple operator

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

{VERBOSE_REPORT;
  for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    it->v *=d;
  }
  return mat;
}
_zgsmatrix operator/ ( const _zgsmatrix mat,
const double &  d 
) [friend]

_zgsmatrix/double operator

Definition at line 13 of file _zgsmatrix-double.hpp.

{VERBOSE_REPORT;
  for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    it->v /=d;
  }
  return mat;
}
_zgsmatrix operator/ ( const _zgsmatrix mat,
const comple &  d 
) [friend]

_zgsmatrix/comple operator

Definition at line 13 of file _zgsmatrix-complex.hpp.

{VERBOSE_REPORT;
  for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    it->v /=d;
  }
  return mat;
}
_zgsmatrix operator* ( const double &  d,
const _zgsmatrix mat 
) [friend]

double*_zgsmatrix operator

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

{VERBOSE_REPORT;
  for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    it->v *= d;
  }
  
  return mat;
}
_zgsmatrix operator* ( const comple &  d,
const _zgsmatrix mat 
) [friend]

complex*_zgsmatrix operator

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

{VERBOSE_REPORT;
  for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    it->v *= d;
  }
  return mat;
}

Member Data Documentation

long _zgsmatrix::m [mutable]
long _zgsmatrix::n [mutable]
std::vector<zcomponent> _zgsmatrix::data [mutable]
std::vector< std::vector<uint32_t> > _zgsmatrix::rows [mutable]

array of vector to store the entry information of component for each row

Definition at line 12 of file _zgsmatrix.hpp.

Referenced by _(), _zgsmatrix(), destroy(), nullify(), operator()(), operator*(), zgsmatrix::operator*=(), operator<<(), zgsmatrix::shallow_copy(), t(), zgsmatrix::zgsmatrix(), and ~_zgsmatrix().

std::vector< std::vector<uint32_t> > _zgsmatrix::cols [mutable]

array of vector to store the entry information of component for each column

Definition at line 13 of file _zgsmatrix.hpp.

Referenced by _(), _zgsmatrix(), destroy(), nullify(), zgsmatrix::shallow_copy(), t(), zgsmatrix::zgsmatrix(), and ~_zgsmatrix().


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