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

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

#include <_zhematrix.hpp>

List of all members.

Public Member Functions

 _zhematrix ()
 _zhematrix (const _zhematrix &)
 ~_zhematrix ()
_zgematrix to_zgematrix () const
zhecomplex operator() (const long &, const long &) const
void write (const char *) const
void nullify () const
void destroy () const
void complete () const

Public Attributes

long const & m
 matrix row and size
long n
 matrix column size
comple * array
 1D array to store matrix data
comple ** darray
 array of pointers of column head addresses

Friends

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

Detailed Description

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

Definition at line 3 of file _zhematrix.hpp.


Constructor & Destructor Documentation

_zhematrix::_zhematrix ( ) [inline]

_zhematrix constructor without arguments

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

References array, darray, and n.

  :m(n)
{VERBOSE_REPORT;
  //////// initialize ////////
  n =0;
  array =NULL;
  darray =NULL;
}
_zhematrix::_zhematrix ( const _zhematrix mat) [inline]

_zhematrix copy constructor

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

References array, darray, n, and nullify().

  :m(n)
{VERBOSE_REPORT;
  //////// initialize ////////
  n =mat.n;
  array =mat.array;
  darray =mat.darray;
  
  mat.nullify();
}

zhematrix destructor

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

References array, and darray.

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

Member Function Documentation

convert to _zgematrix

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

References _(), destroy(), i, and n.

Referenced by operator*(), operator+(), and operator/().

{VERBOSE_REPORT;
  zgematrix newmat(n,n);
  for(long i=0; i<n; i++){
    for(long j=0; j<n; j++){
      newmat(i,j) =(*this)(i,j);
    }
  }
  
  destroy();
  return _(newmat);
}
zhecomplex _zhematrix::operator() ( const long &  i,
const long &  j 
) const [inline]

operator() for object

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

References darray, and n.

Referenced by write().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( i<0 || j<0 || n<=i || n<=j ){
    ERROR_REPORT;
    std::cerr << "The required component is out of the matrix size." << std::endl
              << "Your input was (" << i << "," << j << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  if(i>=j){ return zhecomplex(i,j, darray[j][i]); }
  else    { return zhecomplex(i,j, darray[i][j]); }
}
void _zhematrix::write ( const char *  filename) const [inline]

Definition at line 50 of file _zhematrix-io.hpp.

References destroy(), i, imag(), 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 << "#zhematrix" << " " << n << std::endl;
  for(long i=0; i<n; i++){
    for(long j=0; j<=i; j++ ){
      ofs << operator()(i,j) << " ";
    }
    ofs << std::endl;
    
#ifdef  CPPL_DEBUG
    if(std::fabs(std::imag(operator()(i,i))) > DBL_MIN){
      WARNING_REPORT;
      std::cerr << "The " << i << "th diagonal component of the zhematrix is not a real number." << std::endl;
    }
#endif//CPPL_DEBUG
  }
  
  ofs.close();
  destroy();
}
void _zhematrix::nullify ( ) const [inline]

nullify all the matrix data

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

References array, darray, and n.

Referenced by _zhematrix(), zhematrix::shallow_copy(), and zhematrix::zhematrix().

{VERBOSE_REPORT;
  n=0;
  array=NULL;
  darray=NULL;
}
void _zhematrix::destroy ( ) const [inline]

destroy all the matrix data

Definition at line 12 of file _zhematrix-misc.hpp.

References array, and darray.

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

{VERBOSE_REPORT;
  delete [] array;
  delete [] darray;
  array=NULL;
  darray=NULL;
}
void _zhematrix::complete ( ) const [inline]

complete the upper-right components

Definition at line 22 of file _zhematrix-misc.hpp.

References conj(), darray, i, and n.

Referenced by operator*().

{VERBOSE_REPORT;
  for(long i=0; i<n; i++){
    for(long j=0; j<i; j++){
      darray[i][j] =std::conj(darray[j][i]);
    }
  }
}

Friends And Related Function Documentation

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

Definition at line 65 of file zhematrix-io.hpp.

{VERBOSE_REPORT;
  for(long i=0; i<mat.n; i++){
    for(long j=0; j<mat.n; j++){ 
      if(i>j){ s << " " << mat(i,j) << " "; }
      else if(i==j){ s << " " << std::real(mat(i,i)) << " "; }
      else{ s << "{" << std::conj(mat(j,i)) << "} "; }
    }
    s << std::endl;
    
#ifdef  CPPL_DEBUG
    if(std::fabs(std::imag(mat(i,i))) > DBL_MIN){
      WARNING_REPORT;
      std::cerr << "The " << i << "th diagonal component of the zhematrix is not a real number." << std::endl;
    }
#endif//CPPL_DEBUG
  }
  
  return s;
}
_zhematrix t ( const _zhematrix mat) [friend]

return transposed _zhematrix

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  WARNING_REPORT;
  std::cerr << "This function call has no effect since the matrix is symmetric." << std::endl;
#endif//CPPL_DEBUG
  
  return mat;
}
_zgematrix i ( const _zhematrix mat) [friend]

return its inverse matrix

Definition at line 15 of file _zhematrix-calc.hpp.

Referenced by complete(), to_zgematrix(), and write().

{VERBOSE_REPORT;
  zhematrix mat_cp(mat);
  zgematrix mat_inv(mat_cp.n,mat_cp.n);
  mat_inv.identity();
  mat_cp.zhesv(mat_inv);
  
  return _(mat_inv);
}
const _zhematrix& operator+ ( const _zhematrix mat) [friend]

+_zhematrix operator

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

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

-_zhematrix operator

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

{VERBOSE_REPORT;
  for(long i=0; i<mat.n; i++){
    for(long j=0; j<=i; j++){
      mat.array[i+mat.n*j] =-mat.array[i+mat.n*j];
    }
  }
  
  return mat;
}
_zgematrix operator+ ( const _zhematrix matA,
const zgematrix matB 
) [friend]

_zhematrix+zgematrix operator

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

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

_zgematrix+zhematrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(long i=0; i<matA.n; i++){ for(long j=0; j<matA.n; j++){
    matB(i,j)+=matA(i,j);
  }}
  
  matA.destroy();
  return matB;
}
_zhematrix operator+ ( const _zhematrix matA,
const zhematrix matB 
) [friend]

_zhematrix+zhematrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(long i=0; i<matA.n; i++){
    for(long j=0; j<matA.n; j++){
      matA.array[i+matA.n*j]+=matB.array[i+matA.n*j];
    }
  }
  
  return matA;
}
_zhematrix operator+ ( const _zhematrix matA,
const _zhematrix matB 
) [friend]

_zhematrix+_zhematrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(long i=0; i<matA.n; i++){
    for(long j=0; j<matA.n; j++){
      matA.array[i+matA.n*j]+=matB.array[i+matA.n*j];
    }
  }

  matB.destroy();
  return matA;
}
_zgematrix operator+ ( const _zhematrix matA,
const zgbmatrix matB 
) [friend]

_zhematrix+zgbmatrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat(matA.n, matA.n);
  for(long i=0; i<matB.m; i++){
    for(long j=0; j<matA.n; 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);
}
_zgematrix operator+ ( const _zhematrix matA,
const _zgbmatrix matB 
) [friend]

_zhematrix+_zgbmatrix operator

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

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat(matA.n, matA.n);
  for(long i=0; i<matB.m; i++){
    for(long j=0; j<matA.n; 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 _zhematrix ,
const zgsmatrix  
) [friend]
_zgematrix operator+ ( const _zhematrix ,
const _zgsmatrix  
) [friend]
_zhematrix operator+ ( const _zhematrix ,
const zhsmatrix  
) [friend]
_zhematrix operator+ ( const _zhematrix ,
const _zhsmatrix  
) [friend]
_zgematrix operator- ( const _zhematrix matA,
const zgematrix matB 
) [friend]

_zhematrix-zgematrix operator

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

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

_zhematrix-zgematrix operator

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

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

  for(long i=0; i<matA.n; i++){ for(long j=0; j<matA.n; j++){
    matB(i,j) =matA(i,j)-matB(i,j);
  }}
  
  matA.destroy();
  return matB;
}
_zhematrix operator- ( const _zhematrix matA,
const zhematrix matB 
) [friend]

_zhematrix-zhematrix operator

Definition at line 25 of file _zhematrix-zhematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a subtraction." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(long i=0; i<matA.n; i++){
    for(long j=0; j<matA.n; j++){
      matA.array[i+matA.n*j]-=matB.array[i+matA.n*j];
    }
  }
  
  return matA;
}
_zhematrix operator- ( const _zhematrix matA,
const _zhematrix matB 
) [friend]

_zhematrix-_zhematrix operator

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

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

  for(long i=0; i<matA.n; i++){
    for(long j=0; j<matA.n; j++){
      matA.array[i+matA.n*j]-=matB.array[i+matA.n*j];
    }
  }

  matB.destroy();
  return matA;
}
_zgematrix operator- ( const _zhematrix matA,
const zgbmatrix matB 
) [friend]

_zhematrix-zgbmatrix operator

Definition at line 30 of file _zhematrix-zgbmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat(matA.n, matA.n);
  for(long i=0; i<matB.m; i++){
    for(long j=0; j<matA.n; 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);
}
_zgematrix operator- ( const _zhematrix matA,
const _zgbmatrix matB 
) [friend]

_zhematrix-_zgbmatrix operator

Definition at line 31 of file _zhematrix-_zgbmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n || matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a summation." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat(matA.n, matA.n);
  for(long i=0; i<matB.m; i++){
    for(long j=0; j<matA.n; 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 _zhematrix ,
const zgsmatrix  
) [friend]
_zgematrix operator- ( const _zhematrix ,
const _zgsmatrix  
) [friend]
_zhematrix operator- ( const _zhematrix ,
const zhsmatrix  
) [friend]
_zhematrix operator- ( const _zhematrix ,
const _zhsmatrix  
) [friend]
_zcovector operator* ( const _zhematrix mat,
const zcovector vec 
) [friend]

_zhematrix*zcovector operator

Definition at line 3 of file _zhematrix-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.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zcovector newvec(mat.n);
  zhemv_( 'l', mat.n, comple(1.0,0.0), mat.array, mat.n,
          vec.array, 1, comple(0.0,0.0), newvec.array, 1 );
  
  mat.destroy();
  return _(newvec);
}
_zcovector operator* ( const _zhematrix mat,
const _zcovector vec 
) [friend]

_zhematrix*_zcovector operator

Definition at line 3 of file _zhematrix-_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.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zcovector newvec(mat.n);
  zhemv_( 'l', mat.n, comple(1.0,0.0), mat.array, mat.n,
          vec.array, 1, comple(0.0,0.0), newvec.array, 1 );
  
  mat.destroy();
  vec.destroy();
  return _(newvec);
}
_zgematrix operator* ( const _zhematrix matA,
const zgematrix matB 
) [friend]

_zhematrix*zgematrix operator

Definition at line 49 of file _zhematrix-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.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat( matA.n, matB.n );
  zhemm_( 'l', 'l', matA.n, matB.n, comple(1.0,0.0),
          matA.array, matA.n, matB.array, matB.m,
          comple(0.0,0.0), newmat.array, newmat.m );
  
  matA.destroy();
  return _(newmat);
}
_zgematrix operator* ( const _zhematrix matA,
const _zgematrix matB 
) [friend]

_zgematrix*zgematrix operator

Definition at line 45 of file _zhematrix-_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.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat( matA.n, matB.n );
  zhemm_( 'l', 'l', matA.n, matB.n, comple(1.0,0.0), 
          matA.array, matA.n, matB.array, matB.m, 
          comple(0.0,0.0), newmat.array, newmat.m );
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_zgematrix operator* ( const _zhematrix matA,
const zhematrix matB 
) [friend]

_zhematrix*zhematrix operator

Definition at line 47 of file _zhematrix-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.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  matB.complete();
  zgematrix newmat( matA.n, matB.n );
  
  zhemm_( 'l', 'l', matA.n, matB.n, comple(1.0,0.0), 
          matA.array, matA.n, matB.array, matB.n, 
          comple(0.0,0.0), newmat.array, newmat.m );
  
  matA.destroy();
  return _(newmat);
}
_zgematrix operator* ( const _zhematrix matA,
const _zhematrix matB 
) [friend]

_zhematrix*_zhematrix operator

Definition at line 49 of file _zhematrix-_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.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  matB.complete();
  zgematrix newmat( matA.n, matB.n );
  
  zhemm_( 'l', 'l', matA.n, matB.n, comple(1.0,0.0), 
          matA.array, matA.n, matB.array, matB.n, 
          comple(0.0,0.0), newmat.array, newmat.m );
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_zgematrix operator* ( const _zhematrix matA,
const zgbmatrix matB 
) [friend]

_zgematrix*zgbmatrix operator

Definition at line 57 of file _zhematrix-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.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat( matA.n, 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),j-matB.ku); k<std::min(matB.m,j+matB.kl+1); k++){
        newmat(i,j)+=matA(i,k)*matB(k,j);
      }
    }
  }
  
  matA.destroy();
  return _(newmat);
}
_zgematrix operator* ( const _zhematrix matA,
const _zgbmatrix matB 
) [friend]

_zhematrix*_zgbmatrix operator

Definition at line 59 of file _zhematrix-_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.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  zgematrix newmat( matA.n, 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),j-matB.ku); k<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 _zhematrix ,
const zgsmatrix  
) [friend]
_zgematrix operator* ( const _zhematrix ,
const _zgsmatrix  
) [friend]
_zgematrix operator* ( const _zhematrix ,
const zhsmatrix  
) [friend]
_zgematrix operator* ( const _zhematrix ,
const _zhsmatrix  
) [friend]
_zhematrix operator* ( const _zhematrix mat,
const double &  d 
) [friend]

_zhematrix*double operator

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

{VERBOSE_REPORT;
  zdscal_(mat.n*mat.n, d, mat.array, 1);
  return mat;
}
_zgematrix operator* ( const _zhematrix mat,
const comple &  d 
) [friend]

_zhematrix*comple operator

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

{VERBOSE_REPORT;
  zgematrix newmat( mat.to_zgematrix() );
  zscal_(mat.n*mat.n, d, newmat.array, 1);
  
  return _(newmat);
}
_zhematrix operator/ ( const _zhematrix mat,
const double &  d 
) [friend]

_zhematrix/double operator

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

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

zhematrix/comple operator

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

{VERBOSE_REPORT;
  zgematrix newmat( mat.to_zgematrix() );
  zscal_(mat.n*mat.n, 1./d, newmat.array, 1);
  
  return _(newmat);
}
_zhematrix operator* ( const double &  d,
const _zhematrix mat 
) [friend]

double*_zhematrix operator

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

{VERBOSE_REPORT;
  zdscal_(mat.n*mat.n, d, mat.array, 1);
  return mat;
}
_zgematrix operator* ( const comple &  d,
const _zhematrix mat 
) [friend]

comple*_zhematrix operator

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

{VERBOSE_REPORT;
  zgematrix newmat( mat.to_zgematrix() );
  zscal_(mat.n*mat.n, d, newmat.array, 1);
  
  mat.destroy();
  return _(newmat);
}

Member Data Documentation

long const& _zhematrix::m [mutable]

matrix row and size

Definition at line 9 of file _zhematrix.hpp.

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

long _zhematrix::n [mutable]
comple* _zhematrix::array [mutable]
comple** _zhematrix::darray [mutable]

array of pointers of column head addresses

Definition at line 12 of file _zhematrix.hpp.

Referenced by _(), _zhematrix(), complete(), destroy(), nullify(), operator()(), operator<<(), zhematrix::shallow_copy(), zhematrix::zhematrix(), and ~_zhematrix().


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