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

Complex Double-precision General Band Matrix Class. More...

#include <zgbmatrix.hpp>

List of all members.

Public Member Functions

 zgbmatrix ()
 zgbmatrix (const zgbmatrix &)
 zgbmatrix (const _zgbmatrix &)
 zgbmatrix (const long &, const long &, const long &, const long &)
 zgbmatrix (const char *)
 ~zgbmatrix ()
_zgematrix to_zgematrix () const
comple & operator() (const long &, const long &)
comple operator() (const long &, const long &) const
zgbmatrixset (const long &, const long &, const comple &)
void write (const char *) const
void read (const char *)
void clear ()
zgbmatrixzero ()
zgbmatrixidentity ()
void chsign ()
void copy (const zgbmatrix &)
void shallow_copy (const _zgbmatrix &)
void resize (const long &, const long &, const long &, const long &)
_zrovector row (const long &) const
_zcovector col (const long &) const
long zgbsv (zgematrix &)
long zgbsv (zcovector &)
zgbmatrixoperator= (const zgbmatrix &)
zgbmatrixoperator= (const _zgbmatrix &)
zgbmatrixoperator+= (const zgbmatrix &)
zgbmatrixoperator+= (const _zgbmatrix &)
zgbmatrixoperator-= (const zgbmatrix &)
zgbmatrixoperator-= (const _zgbmatrix &)
zgbmatrixoperator*= (const zgbmatrix &)
zgbmatrixoperator*= (const _zgbmatrix &)
zgbmatrixoperator*= (const double &)
zgbmatrixoperator*= (const comple &)
zgbmatrixoperator/= (const double &)
zgbmatrixoperator/= (const comple &)

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 &)
void swap (zgbmatrix &, zgbmatrix &)
_zgbmatrix _ (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

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;
  //////// initialize ////////
  m =0;
  n =0;
  kl =0;
  ku =0;
  array =NULL;
  darray =NULL;
}
zgbmatrix::zgbmatrix ( const zgbmatrix mat) [inline]

zgbmatrix copy constructor

Definition at line 20 of file zgbmatrix-constructor.hpp.

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

{VERBOSE_REPORT;
  //////// initialize ////////
  m =mat.m;
  n =mat.n;
  kl =mat.kl;
  ku =mat.ku;
  array =new comple[(kl+ku+1)*n];
  darray =new comple*[n];
  for(int i=0; i<n; i++){ darray[i] =&array[i*(kl+ku+1)]; }

  //////// copy ////////
  zcopy_((kl+ku+1)*n, mat.array, 1, array, 1);
}
zgbmatrix::zgbmatrix ( const _zgbmatrix mat) [inline]

zgbmatrix constructor to cast _zgbmatrix

Definition at line 37 of file zgbmatrix-constructor.hpp.

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

{VERBOSE_REPORT;
  m =mat.m;
  n =mat.n;
  kl =mat.kl;
  ku =mat.ku;
  array =mat.array;
  darray =mat.darray;
  
  mat.nullify();
}
zgbmatrix::zgbmatrix ( const long &  _m,
const long &  _n,
const long &  _kl,
const long &  _ku 
) [inline]

zgbmatrix constructor with size specification

Definition at line 55 of file zgbmatrix-constructor.hpp.

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){
    ERROR_REPORT;
    std::cerr << "It is impossible to make a matrix you ordered. " << std::endl
              << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  //////// initialize ////////
  m =_m;
  n =_n;
  kl =_kl;
  ku =_ku;
  array =new comple[(kl+ku+1)*n];
  darray =new comple*[n];
  for(int i=0; i<n; i++){ darray[i] =&array[i*(kl+ku+1)]; }
}
zgbmatrix::zgbmatrix ( const char *  filename) [inline]

zgbmatrix constructor with filename

Definition at line 79 of file zgbmatrix-constructor.hpp.

References array, darray, and read().

{VERBOSE_REPORT;
  array =NULL;
  darray =NULL;
  
  //// read ////
  read(filename);
}
zgbmatrix::~zgbmatrix ( ) [inline]

zgbmatrix destructor

Definition at line 94 of file zgbmatrix-constructor.hpp.

References array, and darray.

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

Member Function Documentation

_zgematrix zgbmatrix::to_zgematrix ( ) const [inline]

convert to _zgematrix

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

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

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

operator() for non-const object

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

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

Referenced by identity(), operator*=(), operator+=(), operator-=(), read(), write(), and zgbsv().

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

operator() for const object

Definition at line 20 of file zgbmatrix-io.hpp.

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

{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];
}
zgbmatrix & zgbmatrix::set ( const long &  i,
const long &  j,
const comple &  v 
) [inline]

set value for const object

Definition at line 41 of file zgbmatrix-io.hpp.

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

{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
  
  //array[ku+i+(kl+ku)*j] =v;
  darray[j][ku-j+i] =v;
  
  return *this;
}
void zgbmatrix::write ( const char *  filename) const [inline]

Definition at line 81 of file zgbmatrix-io.hpp.

References 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();
}
void zgbmatrix::read ( const char *  filename) [inline]

Definition at line 101 of file zgbmatrix-io.hpp.

References i, kl, ku, m, n, operator()(), and resize().

Referenced by zgbmatrix().

{VERBOSE_REPORT;
  std::ifstream s( filename );
  if(!s){
    ERROR_REPORT;
    std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl;
    exit(1);
  }

  std::string id;
  s >> id;
  if( id != "zgbmatrix" && id != "#zgbmatrix" ){
    ERROR_REPORT;
    std::cerr << "The type name of the file \"" << filename << "\" is not zgbmatrix." << std::endl
              << "Its type name was " << id << " ." << std::endl;
    exit(1);
  }
  
  s >> m >> n >> kl >> ku;
  resize(m, n, kl, ku);
  for(long i=0; i<m; i++){
    for(long j=std::max(long(0),i-kl); j<std::min(n,i+ku+1); j++){
      s >> operator()(i,j);
    }
  }
  if(s.eof()){
    ERROR_REPORT;
    std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl
              << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl;
    exit(1);
  }
  
  s >> id;
  if(!s.eof()){
    ERROR_REPORT;
    std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl
              << "Most likely, there are extra data components." << std::endl;
    exit(1);
  }
  
  s.close();
}
void zgbmatrix::clear ( ) [inline]

clear all the matrix data and set the sizes 0

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

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

{VERBOSE_REPORT;
  m =0;
  n =0;
  kl =0;
  ku =0;
  delete [] array;
  array =NULL;
  delete [] darray;
  darray =NULL;
}
zgbmatrix & zgbmatrix::zero ( ) [inline]

change the matrix into a zero matrix

Definition at line 18 of file zgbmatrix-misc.hpp.

References array, i, kl, ku, and n.

Referenced by col(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), row(), and to_zgematrix().

{VERBOSE_REPORT;
  for(long i=0; i<(kl+ku+1)*n; i++){
    array[i] =comple(0.0,0.0);
  }
  return *this;
}

change the matrix into an identity matrix

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

References array, i, kl, ku, m, n, and operator()().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(m!=n){
    ERROR_REPORT;
    std::cerr << "Only square matrix can be a identity matrix." << std::endl
              << "The matrix size was " << m << "x" << n << "." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(long i=0; i<(kl+ku+1)*n; i++){ array[i] =comple(0.0,0.0); }
  for(long i=0; i<m; i++){ operator()(i,i) =comple(1.0,0.0); }
  
  return *this;
}
void zgbmatrix::chsign ( ) [inline]

change sign(+/-) of the matrix

Definition at line 47 of file zgbmatrix-misc.hpp.

References array, i, kl, ku, and n.

{VERBOSE_REPORT;
  for(long i=0; i<(kl+ku+1)*n; i++){ array[i] =-array[i]; }
}
void zgbmatrix::copy ( const zgbmatrix mat) [inline]

make a deep copy of the matrix

Definition at line 54 of file zgbmatrix-misc.hpp.

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

Referenced by operator=().

{VERBOSE_REPORT;
  m =mat.m;
  n =mat.n;
  kl =mat.kl;
  ku =mat.ku;
  delete [] array;
  array =new comple[(mat.kl+mat.ku+1)*mat.n];
  delete [] darray;
  darray =new comple*[n];
  for(int i=0; i<n; i++){ darray[i] =&array[i*(kl+ku+1)]; }
  
  zcopy_((mat.kl+mat.ku+1)*mat.n, mat.array, 1, array, 1);
}
void zgbmatrix::shallow_copy ( const _zgbmatrix mat) [inline]

make a shallow copy of the matrix
This function is not designed to be used in project codes.

Definition at line 72 of file zgbmatrix-misc.hpp.

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

Referenced by operator=().

{VERBOSE_REPORT;
  m =mat.m;
  n =mat.n;
  kl =mat.kl;
  ku =mat.ku;
  delete [] array;
  array =mat.array;
  delete [] darray;
  darray =mat.darray;
  
  mat.nullify();
}
void zgbmatrix::resize ( const long &  _m,
const long &  _n,
const long &  _kl,
const long &  _ku 
) [inline]

resize the matrix

Definition at line 88 of file zgbmatrix-misc.hpp.

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

Referenced by read().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){
    ERROR_REPORT;
    std::cerr << "It is impossible to make a matrix you ordered. " << std::endl
              << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  m =_m;
  n =_n;
  kl =_kl;
  ku =_ku;
  delete [] array;
  array =new comple[(kl+ku+1)*n];
  delete [] darray;
  darray =new comple*[n];
  for(int i=0; i<n; i++){ darray[i] =&array[i*(kl+ku+1)]; }
}
_zrovector zgbmatrix::row ( const long &  _m) const [inline]

get row of the matrix

Definition at line 117 of file zgbmatrix-misc.hpp.

References _, kl, ku, m, n, and zero().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( _m<0 || _m>m ){
    ERROR_REPORT;
    std::cerr << "Input row number must be between 0 and " << m << "." << std::endl
              << "Your input was " << _m << "." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zrovector v( zrovector(n).zero() );
  for(long j=std::max(long(0),_m-kl); j<std::min(n,_m+ku+1); j++){ v(j)=(*this)(_m,j); }
  return _(v);
}
_zcovector zgbmatrix::col ( const long &  _n) const [inline]

get column of the matrix

Definition at line 135 of file zgbmatrix-misc.hpp.

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( _n<0 || _n>n ){
    ERROR_REPORT;
    std::cerr << "Input row number must be between 0 and " << n << "." << std::endl
              << "Your input was " << _n << "." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zcovector v( zcovector(m).zero() );
  for(long i=std::max(long(0),_n-ku); i<std::min(m,_n+kl+1); i++){ v(i)=(*this)(i,_n); }
  return _(v);
}
long zgbmatrix::zgbsv ( zgematrix mat) [inline]

solve A*X=Y using zgbsv
The argument is zgematrix Y. Y is overwritten and become the solution X. A is also overwritten.

Definition at line 5 of file zgbmatrix-lapack.hpp.

References zgematrix::array, array, i, kl, ku, m, zgematrix::m, n, zgematrix::n, operator()(), and swap.

Referenced by i().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(m!=n || n!=mat.m){
    ERROR_REPORT;
    std::cerr << "These matrix and vector cannot be solved." << std::endl
              << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG 
  
  zgbmatrix newmat(m,n,kl,ku+kl);
  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) =operator()(i,j);
  }}
  
  long NRHS(mat.n), LDAB(2*kl+ku+1),
    *IPIV(new long[n]), LDB(mat.m), INFO(1);
  zgbsv_(n, kl, ku, NRHS, newmat.array, LDAB, IPIV, mat.array, LDB, INFO);
  delete [] IPIV;
  
  swap(*this,newmat);
  
  if(INFO!=0){
    WARNING_REPORT;
    std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
  }
  return INFO;
}
long zgbmatrix::zgbsv ( zcovector vec) [inline]

solve A*x=y using zgbsv
The argument is zcovector y. y is overwritten and become the solution x. A is also overwritten.

Definition at line 39 of file zgbmatrix-lapack.hpp.

References zcovector::array, array, i, kl, ku, zcovector::l, m, n, operator()(), and swap.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(m!=n || n!=vec.l){
    ERROR_REPORT;
    std::cerr << "These matrix and vector cannot be solved." << std::endl
              << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG 
  
  zgbmatrix newmat(m,n,kl,ku+kl);
  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) =operator()(i,j);
  }}
  
  long NRHS(1), LDAB(2*kl+ku+1),
    *IPIV(new long[n]), LDB(vec.l), INFO(1);
  zgbsv_(n, kl, ku, NRHS, newmat.array, LDAB, IPIV, vec.array, LDB, INFO);
  delete [] IPIV;
  
  swap(*this,newmat);
  
  if(INFO!=0){
    WARNING_REPORT;
    std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
  }
  return INFO;
}
zgbmatrix & zgbmatrix::operator= ( const zgbmatrix mat) [inline]

zgbmatrix=zgbmatrix operator
The left side matrix is overwritten thoroughly including band width.

Definition at line 4 of file zgbmatrix-zgbmatrix.hpp.

References array, and copy().

{VERBOSE_REPORT;
  if(array!=mat.array){ // if it is NOT self substitution
    copy(mat);
  }
  return *this;
}
zgbmatrix & zgbmatrix::operator= ( const _zgbmatrix mat) [inline]

zgbmatrix=_zgbmatrix operator

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

References shallow_copy().

{VERBOSE_REPORT;
  shallow_copy(mat);
  return *this;
}
zgbmatrix & zgbmatrix::operator+= ( const zgbmatrix mat) [inline]

zgbmatrix+=zgbmatrix operator
If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix.

Definition at line 19 of file zgbmatrix-zgbmatrix.hpp.

References i, kl, ku, m, n, operator()(), swap, and zero().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(n!=mat.n || m!=mat.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "+=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  if(kl>=mat.kl && ku>=mat.ku){
    for(long i=0; i<m; i++){
      for(long j=std::max(long(0),i-mat.kl); j<std::min(n,i+mat.ku+1); j++){
        operator()(i,j)+=mat(i,j);
      }
    }
    
    return *this;
  }
  
  else{
    zgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku));
    newmat.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)+=operator()(i,j);
      }
      for(long j=std::max(long(0),i-mat.kl); j<std::min(mat.n,i+mat.ku+1); j++){
        newmat(i,j)+=mat(i,j);
      }
    }
    
    swap(*this,newmat);
    return *this;
  }
}
zgbmatrix & zgbmatrix::operator+= ( const _zgbmatrix mat) [inline]

zgbmatrix+=_zgbmatrix operator
If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix.

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

References _zgbmatrix::destroy(), i, kl, _zgbmatrix::kl, _zgbmatrix::ku, ku, m, _zgbmatrix::m, _zgbmatrix::n, n, operator()(), swap, and zero().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(n!=mat.n || m!=mat.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "+=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  if(kl>=mat.kl && ku>=mat.ku){
    for(long i=0; i<m; i++){
      for(long j=std::max(long(0),i-mat.kl); j<std::min(n,i+mat.ku+1); j++){
        operator()(i,j)+=mat(i,j);
      }
    }
    
    mat.destroy();
    return *this;
  }
  else{
    zgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku));
    newmat.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)+=operator()(i,j);
      }
      for(long j=std::max(long(0),i-mat.kl); j<std::min(mat.n,i+mat.ku+1); j++){
        newmat(i,j)+=mat(i,j);
      }
    }
    
    swap(*this,newmat);
    mat.destroy();
    return *this;
  }
}
zgbmatrix & zgbmatrix::operator-= ( const zgbmatrix mat) [inline]

zgbmatrix-=zgbmatrix operator
If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix.

Definition at line 60 of file zgbmatrix-zgbmatrix.hpp.

References i, kl, ku, m, n, operator()(), swap, and zero().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(n!=mat.n || m!=mat.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a subtraction." << std::endl
              << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "-=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  if(kl>=mat.kl && ku>=mat.ku){
    for(long i=0; i<m; i++){
      for(long j=std::max(long(0),i-mat.kl); j<std::min(n,i+mat.ku+1); j++){
        operator()(i,j)-=mat(i,j);
      }
    }
    
    return *this;
  }
  
  else{
    zgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku));
    newmat.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)+=operator()(i,j);
      }
      for(long j=std::max(long(0),i-mat.kl); j<std::min(mat.n,i+mat.ku+1); j++){
        newmat(i,j)-=mat(i,j);
      }
    }
    
    swap(*this,newmat);
    return *this;
  }
}
zgbmatrix & zgbmatrix::operator-= ( const _zgbmatrix mat) [inline]

zgbmatrix-=_zgbmatrix operator
If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix.

Definition at line 58 of file zgbmatrix-_zgbmatrix.hpp.

References _zgbmatrix::destroy(), i, kl, _zgbmatrix::kl, _zgbmatrix::ku, ku, m, _zgbmatrix::m, _zgbmatrix::n, n, operator()(), swap, and zero().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(n!=mat.n || m!=mat.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a subtraction." << std::endl
              << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "-=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  if(kl>=mat.kl && ku>=mat.ku){
    for(long i=0; i<m; i++){
      for(long j=std::max(long(0),i-mat.kl); j<std::min(n,i+mat.ku+1); j++){
        operator()(i,j)-=mat(i,j);
      }
    }
    
    mat.destroy();
    return *this;
  }
  else{
    zgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku));
    newmat.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)+=operator()(i,j);
      }
      for(long j=std::max(long(0),i-mat.kl); j<std::min(mat.n,i+mat.ku+1); j++){
        newmat(i,j)-=mat(i,j);
      }
    }
    
    swap(*this,newmat);
    mat.destroy();
    return *this;
  }
}
zgbmatrix & zgbmatrix::operator*= ( const zgbmatrix mat) [inline]

zgbmatrix*=zgbmatrix operator

Definition at line 100 of file zgbmatrix-zgbmatrix.hpp.

References i, kl, ku, m, n, operator()(), swap, and zero().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(n!=mat.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << m << "x" << n << ") * (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgbmatrix newmat( m, mat.n, std::min(kl+mat.kl, m-1), std::min(ku+mat.ku, mat.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-kl), std::max(long(0),j-mat.ku) );
          k< std::min( std::min(n,i+ku+1), std::min(mat.m,j+mat.kl+1) ); k++){
        newmat(i,j)+= operator()(i,k)*mat(k,j);
      }
    }
  }
  
  swap(*this,newmat);
  return *this;
}
zgbmatrix & zgbmatrix::operator*= ( const _zgbmatrix mat) [inline]

zgbmatrix*=_zgbmatrix operator

Definition at line 99 of file zgbmatrix-_zgbmatrix.hpp.

References _zgbmatrix::destroy(), i, kl, _zgbmatrix::kl, _zgbmatrix::ku, ku, _zgbmatrix::m, m, _zgbmatrix::n, n, operator()(), swap, and zero().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(n!=mat.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << m << "x" << n << ") * (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgbmatrix newmat( m, mat.n, std::min(kl+mat.kl, m-1), std::min(ku+mat.ku, mat.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-kl), std::max(long(0),j-mat.ku) );
          k< std::min( std::min(n,i+ku+1), std::min(mat.m,j+mat.kl+1) ); k++){
        newmat(i,j)+= operator()(i,k)*mat(k,j);
      }
    }
  }
  
  swap(*this,newmat);
  mat.destroy();
  return *this;
}
zgbmatrix & zgbmatrix::operator*= ( const double &  d) [inline]

zgbmatrix*=double operator

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

References array, kl, ku, and n.

{VERBOSE_REPORT;
  zdscal_((kl+ku+1)*n, d, array, 1);
  return *this;
}
zgbmatrix & zgbmatrix::operator*= ( const comple &  d) [inline]

zgbmatrix*=comple operator

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

References array, kl, ku, and n.

{VERBOSE_REPORT;
  zscal_((kl+ku+1)*n, d, array, 1);
  return *this;
}
zgbmatrix & zgbmatrix::operator/= ( const double &  d) [inline]

zgbmatrix/=double operator

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

References array, kl, ku, and n.

{VERBOSE_REPORT;
  zdscal_((kl+ku+1)*n, 1./d, array, 1);
  return *this;
}
zgbmatrix & zgbmatrix::operator/= ( const comple &  d) [inline]

zgbmatrix/=comple operator

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

References array, kl, ku, and n.

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

Friends And Related Function Documentation

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

Definition at line 63 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;
  }
  
  return s;
}
void swap ( zgbmatrix A,
zgbmatrix B 
) [friend]

swap two matrices

Definition at line 157 of file zgbmatrix-misc.hpp.

Referenced by operator*=(), operator+=(), operator-=(), and zgbsv().

{VERBOSE_REPORT;
  long A_m(A.m), A_n(A.n), A_kl(A.kl), A_ku(A.ku);
  comple* A_array(A.array);
  //comple** A_darray(A.darray);
  comple** A_darray=A.darray; //corruption to support VC++

  A.m=B.m; A.n=B.n; A.kl=B.kl; A.ku=B.ku; A.array=B.array; A.darray=B.darray;
  B.m=A_m; B.n=A_n; B.kl=A_kl; B.ku=A_ku; B.array=A_array; B.darray=A_darray;
}
_zgbmatrix _ ( zgbmatrix mat) [friend]

convert user object to smart-temporary object

Definition at line 170 of file zgbmatrix-misc.hpp.

Referenced by col(), row(), and to_zgematrix().

{VERBOSE_REPORT;
  _zgbmatrix newmat;
  
  //////// shallow copy ////////
  newmat.m =mat.m;
  newmat.n =mat.n;
  newmat.kl =mat.kl;
  newmat.ku =mat.ku;
  newmat.array =mat.array;
  newmat.darray =mat.darray;
  
  //////// nullify ////////
  mat.m =0;
  mat.n =0;
  mat.kl =0;
  mat.ku =0;
  mat.array =NULL;
  mat.darray =NULL;
  
  return newmat;
}
_zgbmatrix t ( const zgbmatrix mat) [friend]

return 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);
    }
  }
  
  return _(newmat);
}
_zgematrix i ( const zgbmatrix mat) [friend]

return its inverse matrix

Definition at line 17 of file zgbmatrix-calc.hpp.

Referenced by chsign(), col(), copy(), identity(), operator()(), operator*=(), operator+=(), operator-=(), read(), resize(), set(), to_zgematrix(), write(), zero(), zgbmatrix(), and zgbsv().

{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.m,mat.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 42 of file zgbmatrix-calc.hpp.

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

return its conjugate transposed zgbmatrix

Definition at line 55 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));
    }
  }
  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;
  zgbmatrix newmat(mat.m,mat.n,mat.kl,mat.ku);
  for(long i=0; i<(newmat.kl+newmat.ku+1)*newmat.n; i++){
    newmat.array[i]=-mat.array[i];
  }
  
  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

  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);
    }
  }
  
  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);
    }
  }
  
  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.n!=matB.n || matA.m!=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);
    }
  }
  
  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.n!=matB.n || matA.m!=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);
    }
  }
  
  matB.destroy();
  return _(newmat);
}
_zgbmatrix operator+ ( const zgbmatrix matA,
const zgbmatrix matB 
) [friend]

zgbmatrix+zgbmatrix operator

Definition at line 133 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
  
  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 133 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(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);
      }
    }
    
    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);
      }
    }
    
    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 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
  
  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);
    }
  }
  
  return _(newmat);
}
_zgematrix operator- ( const zgbmatrix matA,
const _zgematrix matB 
) [friend]

zgbmatrix-_zgematrix operator

Definition at line 25 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
  
  //// change sign ////
  for(long i=0; i<matB.m*matB.n; i++){
    matB.array[i] = -matB.array[i];
  }
  
  //// add ////
  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);
    }
  }
  
  return matB;
}
_zgematrix operator- ( const zgbmatrix matA,
const zhematrix matB 
) [friend]

zgbmatrix-zhematrix operator

Definition at line 29 of file zgbmatrix-zhematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.m!=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);
    }
  }
  
  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.n!=matB.n || matA.m!=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);
    }
  }
  
  matB.destroy();
  return _(newmat);
}
_zgbmatrix operator- ( const zgbmatrix matA,
const zgbmatrix matB 
) [friend]

zgbmatrix-zgbmatrix operator

Definition at line 161 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
  
  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 173 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
  
  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);
    }
  }
  
  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 );
  
  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 );
  
  vec.destroy();
  return _(newvec);
}
_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);
      }
    }
  }
  
  return _(newmat);
}
_zgematrix operator* ( const zgbmatrix matA,
const _zgematrix matB 
) [friend]

zgbmatrix*_zgematrix operator

Definition at line 53 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);
      }
    }
  }
  
  matB.destroy();
  return _(newmat);
}
_zgematrix operator* ( const zgbmatrix matA,
const zhematrix matB 
) [friend]

zgbmatrix*zhematrix operator

Definition at line 55 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);
      }
    }
  }
  
  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);
      }
    }
  }
  
  matB.destroy();
  return _(newmat);
}
_zgbmatrix operator* ( const zgbmatrix matA,
const zgbmatrix matB 
) [friend]

zgbmatrix*zgbmatrix operator

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

zgbmatrix*_zgbmatrix operator

Definition at line 202 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);
      }
    }
  }
  
  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 23 of file zgbmatrix-double.hpp.

{VERBOSE_REPORT;
  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
  for(long i=0; i<(newmat.kl+newmat.ku+1)*newmat.n; i++){
    newmat.array[i] =mat.array[i]*d;
  }
  
  return _(newmat);
}
_zgbmatrix operator* ( const zgbmatrix mat,
const comple &  d 
) [friend]

zgbmatrix*comple operator

Definition at line 23 of file zgbmatrix-complex.hpp.

{VERBOSE_REPORT;
  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
  for(long i=0; i<(newmat.kl+newmat.ku+1)*newmat.n; i++){
    newmat.array[i] =mat.array[i]*d;
  }
  
  return _(newmat);
}
_zgbmatrix operator/ ( const zgbmatrix mat,
const double &  d 
) [friend]

zgbmatrix/double operator

Definition at line 35 of file zgbmatrix-double.hpp.

{VERBOSE_REPORT;
  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
  for(long i=0; i<(newmat.kl+newmat.ku+1)*newmat.n; i++){
    newmat.array[i] =mat.array[i]/d;
  }
  
  return _(newmat);
}
_zgbmatrix operator/ ( const zgbmatrix mat,
const comple &  d 
) [friend]

zgbmatrix/comple operator

Definition at line 35 of file zgbmatrix-complex.hpp.

{VERBOSE_REPORT;
  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
  for(long i=0; i<(newmat.kl+newmat.ku+1)*newmat.n; i++){
    newmat.array[i] =mat.array[i]/d;
  }
  
  return _(newmat);
}
_zgbmatrix operator* ( const double &  d,
const zgbmatrix mat 
) [friend]

double*zgbmatrix operator

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

{VERBOSE_REPORT;
  zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku);
  for(long i=0; i<(newmat.kl+newmat.ku+1)*newmat.n; i++){
    newmat.array[i] =d*mat.array[i];
  }  
  return _(newmat);
}
_zgbmatrix operator* ( const comple &  d,
const zgbmatrix mat 
) [friend]

comple*zgbmatrix operator

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

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

Member Data Documentation

array of pointers of column head addresses

Definition at line 14 of file zgbmatrix.hpp.

Referenced by _(), clear(), copy(), operator()(), resize(), set(), shallow_copy(), swap(), zgbmatrix(), and ~zgbmatrix().


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