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

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

#include <_dgsmatrix.hpp>

List of all members.

Public Member Functions

 _dgsmatrix ()
 _dgsmatrix (const _dgsmatrix &)
 ~_dgsmatrix ()
_zgsmatrix to_zgsmatrix () const
_dgematrix to_dgematrix () const
double 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< dcomponentdata
 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 _dgsmatrix &)
_dgsmatrix t (const dgsmatrix &)
void idamax (long &, long &, const dgsmatrix &)
double damax (const dgsmatrix &)
const _dgsmatrixoperator+ (const _dgsmatrix &)
_dgsmatrix operator- (const _dgsmatrix &)
_dgematrix operator+ (const _dgsmatrix &, const dgematrix &)
_dgematrix operator+ (const _dgsmatrix &, const _dgematrix &)
_dgematrix operator+ (const _dgsmatrix &, const dsymatrix &)
_dgematrix operator+ (const _dgsmatrix &, const _dsymatrix &)
_dgematrix operator+ (const _dgsmatrix &, const dgbmatrix &)
_dgematrix operator+ (const _dgsmatrix &, const _dgbmatrix &)
_dgsmatrix operator+ (const _dgsmatrix &, const dgsmatrix &)
_dgsmatrix operator+ (const _dgsmatrix &, const _dgsmatrix &)
_dgsmatrix operator+ (const _dgsmatrix &, const dssmatrix &)
_dgsmatrix operator+ (const _dgsmatrix &, const _dssmatrix &)
_dgematrix operator- (const _dgsmatrix &, const dgematrix &)
_dgematrix operator- (const _dgsmatrix &, const _dgematrix &)
_dgematrix operator- (const _dgsmatrix &, const dsymatrix &)
_dgematrix operator- (const _dgsmatrix &, const _dsymatrix &)
_dgematrix operator- (const _dgsmatrix &, const dgbmatrix &)
_dgematrix operator- (const _dgsmatrix &, const _dgbmatrix &)
_dgsmatrix operator- (const _dgsmatrix &, const dgsmatrix &)
_dgsmatrix operator- (const _dgsmatrix &, const _dgsmatrix &)
_dgsmatrix operator- (const _dgsmatrix &, const dssmatrix &)
_dgsmatrix operator- (const _dgsmatrix &, const _dssmatrix &)
_dcovector operator* (const _dgsmatrix &, const dcovector &)
_dcovector operator* (const _dgsmatrix &, const _dcovector &)
_dgematrix operator* (const _dgsmatrix &, const dgematrix &)
_dgematrix operator* (const _dgsmatrix &, const _dgematrix &)
_dgematrix operator* (const _dgsmatrix &, const dsymatrix &)
_dgematrix operator* (const _dgsmatrix &, const _dsymatrix &)
_dgematrix operator* (const _dgsmatrix &, const dgbmatrix &)
_dgematrix operator* (const _dgsmatrix &, const _dgbmatrix &)
_dgsmatrix operator* (const _dgsmatrix &, const dgsmatrix &)
_dgsmatrix operator* (const _dgsmatrix &, const _dgsmatrix &)
_dgsmatrix operator* (const _dgsmatrix &, const dssmatrix &)
_dgsmatrix operator* (const _dgsmatrix &, const _dssmatrix &)
_dgsmatrix operator* (const _dgsmatrix &, const double &)
_dgsmatrix operator/ (const _dgsmatrix &, const double &)
_dgsmatrix operator* (const double &, const _dgsmatrix &)

Detailed Description

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

Definition at line 3 of file _dgsmatrix.hpp.


Constructor & Destructor Documentation

_dgsmatrix::_dgsmatrix ( ) [inline]

_dgsmatrix constructor without arguments

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

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

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

_dgsmatrix copy constructor

Definition at line 14 of file _dgsmatrix-constructor.hpp.

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

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

_dgsmatrix destructor

Definition at line 31 of file _dgsmatrix-constructor.hpp.

References cols, data, and rows.

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

Member Function Documentation

cast to _zgsmatrix

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

References _(), data, destroy(), m, n, and zgsmatrix::put().

{VERBOSE_REPORT;
  zgsmatrix newmat(m,n,data.size());
  
  for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){
    newmat.put(it->i, it->j, comple(it->v,0.));
  }
  
  destroy();
  return _(newmat);
}

convert to _dgematrix

Definition at line 21 of file _dgsmatrix-cast.hpp.

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

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

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

operator() for const object

Definition at line 3 of file _dgsmatrix-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 0.0;
}
void _dgsmatrix::write ( const char *  filename) const [inline]

Definition at line 51 of file _dgsmatrix-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 << "#dgsmatrix" << " " << m << " " << n << std::endl;
  for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data.end(); it++){
    ofs << it->i << " " << it->j << " " << it->v << std::endl;
  }
  
  ofs.close();
  destroy();
}
void _dgsmatrix::nullify ( ) const [inline]

nullify all the matrix data

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

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

Referenced by _dgsmatrix(), dgsmatrix::dgsmatrix(), and dgsmatrix::shallow_copy().

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

destroy all the matrix data

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

References cols, data, and rows.

Referenced by damax(), idamax(), operator*(), dgsmatrix::operator*=(), operator+(), dgsmatrix::operator+=(), operator-(), dgsmatrix::operator-=(), operator<<(), to_dgematrix(), to_zgsmatrix(), and write().

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

Friends And Related Function Documentation

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

Definition at line 28 of file _dgsmatrix-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;
}
_dgsmatrix t ( const dgsmatrix mat) [friend]

return transposed dgsmatrix

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

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

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

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

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

return its largest absolute value

Definition at line 37 of file dgsmatrix-calc.hpp.

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

+_dgsmatrix operator

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

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

-_dgsmatrix operator

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

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

_dgsmatrix+dgematrix operator

Definition at line 3 of file _dgsmatrix-dgematrix.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
  
  dgematrix newmat(matB);
  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  return _(newmat);
}
_dgematrix operator+ ( const _dgsmatrix matA,
const _dgematrix matB 
) [friend]

_dgsmatrix+_dgematrix operator

Definition at line 3 of file _dgsmatrix-_dgematrix.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<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    matB(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  return matB;
}
_dgematrix operator+ ( const _dgsmatrix matA,
const dsymatrix matB 
) [friend]

_dgsmatrix+dsymatrix operator

Definition at line 3 of file _dgsmatrix-dsymatrix.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
  
  dgematrix newmat( matB.to_dgematrix() );
  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  return _(newmat);
}
_dgematrix operator+ ( const _dgsmatrix matA,
const _dsymatrix matB 
) [friend]

_dgsmatrix+_dsymatrix operator

Definition at line 3 of file _dgsmatrix-_dsymatrix.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
  
  dgematrix newmat( matB.to_dgematrix() );
  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_dgematrix operator+ ( const _dgsmatrix matA,
const dgbmatrix matB 
) [friend]

_dgsmatrix+dgbmatrix operator

Definition at line 3 of file _dgsmatrix-dgbmatrix.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
  
  dgematrix newmat( matA.to_dgematrix() );
  
  for(long i=0; i<matB.m; i++){
    for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){
      newmat(i,j)+=matB(i,j);
    }
  }
  
  matA.destroy();
  return _(newmat);
}
_dgematrix operator+ ( const _dgsmatrix matA,
const _dgbmatrix matB 
) [friend]

_dgsmatrix+_dgbmatrix operator

Definition at line 3 of file _dgsmatrix-_dgbmatrix.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
  
  dgematrix newmat( matA.to_dgematrix() );
  for(long i=0; i<matB.m; i++){
    for(long j=std::max(long(0),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);
}
_dgsmatrix operator+ ( const _dgsmatrix matA,
const dgsmatrix matB 
) [friend]

_dgsmatrix+dgsmatrix operator

Definition at line 3 of file _dgsmatrix-dgsmatrix.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

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

_dgsmatrix+_dgsmatrix operator

Definition at line 3 of file _dgsmatrix-_dgsmatrix.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
  
  dgsmatrix newmat(matA);
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matB.destroy();
  return _(newmat);
}
_dgsmatrix operator+ ( const _dgsmatrix ,
const dssmatrix  
) [friend]
_dgsmatrix operator+ ( const _dgsmatrix ,
const _dssmatrix  
) [friend]
_dgematrix operator- ( const _dgsmatrix matA,
const dgematrix matB 
) [friend]

_dgsmatrix-dgematrix operator

Definition at line 25 of file _dgsmatrix-dgematrix.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

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

_dgsmatrix-_dgematrix operator

Definition at line 24 of file _dgsmatrix-_dgematrix.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.m << "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];
  }
  
  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    matB(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  return matB;
}
_dgematrix operator- ( const _dgsmatrix matA,
const dsymatrix matB 
) [friend]

_dgsmatrix-dsymatrix operator

Definition at line 25 of file _dgsmatrix-dsymatrix.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
  
  dgematrix newmat( (-matB).to_dgematrix() );
  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  return _(newmat);
}
_dgematrix operator- ( const _dgsmatrix matA,
const _dsymatrix matB 
) [friend]

_dgsmatrix-_dsymatrix operator

Definition at line 26 of file _dgsmatrix-_dsymatrix.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.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG

  //// shallow copy to dgematrix  ////
  dgematrix newmat( (-matB).to_dgematrix() );
  
  //// add ////
  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_dgematrix operator- ( const _dgsmatrix matA,
const dgbmatrix matB 
) [friend]

_dgsmatrix-dgbmatrix operator

Definition at line 28 of file _dgsmatrix-dgbmatrix.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
  
  dgematrix newmat( matA.to_dgematrix() );
  
  for(long i=0; i<matB.m; i++){
    for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){
      newmat(i,j)-=matB(i,j);
    }
  }
  
  matA.destroy();
  return _(newmat);
}
_dgematrix operator- ( const _dgsmatrix matA,
const _dgbmatrix matB 
) [friend]

_dgsmatrix-_dgbmatrix operator

Definition at line 28 of file _dgsmatrix-_dgbmatrix.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
  
  dgematrix newmat( matA.to_dgematrix() );
  for(long i=0; i<matB.m; i++){
    for(long j=std::max(long(0),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);
}
_dgsmatrix operator- ( const _dgsmatrix matA,
const dgsmatrix matB 
) [friend]

_dgsmatrix-dgsmatrix operator

Definition at line 23 of file _dgsmatrix-dgsmatrix.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

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

_dgsmatrix-_dgsmatrix operator

Definition at line 25 of file _dgsmatrix-_dgsmatrix.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
  
  dgsmatrix newmat(matA);
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    newmat(it->i,it->j) -= it->v;
  }
  
  matB.destroy();
  return _(newmat);
}
_dgsmatrix operator- ( const _dgsmatrix ,
const dssmatrix  
) [friend]
_dgsmatrix operator- ( const _dgsmatrix ,
const _dssmatrix  
) [friend]
_dcovector operator* ( const _dgsmatrix mat,
const dcovector vec 
) [friend]

_dgsmatrix*dcovector operator

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

_dgsmatrix*_dcovector operator

Definition at line 3 of file _dgsmatrix-_dcovector.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
  
  dcovector newvec(mat.m);
  newvec.zero();
  
  for(std::vector<dcomponent>::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);
}
_dgematrix operator* ( const _dgsmatrix matA,
const dgematrix matB 
) [friend]

_dgsmatrix*dgematrix operator

Definition at line 47 of file _dgsmatrix-dgematrix.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
  
  dgematrix newmat(matA.m, matB.n);
  newmat.zero();
  
  for(std::vector<dcomponent>::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);
}
_dgematrix operator* ( const _dgsmatrix matA,
const _dgematrix matB 
) [friend]

_dgsmatrix*_dgematrix operator

Definition at line 50 of file _dgsmatrix-_dgematrix.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
  
  dgematrix newmat(matA.m, matB.n);
  newmat.zero();
  
  for(std::vector<dcomponent>::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);
}
_dgematrix operator* ( const _dgsmatrix matA,
const dsymatrix matB 
) [friend]

_dgsmatrix*dsymatrix operator

Definition at line 47 of file _dgsmatrix-dsymatrix.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
  
  dgematrix newmat(matA.m, matB.n);
  newmat.zero();
  
  for(std::vector<dcomponent>::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);
}
_dgematrix operator* ( const _dgsmatrix matA,
const _dsymatrix matB 
) [friend]

_dgsmatrix*_dsymatrix operator

Definition at line 52 of file _dgsmatrix-_dsymatrix.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
  
  dgematrix newmat(matA.m, matB.n);
  newmat.zero();
  
  for(std::vector<dcomponent>::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);
}
_dgematrix operator* ( const _dgsmatrix matA,
const dgbmatrix matB 
) [friend]

_dgsmatrix*dgbmatrix operator

Definition at line 53 of file _dgsmatrix-dgbmatrix.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
  
  dgematrix newmat( matA.m, matB.n );
  newmat.zero();
  
  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    for(long j=std::max(long(0),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);
}
_dgematrix operator* ( const _dgsmatrix matA,
const _dgbmatrix matB 
) [friend]

_dgsmatrix*_dgbmatrix operator

Definition at line 53 of file _dgsmatrix-_dgbmatrix.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
  
  dgematrix newmat( matA.m, matB.n );
  newmat.zero();
  
  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    for(long j=std::max(long(0),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);
}
_dgsmatrix operator* ( const _dgsmatrix matA,
const dgsmatrix matB 
) [friend]

_dgsmatrix*dgsmatrix operator

Definition at line 43 of file _dgsmatrix-dgsmatrix.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
  
  dgsmatrix newmat( matA.m, matB.n );
  for(std::vector<dcomponent>::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);
}
_dgsmatrix operator* ( const _dgsmatrix matA,
const _dgsmatrix matB 
) [friend]

_dgsmatrix*_dgsmatrix operator

Definition at line 47 of file _dgsmatrix-_dgsmatrix.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
  
  dgsmatrix newmat(matA.m, matB.n);
  
  for(std::vector<dcomponent>::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);
}
_dgsmatrix operator* ( const _dgsmatrix ,
const dssmatrix  
) [friend]
_dgsmatrix operator* ( const _dgsmatrix ,
const _dssmatrix  
) [friend]
_dgsmatrix operator* ( const _dgsmatrix mat,
const double &  d 
) [friend]

_dgsmatrix*double operator

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

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

_dgsmatrix/double operator

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

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

double*_dgsmatrix operator

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

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

Member Data Documentation

long _dgsmatrix::m [mutable]
long _dgsmatrix::n [mutable]
std::vector<dcomponent> _dgsmatrix::data [mutable]
std::vector< std::vector<uint32_t> > _dgsmatrix::rows [mutable]

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

Definition at line 12 of file _dgsmatrix.hpp.

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

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

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

Definition at line 13 of file _dgsmatrix.hpp.

Referenced by _(), _dgsmatrix(), destroy(), dgsmatrix::dgsmatrix(), nullify(), dgsmatrix::shallow_copy(), t(), and ~_dgsmatrix().


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