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

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

#include <_zgbmatrix.hpp>

List of all members.

Public Member Functions

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

Friends

std::ostream & operator<< (std::ostream &, const _zgbmatrix &)
_zgbmatrix t (const _zgbmatrix &)
_zgematrix i (const _zgbmatrix &)
_zgbmatrix conj (const _zgbmatrix &)
_zgbmatrix conjt (const _zgbmatrix &)
const _zgbmatrixoperator+ (const _zgbmatrix &)
_zgbmatrix operator- (const _zgbmatrix &)
_zgematrix operator+ (const _zgbmatrix &, const zgematrix &)
_zgematrix operator+ (const _zgbmatrix &, const _zgematrix &)
_zgematrix operator+ (const _zgbmatrix &, const zhematrix &)
_zgematrix operator+ (const _zgbmatrix &, const _zhematrix &)
_zgbmatrix operator+ (const _zgbmatrix &, const zgbmatrix &)
_zgbmatrix operator+ (const _zgbmatrix &, const _zgbmatrix &)
_zgematrix operator+ (const _zgbmatrix &, const zgsmatrix &)
_zgematrix operator+ (const _zgbmatrix &, const _zgsmatrix &)
_zgematrix operator+ (const _zgbmatrix &, const zhsmatrix &)
_zgematrix operator+ (const _zgbmatrix &, const _zhsmatrix &)
_zgematrix operator- (const _zgbmatrix &, const zgematrix &)
_zgematrix operator- (const _zgbmatrix &, const _zgematrix &)
_zgematrix operator- (const _zgbmatrix &, const zhematrix &)
_zgematrix operator- (const _zgbmatrix &, const _zhematrix &)
_zgbmatrix operator- (const _zgbmatrix &, const zgbmatrix &)
_zgbmatrix operator- (const _zgbmatrix &, const _zgbmatrix &)
_zgematrix operator- (const _zgbmatrix &, const zgsmatrix &)
_zgematrix operator- (const _zgbmatrix &, const _zgsmatrix &)
_zgematrix operator- (const _zgbmatrix &, const zhsmatrix &)
_zgematrix operator- (const _zgbmatrix &, const _zhsmatrix &)
_zcovector operator* (const _zgbmatrix &, const zcovector &)
_zcovector operator* (const _zgbmatrix &, const _zcovector &)
_zgematrix operator* (const _zgbmatrix &, const zgematrix &)
_zgematrix operator* (const _zgbmatrix &, const _zgematrix &)
_zgematrix operator* (const _zgbmatrix &, const zhematrix &)
_zgematrix operator* (const _zgbmatrix &, const _zhematrix &)
_zgbmatrix operator* (const _zgbmatrix &, const zgbmatrix &)
_zgbmatrix operator* (const _zgbmatrix &, const _zgbmatrix &)
_zgematrix operator* (const _zgbmatrix &, const zgsmatrix &)
_zgematrix operator* (const _zgbmatrix &, const _zgsmatrix &)
_zgematrix operator* (const _zgbmatrix &, const zhsmatrix &)
_zgematrix operator* (const _zgbmatrix &, const _zhsmatrix &)
_zgbmatrix operator* (const _zgbmatrix &, const double &)
_zgbmatrix operator* (const _zgbmatrix &, const comple &)
_zgbmatrix operator/ (const _zgbmatrix &, const double &)
_zgbmatrix operator/ (const _zgbmatrix &, const comple &)
_zgbmatrix operator* (const double &, const _zgbmatrix &)
_zgbmatrix operator* (const comple &, const _zgbmatrix &)

Detailed Description

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

Definition at line 3 of file _zgbmatrix.hpp.


Constructor & Destructor Documentation

_zgbmatrix::_zgbmatrix ( ) [inline]

_zgbmatrix constructor

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

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

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

_zgbmatrix copy constructor

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

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

{VERBOSE_REPORT;
  //////// initialize ////////
  m =mat.m;
  n =mat.n;
  kl =mat.kl;
  ku =mat.ku;
  array =mat.array;
  darray =mat.darray;

  mat.nullify();
}

_zgbmatrix destructor

Definition at line 34 of file _zgbmatrix-constructor.hpp.

References array, and darray.

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

Member Function Documentation

convert to _zgematrix

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

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

{VERBOSE_REPORT;
  zgematrix newmat( zgematrix(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);
}
comple & _zgbmatrix::operator() ( const long &  i,
const long &  j 
) const [inline]

operator() for const object

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

Definition at line 42 of file _zgbmatrix-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 << "#zgbmatrix" << " " << 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 _zgbmatrix::nullify ( ) const [inline]

nullify all the matrix data

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

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

Referenced by _zgbmatrix(), zgbmatrix::shallow_copy(), and zgbmatrix::zgbmatrix().

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

destroy all the matrix data

Definition at line 16 of file _zgbmatrix-misc.hpp.

References array, and darray.

Referenced by conjt(), operator*(), zgbmatrix::operator*=(), zgematrix::operator*=(), operator+(), zgbmatrix::operator+=(), zgematrix::operator+=(), operator-(), zgbmatrix::operator-=(), zgematrix::operator-=(), operator<<(), t(), to_zgematrix(), and write().

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

Friends And Related Function Documentation

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

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

return its transposed zgbmatrix

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

{VERBOSE_REPORT;
  zgbmatrix 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);
}
_zgematrix i ( const _zgbmatrix mat) [friend]

return its inverse matrix

Definition at line 18 of file _zgbmatrix-calc.hpp.

Referenced by operator()(), to_zgematrix(), 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
  
  zgbmatrix mat_cp(mat);
  zgematrix mat_inv(mat_cp.m,mat_cp.n);
  mat_inv.identity();
  mat_cp.zgbsv(mat_inv);
  
  return _(mat_inv);
}
_zgbmatrix conj ( const _zgbmatrix mat) [friend]

return its conjugate matrix

Definition at line 43 of file _zgbmatrix-calc.hpp.

{VERBOSE_REPORT;
  for(long i=0; i<mat.m; i++){
    for(long j=std::max(long(0),i-mat.kl); j<std::min(mat.n,i+mat.ku+1); j++){
      mat(i,j) =std::conj(mat(i,j));
    }
  }
  
  return mat;
}
_zgbmatrix conjt ( const _zgbmatrix mat) [friend]

return its conjugate transposed zgbmatrix

Definition at line 56 of file _zgbmatrix-calc.hpp.

{VERBOSE_REPORT;
  zgbmatrix 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) =std::conj(mat(j,i));
    }
  }
  
  mat.destroy();
  return _(newmat);
}
const _zgbmatrix& operator+ ( const _zgbmatrix mat) [friend]

+_zgbmatrix operator

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

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

-_zgbmatrix operator

Definition at line 10 of file _zgbmatrix-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;
}
_zgematrix operator+ ( const _zgbmatrix matA,
const zgematrix matB 
) [friend]

_zgbmatrix+zgematrix operator

Definition at line 3 of file _zgbmatrix-zgematrix.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(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);
}
_zgematrix operator+ ( const _zgbmatrix matA,
const _zgematrix matB 
) [friend]

_zgbmatrix+_zgematrix operator

Definition at line 3 of file _zgbmatrix-_zgematrix.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;
}
_zgematrix operator+ ( const _zgbmatrix matA,
const zhematrix matB 
) [friend]

_zgbmatrix+zhematrix operator

Definition at line 3 of file _zgbmatrix-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(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);
}
_zgematrix operator+ ( const _zgbmatrix matA,
const _zhematrix matB 
) [friend]

_zgbmatrix+_zhematrix operator

Definition at line 3 of file _zgbmatrix-_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.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);
}
_zgbmatrix operator+ ( const _zgbmatrix matA,
const zgbmatrix matB 
) [friend]

_zgbmatrix+zgbmatrix operator

Definition at line 3 of file _zgbmatrix-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
  
  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{
    zgbmatrix 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);
  }
}
_zgbmatrix operator+ ( const _zgbmatrix matA,
const _zgbmatrix matB 
) [friend]

_zgbmatrix+_zgbmatrix operator

Definition at line 3 of file _zgbmatrix-_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
  
  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{
    zgbmatrix 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);
  }
}
_zgematrix operator+ ( const _zgbmatrix ,
const zgsmatrix  
) [friend]
_zgematrix operator+ ( const _zgbmatrix ,
const _zgsmatrix  
) [friend]
_zgematrix operator+ ( const _zgbmatrix ,
const zhsmatrix  
) [friend]
_zgematrix operator+ ( const _zgbmatrix ,
const _zhsmatrix  
) [friend]
_zgematrix operator- ( const _zgbmatrix matA,
const zgematrix matB 
) [friend]

_zgbmatrix-zgematrix operator

Definition at line 27 of file _zgbmatrix-zgematrix.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(-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);
}
_zgematrix operator- ( const _zgbmatrix matA,
const _zgematrix matB 
) [friend]

_zgbmatrix-_zgematrix operator

Definition at line 26 of file _zgbmatrix-_zgematrix.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;
}
_zgematrix operator- ( const _zgbmatrix matA,
const zhematrix matB 
) [friend]

_zgbmatrix-zgematrix operator

_zgbmatrix-zhematrix operator

Definition at line 27 of file _zgbmatrix-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(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);
}
_zgematrix operator- ( const _zgbmatrix matA,
const _zhematrix matB 
) [friend]

_zgbmatrix-_zhematrix operator

Definition at line 31 of file _zgbmatrix-_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.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);
}
_zgbmatrix operator- ( const _zgbmatrix matA,
const zgbmatrix matB 
) [friend]

_zgbmatrix-zgbmatrix operator

Definition at line 44 of file _zgbmatrix-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 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{
    zgbmatrix 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);
  }
}
_zgbmatrix operator- ( const _zgbmatrix matA,
const _zgbmatrix matB 
) [friend]

_zgbmatrix-_zgbmatrix operator

Definition at line 57 of file _zgbmatrix-_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 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{
    zgbmatrix 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);
  }
}
_zgematrix operator- ( const _zgbmatrix ,
const zgsmatrix  
) [friend]
_zgematrix operator- ( const _zgbmatrix ,
const _zgsmatrix  
) [friend]
_zgematrix operator- ( const _zgbmatrix ,
const zhsmatrix  
) [friend]
_zgematrix operator- ( const _zgbmatrix ,
const _zhsmatrix  
) [friend]
_zcovector operator* ( const _zgbmatrix mat,
const zcovector vec 
) [friend]

_zgbmatrix*zcovector operator

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

_zgbmatrix*_zcovector operator

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

_zgbmatrix*zgematrix operator

Definition at line 51 of file _zgbmatrix-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.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix 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);
}
_zgematrix operator* ( const _zgbmatrix matA,
const _zgematrix matB 
) [friend]

_zgbmatrix*_zgematrix operator

Definition at line 49 of file _zgbmatrix-_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.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix 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);
}
_zgematrix operator* ( const _zgbmatrix matA,
const zhematrix matB 
) [friend]

_zgbmatrix*zgematrix operator

_zgbmatrix*zhematrix operator

Definition at line 51 of file _zgbmatrix-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(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);
}
_zgematrix operator* ( const _zgbmatrix matA,
const _zhematrix matB 
) [friend]

_zgbmatrix*_zhematrix operator

Definition at line 59 of file _zgbmatrix-_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(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);
}
_zgbmatrix operator* ( const _zgbmatrix matA,
const zgbmatrix matB 
) [friend]

_zgbmatrix*zgbmatrix operator

Definition at line 84 of file _zgbmatrix-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
  
  zgbmatrix 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);
}
_zgbmatrix operator* ( const _zgbmatrix matA,
const _zgbmatrix matB 
) [friend]

_zgbmatrix*_zgbmatrix operator

Definition at line 100 of file _zgbmatrix-_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
  
  zgbmatrix 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);
}
_zgematrix operator* ( const _zgbmatrix ,
const zgsmatrix  
) [friend]
_zgematrix operator* ( const _zgbmatrix ,
const _zgsmatrix  
) [friend]
_zgematrix operator* ( const _zgbmatrix ,
const zhsmatrix  
) [friend]
_zgematrix operator* ( const _zgbmatrix ,
const _zhsmatrix  
) [friend]
_zgbmatrix operator* ( const _zgbmatrix mat,
const double &  d 
) [friend]

_zgbmatrix*double operator

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

{VERBOSE_REPORT;
  zdscal_((mat.kl+mat.ku+1)*mat.n, d, mat.array, 1);
  return mat;
}
_zgbmatrix operator* ( const _zgbmatrix mat,
const comple &  d 
) [friend]

_zgbmatrix*comple operator

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

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

_zgbmatrix/double operator

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

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

_zgbmatrix/comple operator

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

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

double*_zgbmatrix operator

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

{VERBOSE_REPORT;
  zdscal_((mat.kl+mat.ku+1)*mat.n, d, mat.array, 1);
  return mat;
}
_zgbmatrix operator* ( const comple &  d,
const _zgbmatrix mat 
) [friend]

comple*_zgbmatrix operator

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

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

Member Data Documentation

long _zgbmatrix::m [mutable]
long _zgbmatrix::n [mutable]
long _zgbmatrix::kl [mutable]
long _zgbmatrix::ku [mutable]
comple* _zgbmatrix::array [mutable]

1D array to store matrix data

Definition at line 13 of file _zgbmatrix.hpp.

Referenced by _(), _zgbmatrix(), destroy(), nullify(), operator*(), operator-(), operator/(), zgbmatrix::shallow_copy(), zgbmatrix::zgbmatrix(), and ~_zgbmatrix().

comple** _zgbmatrix::darray [mutable]

array of pointers of column head addresses

Definition at line 14 of file _zgbmatrix.hpp.

Referenced by _(), _zgbmatrix(), destroy(), nullify(), operator()(), zgbmatrix::shallow_copy(), zgbmatrix::zgbmatrix(), and ~_zgbmatrix().


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