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

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

#include <_dgbmatrix.hpp>

List of all members.

Public Member Functions

 _dgbmatrix ()
 _dgbmatrix (const _dgbmatrix &)
 ~_dgbmatrix ()
_zgbmatrix to_zgbmatrix () 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
long kl
 lower band width
long ku
 upper band width
double * array
 1D array to store matrix data
double ** darray
 array of pointers of column head addresses

Friends

std::ostream & operator<< (std::ostream &, const _dgbmatrix &)
_dgbmatrix t (const _dgbmatrix &)
_dgematrix i (const _dgbmatrix &)
const _dgbmatrixoperator+ (const _dgbmatrix &)
_dgbmatrix operator- (const _dgbmatrix &)
_dgematrix operator+ (const _dgbmatrix &, const dgematrix &)
_dgematrix operator+ (const _dgbmatrix &, const _dgematrix &)
_dgematrix operator+ (const _dgbmatrix &, const dsymatrix &)
_dgematrix operator+ (const _dgbmatrix &, const _dsymatrix &)
_dgbmatrix operator+ (const _dgbmatrix &, const dgbmatrix &)
_dgbmatrix operator+ (const _dgbmatrix &, const _dgbmatrix &)
_dgematrix operator+ (const _dgbmatrix &, const dgsmatrix &)
_dgematrix operator+ (const _dgbmatrix &, const _dgsmatrix &)
_dgematrix operator+ (const _dgbmatrix &, const dssmatrix &)
_dgematrix operator+ (const _dgbmatrix &, const _dssmatrix &)
_dgematrix operator- (const _dgbmatrix &, const dgematrix &)
_dgematrix operator- (const _dgbmatrix &, const _dgematrix &)
_dgematrix operator- (const _dgbmatrix &, const dsymatrix &)
_dgematrix operator- (const _dgbmatrix &, const _dsymatrix &)
_dgbmatrix operator- (const _dgbmatrix &, const dgbmatrix &)
_dgbmatrix operator- (const _dgbmatrix &, const _dgbmatrix &)
_dgematrix operator- (const _dgbmatrix &, const dgsmatrix &)
_dgematrix operator- (const _dgbmatrix &, const _dgsmatrix &)
_dgematrix operator- (const _dgbmatrix &, const dssmatrix &)
_dgematrix operator- (const _dgbmatrix &, const _dssmatrix &)
_dcovector operator* (const _dgbmatrix &, const dcovector &)
_dcovector operator* (const _dgbmatrix &, const _dcovector &)
_dgematrix operator* (const _dgbmatrix &, const dgematrix &)
_dgematrix operator* (const _dgbmatrix &, const _dgematrix &)
_dgematrix operator* (const _dgbmatrix &, const dsymatrix &)
_dgematrix operator* (const _dgbmatrix &, const _dsymatrix &)
_dgbmatrix operator* (const _dgbmatrix &, const dgbmatrix &)
_dgbmatrix operator* (const _dgbmatrix &, const _dgbmatrix &)
_dgematrix operator* (const _dgbmatrix &, const dgsmatrix &)
_dgematrix operator* (const _dgbmatrix &, const _dgsmatrix &)
_dgematrix operator* (const _dgbmatrix &, const dssmatrix &)
_dgematrix operator* (const _dgbmatrix &, const _dssmatrix &)
_dgbmatrix operator* (const _dgbmatrix &, const double &)
_dgbmatrix operator/ (const _dgbmatrix &, const double &)
_dgbmatrix operator* (const double &, const _dgbmatrix &)

Detailed Description

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

Definition at line 3 of file _dgbmatrix.hpp.


Constructor & Destructor Documentation

_dgbmatrix::_dgbmatrix ( ) [inline]

_dgbmatrix constructor

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

References array, darray, kl, ku, m, and n.

{VERBOSE_REPORT;
  m =0;
  n =0;
  kl =0;
  ku =0;
  array =NULL;
  darray =NULL;
}
_dgbmatrix::_dgbmatrix ( const _dgbmatrix mat) [inline]

_dgbmatrix copy constructor

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

References array, darray, kl, ku, m, n, and nullify().

{VERBOSE_REPORT;
  m =mat.m;
  n =mat.n;
  kl =mat.kl;
  ku =mat.ku;
  array =mat.array;
  darray =mat.darray;
  
  mat.nullify();
}

_dgbmatrix destructor

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

References array, and darray.

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

Member Function Documentation

cast to _zgbmatrix

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

References _(), zgbmatrix::array, array, destroy(), i, kl, ku, m, and n.

{VERBOSE_REPORT;
  zgbmatrix newmat(m,n,kl,ku);
  
  for(long i=0; i<(kl+ku+1)*n; i++){
    newmat.array[i] =comple(array[i],0.0);
  }
  
  destroy();
  return _(newmat);
}

convert to _dgematrix

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

References _(), destroy(), i, kl, ku, m, and n.

{VERBOSE_REPORT;
  dgematrix newmat( dgematrix(m,n).zero() );
  
  for(long i=0; i<m; i++){
    for(long j=std::max(long(0),i-kl); j<std::min(n,i+ku+1); j++){
      newmat(i,j) =(*this)(i,j);
    }
  }
  
  destroy();
  return _(newmat);
}
double & _dgbmatrix::operator() ( const long &  i,
const long &  j 
) const [inline]

operator() for const object

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

References darray, i, kl, ku, and m.

Referenced by write().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( i<0 || j<0 || m<=i || n<=j || i-j>kl || j-i>ku ){
    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
  
  //return array[ku+i+(kl+ku)*j];
  return darray[j][ku-j+i];
}
void _dgbmatrix::write ( const char *  filename) const [inline]

Definition at line 42 of file _dgbmatrix-io.hpp.

References destroy(), i, kl, ku, m, n, 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 << "#dgbmatrix" << " " << m << " " << n << " " << kl << " " << ku << std::endl;
  for(long i=0; i<m; i++){
    for(long j=std::max(long(0),i-kl); j<std::min(n,i+ku+1); j++){
      ofs << operator()(i,j) << " ";
    }
    ofs << std::endl;
  }
  
  ofs.close();
  destroy();
}
void _dgbmatrix::nullify ( ) const [inline]

nullify all the matrix data

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

References array, darray, kl, ku, m, and n.

Referenced by _dgbmatrix(), dgbmatrix::dgbmatrix(), and dgbmatrix::shallow_copy().

{VERBOSE_REPORT;
  m=0;
  n=0;
  kl=0;
  ku=0;
  array=NULL;
  darray=NULL;
}
void _dgbmatrix::destroy ( ) const [inline]

Friends And Related Function Documentation

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

Definition at line 23 of file _dgbmatrix-io.hpp.

{VERBOSE_REPORT;
  for(long i=0; i<mat.m; i++){
    for(long j=0; j<mat.n; j++){
      if( i-j>mat.kl || j-i>mat.ku ){ s << " x"; }
      else{ s << " " << mat(i,j); }
    }
    s << std::endl;
  }
  
  mat.destroy();
  return s;
}
_dgbmatrix t ( const _dgbmatrix mat) [friend]

return its transposed dgbmatrix

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

{VERBOSE_REPORT;
  dgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl);
  
  for(long i=0; i<newmat.m; i++){
    for(long j=std::max(long(0),i-newmat.kl); j<std::min(newmat.n,i+newmat.ku+1); j++){
      newmat(i,j) =mat(j,i);
    }
  }
  
  mat.destroy();
  return _(newmat);
}
_dgematrix i ( const _dgbmatrix mat) [friend]

return its inverse matrix

Definition at line 19 of file _dgbmatrix-calc.hpp.

Referenced by operator()(), to_dgematrix(), to_zgbmatrix(), and write().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(mat.m!=mat.n){
    ERROR_REPORT;
    std::cerr << "This matrix is not square and has no inverse matrix." << std::endl
              << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgbmatrix mat_cp(mat);
  dgematrix mat_inv(mat_cp.m,mat_cp.n);
  mat_inv.identity();
  mat_cp.dgbsv(mat_inv);

  return _(mat_inv);
}
const _dgbmatrix& operator+ ( const _dgbmatrix mat) [friend]

+_dgbmatrix operator

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

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

-_dgbmatrix operator

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

{VERBOSE_REPORT;
  for(long i=0; i<(mat.kl+mat.ku+1)*mat.n; i++){
    mat.array[i]=-mat.array[i];
  }
  
  return mat;
}
_dgematrix operator+ ( const _dgbmatrix matA,
const dgematrix matB 
) [friend]

_dgbmatrix+dgematrix operator

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

_dgbmatrix+_dgematrix operator

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

_dgbmatrix+dsymatrix operator

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

_dgbmatrix+_dsymatrix operator

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

_dgbmatrix+dgbmatrix operator

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

_dgbmatrix+_dgbmatrix operator

Definition at line 3 of file _dgbmatrix-_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
  
  if(matA.kl>matB.kl && matA.ku>matB.ku){
    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++){
        matA(i,j)+=matB(i,j);
      }
    }
    
    matB.destroy();
    return matA;
  }

  else if(matB.kl>matA.kl && matB.ku>matA.ku){
    for(long i=0; i<matA.m; i++){
      for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){
        matB(i,j)+=matA(i,j);
      }
    }
    
    matA.destroy();
    return matB;
  }
  
  else{
    dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku));
    newmat.zero();
    
    for(long i=0; i<matA.m; i++){
      for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){
        newmat(i,j)+=matA(i,j);
      }
      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);
  }
}
_dgematrix operator+ ( const _dgbmatrix matA,
const dgsmatrix matB 
) [friend]

_dgbmatrix+dgsmatrix operator

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

_dgbmatrix+_dgsmatrix operator

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

_dgbmatrix-dgematrix operator

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

_dgbmatrix-_dgematrix operator

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

_dgbmatrix-dsymatrix operator

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

_dgbmatrix-_dsymatrix operator

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

_dgbmatrix-dgbmatrix operator

Definition at line 44 of file _dgbmatrix-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 subtraction." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  if(matA.kl>=matB.kl && matA.ku>=matB.ku){
    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++){
        matA(i,j)-=matB(i,j);
      }
    }
    
    return matA;
  }
  
  else{
    dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku));
    newmat.zero();
    
    for(long i=0; i<matA.m; i++){
      for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){
        newmat(i,j)+=matA(i,j);
      }
      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);
      }
    }
    
    return _(newmat);
  }
}
_dgbmatrix operator- ( const _dgbmatrix matA,
const _dgbmatrix matB 
) [friend]

_dgbmatrix-_dgbmatrix operator

Definition at line 57 of file _dgbmatrix-_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 subtraction." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  if(matA.kl>matB.kl && matA.ku>matB.ku){
    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++){
        matA(i,j)-=matB(i,j);
      }
    }
    
    matB.destroy();
    return matA;
  }
  
  else{
    dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku));
    newmat.zero();
    
    for(long i=0; i<matA.m; i++){
      for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){
        newmat(i,j)+=matA(i,j);
      }
      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);
  }
}
_dgematrix operator- ( const _dgbmatrix matA,
const dgsmatrix matB 
) [friend]

_dgbmatrix-dgsmatrix operator

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

_dgbmatrix-_dgsmatrix operator

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

_dgbmatrix*dcovector operator

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

_dgbmatrix*_dcovector operator

Definition at line 3 of file _dgbmatrix-_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);
  dgbmv_( 'n', mat.m, mat.n, mat.kl, mat.ku, 1.0, mat.array,
          mat.kl+mat.ku+1, vec.array, 1, 0.0, newvec.array, 1 );
  
  mat.destroy();
  vec.destroy();
  return _(newvec);
}
_dgematrix operator* ( const _dgbmatrix matA,
const dgematrix matB 
) [friend]

_dgbmatrix*dgematrix operator

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

_dgbmatrix*_dgematrix operator

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

_dgbmatrix*dgematrix operator

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

_dgbmatrix*_dsymatrix operator

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

_dgbmatrix*dgbmatrix operator

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

_dgbmatrix*_dgbmatrix operator

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

_dgbmatrix*dgsmatrix operator

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

_dgbmatrix*_dgsmatrix operator

Definition at line 53 of file _dgbmatrix-_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
  
  dgematrix newmat( matA.m, matB.n );
  newmat.zero();
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    for(long i=std::max(long(0),long(it->i)-(matA.ku+1)); i<std::min(matA.m,long(it->i)+matA.kl); i++){
      newmat(i,it->j) += matA(i,it->i)*it->v;
    }
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_dgematrix operator* ( const _dgbmatrix ,
const dssmatrix  
) [friend]
_dgematrix operator* ( const _dgbmatrix ,
const _dssmatrix  
) [friend]
_dgbmatrix operator* ( const _dgbmatrix mat,
const double &  d 
) [friend]

_dgbmatrix*double operator

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

{VERBOSE_REPORT;
  dscal_((mat.kl+mat.ku+1)*mat.n, d, mat.array, 1);
  return mat;
}
_dgbmatrix operator/ ( const _dgbmatrix mat,
const double &  d 
) [friend]

_dgbmatrix/double operator

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

{VERBOSE_REPORT;
  dscal_((mat.kl+mat.ku+1)*mat.n, 1./d, mat.array, 1);
  return mat;
}
_dgbmatrix operator* ( const double &  d,
const _dgbmatrix mat 
) [friend]

double*_dgbmatrix operator

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

{VERBOSE_REPORT;
  dscal_((mat.kl+mat.ku+1)*mat.n, d, mat.array, 1);
  return mat;
}

Member Data Documentation

long _dgbmatrix::m [mutable]
long _dgbmatrix::n [mutable]
long _dgbmatrix::kl [mutable]
long _dgbmatrix::ku [mutable]
double* _dgbmatrix::array [mutable]
double** _dgbmatrix::darray [mutable]

array of pointers of column head addresses

Definition at line 14 of file _dgbmatrix.hpp.

Referenced by _(), _dgbmatrix(), destroy(), dgbmatrix::dgbmatrix(), nullify(), operator()(), dgbmatrix::shallow_copy(), and ~_dgbmatrix().


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