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

Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage]. More...

#include <zhematrix.hpp>

List of all members.

Public Member Functions

 zhematrix ()
 zhematrix (const zhematrix &)
 zhematrix (const _zhematrix &)
 zhematrix (const long &)
 zhematrix (const char *)
 ~zhematrix ()
_zgematrix to_zgematrix () const
zhecomplex operator() (const long &, const long &)
comple operator() (const long &, const long &) const
zhematrixset (const long &, const long &, const comple &)
void write (const char *) const
void read (const char *)
void complete () const
void clear ()
zhematrixzero ()
zhematrixidentity ()
void chsign ()
void copy (const zhematrix &)
void shallow_copy (const _zhematrix &)
void resize (const long &)
_zrovector row (const long &) const
_zcovector col (const long &) const
long zhesv (zgematrix &)
long zhesv (zcovector &)
long zheev (std::vector< double > &, const bool &)
long zheev (std::vector< double > &, std::vector< zcovector > &)
long zheev (std::vector< double > &, std::vector< zrovector > &)
zhematrixoperator= (const zhematrix &)
zhematrixoperator= (const _zhematrix &)
zhematrixoperator+= (const zhematrix &)
zhematrixoperator+= (const _zhematrix &)
zhematrixoperator-= (const zhematrix &)
zhematrixoperator-= (const _zhematrix &)
zhematrixoperator*= (const zhematrix &)
zhematrixoperator*= (const _zhematrix &)
zhematrixoperator*= (const double &)
zhematrixoperator/= (const double &)

Public Attributes

long const & m
 matrix row 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 &)
void swap (zhematrix &, zhematrix &)
_zhematrix _ (zhematrix &)
_zhematrix t (const zhematrix &)
_zgematrix i (const zhematrix &)
_zhematrix conj (const zhematrix &)
_zhematrix conjt (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 &)
_zgematrix operator+ (const zhematrix &, const zhsmatrix &)
_zgematrix 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 &)
_zgematrix operator- (const zhematrix &, const zhsmatrix &)
_zgematrix 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

Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].

The imaginary part of every diagonal component is not referenced.

Definition at line 4 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 18 of file zhematrix-constructor.hpp.

References array, darray, i, and n.

  : m(n)
{VERBOSE_REPORT;
  //////// initialize ////////
  n =mat.n;
  array =new comple[n*n];
  darray =new comple*[n];
  for(int i=0; i<n; i++){ darray[i] =&array[i*n]; }
  
  //////// copy ////////
  zcopy_(n*n, mat.array, 1, array, 1);
}
zhematrix::zhematrix ( const _zhematrix mat) [inline]

zhematrix constructor to cast _zhematrix

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

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

  : m(n)
{VERBOSE_REPORT;
  n =mat.n;
  array =mat.array;
  darray =mat.darray;
  
  mat.nullify();
}
zhematrix::zhematrix ( const long &  _n) [inline]

zhematrix constructor with size specification

Definition at line 49 of file zhematrix-constructor.hpp.

References array, darray, i, and n.

  : m(n)
{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( _n<0 ){
    ERROR_REPORT;
    std::cerr << "Matrix sizes must be positive integers. " << std::endl
              << "Your input was (" << _n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  //////// initialize ////////
  n =_n;
  array =new comple[n*n];
  darray =new comple*[n];
  for(int i=0; i<n; i++){ darray[i] =&array[i*n]; }
}
zhematrix::zhematrix ( const char *  filename) [inline]

zhematrix constructor with filename

Definition at line 70 of file zhematrix-constructor.hpp.

References array, darray, and read().

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

zhematrix destructor

Definition at line 86 of file zhematrix-constructor.hpp.

References array, and darray.

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

Member Function Documentation

_zgematrix zhematrix::to_zgematrix ( ) const [inline]

convert to _zgematrix

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

References _, i, and n.

Referenced by 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);
    }
  }
  
  return _(newmat);
}
zhecomplex zhematrix::operator() ( const long &  i,
const long &  j 
) [inline]

operator() for non-const object

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

References darray, and n.

Referenced by operator+=(), operator-=(), and 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]); }
}
comple zhematrix::operator() ( const long &  i,
const long &  j 
) const [inline]

operator() for const object

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

References conj, darray, i, and n.

{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 darray[j][i]; }
  else    { return std::conj(darray[i][j]); }
}
zhematrix & zhematrix::set ( const long &  i,
const long &  j,
const comple &  v 
) [inline]

set value for const object

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

References conj, darray, i, and n.

{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){ array[i+n*j] = v; }
  //else{ array[j+n*i] = std::conj(v); }
  if(i>=j){ darray[j][i] = v; }
  else{ darray[i][j] = std::conj(v); }
  
  return *this;
}
void zhematrix::write ( const char *  filename) const [inline]

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

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

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

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

Referenced by zhematrix().

{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 != "zhematrix" && id != "#zhematrix" ){
    ERROR_REPORT;
    std::cerr << "The type name of the file \"" << filename << "\" is not zhematrix." << std::endl
              << "Its type name was " << id << " ." << std::endl;
    exit(1);
  }
  
  s >> n;
  resize(n);
  for(long i=0; i<n; i++){
    for(long j=0; j<=i; j++ ){
      s >> darray[j][i];
      //s >> operator()(i,j); //NG
    }
  }
  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 zhematrix::complete ( ) const [inline]

complete the upper-right components

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

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

Referenced by operator*(), and 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]);
    }    
#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
  }
}
void zhematrix::clear ( ) [inline]

clear all the matrix data and set the sizes 0

Definition at line 20 of file zhematrix-misc.hpp.

References array, darray, and n.

{VERBOSE_REPORT;
  n =0;
  delete [] array;
  array =NULL;
  delete [] darray;
  darray =NULL;
}
zhematrix & zhematrix::zero ( ) [inline]

change the matrix into a zero matrix

Definition at line 31 of file zhematrix-misc.hpp.

References darray, i, and n.

Referenced by _zhsmatrix::to_zhematrix(), and zhsmatrix::to_zhematrix().

{VERBOSE_REPORT;
  for(long i=0; i<n; i++){
    for(long j=0; j<=i; j++){
      darray[j][i]=comple(0.0,0.0);
    }
  }
  return *this;
}

change the matrix into an identity matrix

Definition at line 43 of file zhematrix-misc.hpp.

References darray, i, and n.

{VERBOSE_REPORT;
  for(long i=0; i<n; i++){
    for(long j=0; j<i; j++){
      darray[j][i] =comple(0.0,0.0);
    }
    darray[i][i] =comple(1.0,0.0);
  }
  
  return *this;
}
void zhematrix::chsign ( ) [inline]

change sign(+/-) of the matrix

Definition at line 57 of file zhematrix-misc.hpp.

References darray, i, and n.

{VERBOSE_REPORT;
  for(long i=0; i<n; i++){
    for(long j=0; j<=i; j++){
      darray[j][i] =-darray[j][i];
    }
  }
}
void zhematrix::copy ( const zhematrix mat) [inline]

make a deep copy of the matrix

Definition at line 68 of file zhematrix-misc.hpp.

References array, darray, i, and n.

Referenced by operator=().

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

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

Definition at line 83 of file zhematrix-misc.hpp.

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

Referenced by operator=().

{VERBOSE_REPORT;
  n =mat.n;
  delete [] array;
  array =mat.array;
  delete [] darray;
  darray =mat.darray;
  
  mat.nullify();
}
void zhematrix::resize ( const long &  _n) [inline]

resize the matrix

Definition at line 96 of file zhematrix-misc.hpp.

References array, darray, i, and n.

Referenced by read().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( _n<0 ){
    ERROR_REPORT;
    std::cerr << "Matrix sizes must be positive integers." << std::endl
              << "Your input was (" << _n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  n =_n;
  delete [] array;
  array =new comple[n*n];
  delete [] darray;
  darray =new comple*[n];
  for(int i=0; i<n; i++){ darray[i] =&array[i*n]; }
}
_zrovector zhematrix::row ( const long &  _m) const [inline]

get row of the matrix

Definition at line 121 of file zhematrix-misc.hpp.

References _, m, and n.

{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(n);
  for(long j=0; j<n; j++){ v(j)=(*this)(_m,j); }
  return _(v);
}
_zcovector zhematrix::col ( const long &  _n) const [inline]

get column of the matrix

Definition at line 139 of file zhematrix-misc.hpp.

References _, i, m, and n.

{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(m);
  for(long i=0; i<m; i++){ v(i)=(*this)(i,_n); }
  return _(v);
}
long zhematrix::zhesv ( zgematrix mat) [inline]

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

Definition at line 6 of file zhematrix-lapack.hpp.

References zgematrix::array, array, zgematrix::n, and n.

Referenced by i().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(n!=mat.n){
    ERROR_REPORT;
    std::cerr << "These two matrices cannot be solved." << std::endl
              << "Your input was (" << n << "x" << n << ") and (" << mat.n << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  char UPLO('l');
  long NRHS(mat.n), LDA(n), *IPIV(new long[n]), LDB(mat.n), LWORK(-1), INFO(1);
  comple *WORK(new comple[1]);
  zhesv_(UPLO, n, NRHS, array, LDA, IPIV, mat.array, LDB, WORK, LWORK, INFO);
  
  INFO=1;
  LWORK = long(std::real(WORK[0]));
  delete [] WORK;  WORK =new comple[LWORK];
  zhesv_(UPLO, n, NRHS, array, LDA, IPIV, mat.array, LDB, WORK, LWORK, INFO);
  delete [] WORK; delete [] IPIV;
  
  if(INFO!=0){
    WARNING_REPORT;
    std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
  }
  return INFO;
}
long zhematrix::zhesv ( zcovector vec) [inline]

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

Definition at line 40 of file zhematrix-lapack.hpp.

References zcovector::array, array, zcovector::l, and n.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(n!=vec.l){
    ERROR_REPORT;
    std::cerr << "These matrix and vector cannot be solved." << std::endl
              << "Your input was (" << n << "x" << n << ") and (" << vec.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG 
  
  char UPLO('l');
  long NRHS(1), LDA(n), *IPIV(new long[n]), LDB(vec.l), LWORK(-1), INFO(1);
  comple *WORK( new comple[1] );
  zhesv_(UPLO, n, NRHS, array, LDA, IPIV, vec.array, LDB, WORK, LWORK, INFO);
  
  INFO=1;
  LWORK = long(std::real(WORK[0]));
  delete [] WORK;  WORK = new comple[LWORK];
  zhesv_(UPLO, n, NRHS, array, LDA, IPIV, vec.array, LDB, WORK, LWORK, INFO);
  delete [] WORK;  delete [] IPIV;
  
  if(INFO!=0){
    WARNING_REPORT;
    std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
  }
  return INFO;
}
long zhematrix::zheev ( std::vector< double > &  w,
const bool &  jobz = 0 
) [inline]

calculate eigenvalues and eigenvectors.
All of the arguments need not to be initialized. w is overwitten and become eigenvalues. This matrix is also overwritten. if jobz=1, this matrix becomes eigenvectors.

Definition at line 80 of file zhematrix-lapack.hpp.

References array, and n.

{VERBOSE_REPORT;
  w.resize(n);
  char JOBZ, UPLO('l');
  if(jobz==0){ JOBZ='n'; } else{ JOBZ='V'; }
  long LDA(n), INFO(1), LWORK(-1);
  double *RWORK(new double[std::max(long(1), 3*n-2)]);
  comple *WORK(new comple[1]);
  zheev_(JOBZ, UPLO, n, array, LDA, &w[0], WORK, LWORK, RWORK, INFO);
  
  INFO=1;
  LWORK = long(std::real(WORK[0]));
  delete [] WORK;  WORK = new comple[LWORK];
  zheev_(JOBZ, UPLO, n, array, LDA, &w[0], WORK, LWORK, RWORK, INFO);
  delete [] RWORK;  delete [] WORK;
  
  if(INFO!=0){
    WARNING_REPORT;
    std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
  }
  return INFO;
}
long zhematrix::zheev ( std::vector< double > &  w,
std::vector< zcovector > &  v 
) [inline]

calculate eigenvalues and eigenvectors.
All of the arguments need not to be initialized. w and v are overwitten and become eigenvalues and eigenvectors, respectively. This matrix is also overwritten.

Definition at line 111 of file zhematrix-lapack.hpp.

References array, i, and n.

{VERBOSE_REPORT;
  w.resize(n);  v.resize(n);
  for(long i=0; i<n; i++){ v[i].resize(n); }
  char JOBZ('V'), UPLO('l');
  long LDA(n), INFO(1), LWORK(-1);
  double *RWORK(new double[std::max(long(1), 3*n-2)]);
  comple *WORK(new comple[1]);
  zheev_(JOBZ, UPLO, n, array, LDA, &w[0], WORK, LWORK, RWORK, INFO);
  
  INFO=1;
  LWORK = long(std::real(WORK[0]));
  delete [] WORK;  WORK = new comple[LWORK];
  zheev_(JOBZ, UPLO, n, array, LDA, &w[0], WORK, LWORK, RWORK, INFO);
  delete [] RWORK;  delete [] WORK;
  
  //// forming ////
  for(long i=0; i<n; i++){ for(long j=0; j<n; j++){
    v[j](i) = array[i+n*j];
  }}
  
  if(INFO!=0){
    WARNING_REPORT;
    std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
  }
  return INFO;
}
long zhematrix::zheev ( std::vector< double > &  w,
std::vector< zrovector > &  v 
) [inline]

calculate eigenvalues and eigenvectors.
All of the arguments need not to be initialized. w and v are overwitten and become eigenvalues and eigenvectors, respectively. This matrix is also overwritten.

Definition at line 147 of file zhematrix-lapack.hpp.

References array, i, and n.

{VERBOSE_REPORT;
  w.resize(n);  v.resize(n);
  for(long i=0; i<n; i++){ v[i].resize(n); }
  char JOBZ('V'), UPLO('l');
  long LDA(n), INFO(1), LWORK(-1);
  double *RWORK(new double[std::max(long(1), 3*n-2)]);
  comple *WORK(new comple[1]);
  zheev_(JOBZ, UPLO, n, array, LDA, &w[0], WORK, LWORK, RWORK, INFO);
  
  INFO=1;
  LWORK = long(std::real(WORK[0]));
  delete [] WORK;  WORK = new comple[LWORK];
  zheev_(JOBZ, UPLO, n, array, LDA, &w[0], WORK, LWORK, RWORK, INFO);
  delete [] RWORK;  delete [] WORK;
  
  //// forming ////
  for(long i=0; i<n; i++){ for(long j=0; j<n; j++){
    v[j](i) = array[i+n*j];
  }}
  
  if(INFO!=0){
    WARNING_REPORT;
    std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
  }
  return INFO;
}
zhematrix & zhematrix::operator= ( const zhematrix mat) [inline]

zhematrix=zhematrix operator

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

References array, and copy().

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

zhematrix=_zhematrix operator

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

References shallow_copy().

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

zhematrix+=zhematrix operator

Definition at line 17 of file zhematrix-zhematrix.hpp.

References i, n, and operator()().

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

zhematrix+=_zhematrix operator

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

References _zhematrix::array, array, _zhematrix::destroy(), i, _zhematrix::n, and n.

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

zhematrix operator-=

Definition at line 37 of file zhematrix-zhematrix.hpp.

References i, n, and operator()().

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

zhematrix-=_zhematrix operator

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

References _zhematrix::array, array, _zhematrix::destroy(), i, _zhematrix::n, and n.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(n!=mat.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a sutraction." << std::endl
              << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  for(long i=0; i<n; i++){ for(long j=0; j<=i; j++){
    array[i+n*j]-=mat.array[i+n*j];
  }}
  
  mat.destroy();
  return *this;
}
zhematrix& zhematrix::operator*= ( const zhematrix ) [inline]
zhematrix& zhematrix::operator*= ( const _zhematrix ) [inline]
zhematrix & zhematrix::operator*= ( const double &  d) [inline]

zhematrix*=double operator

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

References array, and n.

{VERBOSE_REPORT;
  zdscal_(n*n, d, array, 1);
  return *this;
}
zhematrix & zhematrix::operator/= ( const double &  d) [inline]

zhematrix/=double operator

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

References array, and n.

{VERBOSE_REPORT;
  zdscal_(n*n, 1./d, array, 1);
  return *this;
}

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;
}
void swap ( zhematrix A,
zhematrix B 
) [friend]

swap two matrices

Definition at line 161 of file zhematrix-misc.hpp.

{VERBOSE_REPORT;
  long A_n(A.n);
  comple* A_array(A.array);
  //comple** A_darray(A.darray);
  comple** A_darray=A.darray; //corruption to support VC++
  A.n=B.n; A.array=B.array; A.darray=B.darray;
  B.n=A_n; B.array=A_array; B.darray=A_darray;
}
_zhematrix _ ( zhematrix mat) [friend]

convert user object to smart-temporary object

Definition at line 173 of file zhematrix-misc.hpp.

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

{VERBOSE_REPORT;
  _zhematrix newmat;
  
  //////// shallow copy ////////
  newmat.n =mat.n;
  newmat.array =mat.array;
  newmat.darray =mat.darray;
  
  //////// nullify ////////
  mat.n =0;
  mat.array =NULL;
  mat.darray =NULL;
  
  return newmat;
}
_zhematrix t ( const zhematrix mat) [friend]

return transposed zgematrix

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

{VERBOSE_REPORT;
  zhematrix newmat(mat.n);
  for(long i=0; i<newmat.n; i++){ for(long j=0; j<=i; j++){
    newmat(i,j) =mat(j,i);
  }}
  
  return _(newmat);
}
_zgematrix i ( const zhematrix mat) [friend]

return its inverse matrix

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

Referenced by chsign(), col(), complete(), copy(), identity(), operator()(), operator+=(), operator-=(), read(), resize(), set(), to_zgematrix(), write(), zero(), zheev(), and zhematrix().

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

return its conjugate matrix

Definition at line 31 of file zhematrix-calc.hpp.

Referenced by complete(), operator()(), and set().

{VERBOSE_REPORT;
  zhematrix newmat(mat.n);
  
  for(long i=0; i<mat.n; i++){
    for(long j=0; j<=i; j++){
      newmat(i,j) =std::conj(mat(i,j));
    }
  }
  
  return _(newmat);
}
_zhematrix conjt ( const zhematrix mat) [friend]

return its conjugate transposed matrix

Definition at line 46 of file zhematrix-calc.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  WARNING_REPORT;
  std::cerr << "This function call has no effect since the matrix is Hermitian." << std::endl;
#endif//CPPL_DEBUG
  
  zhematrix newmat(mat);
  return _(newmat);
}
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]

-zgematrix operator

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

{VERBOSE_REPORT;
  zhematrix newmat(mat.n);
  for(long i=0; i<mat.n; i++){ for(long j=0; j<=i; j++){
    newmat(i,j) =-mat(i,j);
  }}
  
  return _(newmat);
}
_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(matB);
  for(long i=0; i<matA.n; i++){ for(long j=0; j<matA.n; j++){
    newmat(i,j)+=matA(i,j);
  }}
  
  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);
  }}
  
  return matB;
}
_zhematrix operator+ ( const zhematrix matA,
const zhematrix matB 
) [friend]

zhematrix+zhematrix operator

Definition at line 57 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

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

zhematrix+_zhematrix operator

Definition at line 61 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<=i; j++){
    matB.array[i+matA.n*j]+=matA.array[i+matA.n*j];
  }}
  
  return matB;
}
_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);
    }
  }
  
  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=i; 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);
    }
  }
  
  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]
_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 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(-matB);
  for(long i=0; i<matA.n; i++){ for(long j=0; j<matA.n; j++){
    newmat(i,j)+=matA(i,j);
  }}
  
  return _(newmat);
}
_zgematrix operator- ( const zhematrix matA,
const _zgematrix matB 
) [friend]

_zgematrix-zgematrix operator

Definition at line 23 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);
  }}
  
  return matB;
}
_zhematrix operator- ( const zhematrix matA,
const zhematrix matB 
) [friend]

zhematrix-zhematrix operator

Definition at line 79 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

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

zhematrix-_zhematrix operator

Definition at line 81 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<=i; j++){
    matB.array[i] =matA.array[i]-matB.array[i];
  }}
  
  return matB;
}
_zgematrix operator- ( const zhematrix matA,
const zgbmatrix matB 
) [friend]

zhematrix-zgbmatrix operator

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

zhematrix*zgematrix operator

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

_zgematrix*zgematrix operator

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

zhematrix*zhematrix operator

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

zhematrix*_zhematrix operator

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

zhematrix*zgbmatrix operator

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

zhematrix*_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);
      }
    }
  }
  
  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 23 of file zhematrix-double.hpp.

{VERBOSE_REPORT;
  zhematrix newmat(mat.n);
  for(long i=0; i<mat.n*mat.n; i++){ newmat.array[i] =mat.array[i]*d; }
  
  return _(newmat);
}
_zgematrix operator* ( const zhematrix mat,
const comple &  d 
) [friend]

zhematrix*comple operator

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

{VERBOSE_REPORT;
  mat.complete();
  zgematrix newmat(mat.n, mat.n);
  for(long i=0; i<mat.n*mat.n; i++){ newmat.array[i] =mat.array[i]*d; }
  
  return _(newmat);
}
_zhematrix operator/ ( const zhematrix mat,
const double &  d 
) [friend]

zhematrix/double operator

Definition at line 33 of file zhematrix-double.hpp.

{VERBOSE_REPORT;
  zhematrix newmat(mat.n);
  for(long i=0; i<mat.n*mat.n; i++){ newmat.array[i] =mat.array[i]/d; }
  
  return _(newmat);
}
_zgematrix operator/ ( const zhematrix mat,
const comple &  d 
) [friend]

zhematrix/comple operator

Definition at line 14 of file zhematrix-complex.hpp.

{VERBOSE_REPORT;
  mat.complete();
  zgematrix newmat(mat.n, mat.n);
  for(long i=0; i<mat.n*mat.n; i++){ newmat.array[i] =mat.array[i]/d; }
  
  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;
  zhematrix newmat(mat.n);
  for(long i=0; i<mat.n*mat.n; i++){ newmat.array[i] =d*mat.array[i]; }  
  return _(newmat);
}
_zgematrix operator* ( const comple &  d,
const zhematrix mat 
) [friend]

comple*zhematrix operator

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

{VERBOSE_REPORT;
  mat.complete();
  zgematrix newmat(mat.n, mat.n);
  for(long i=0; i<mat.n*mat.n; i++){ newmat.array[i] =d*mat.array[i]; }
  
  return _(newmat);
}

Member Data Documentation

long const& zhematrix::m

matrix row size

Definition at line 10 of file zhematrix.hpp.

Referenced by col(), operator*(), operator+(), operator-(), row(), and zhematrix_small< n >::zhematrix_small().

array of pointers of column head addresses

Definition at line 13 of file zhematrix.hpp.

Referenced by _(), chsign(), clear(), complete(), copy(), identity(), operator()(), read(), resize(), set(), shallow_copy(), swap(), zero(), zhematrix(), and ~zhematrix().


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