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

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

#include <_dsymatrix.hpp>

List of all members.

Public Member Functions

 _dsymatrix ()
 _dsymatrix (const _dsymatrix &)
 ~_dsymatrix ()
_zhematrix to_zhematrix () const
_dgematrix to_dgematrix () const
_dssmatrix to_dssmatrix (const double=DBL_MIN) const
double & 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 size
long n
 matrix column size
double * array
 1D array to store matrix data
double ** darray
 array of pointers of column head addresses

Friends

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

Detailed Description

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

Definition at line 3 of file _dsymatrix.hpp.


Constructor & Destructor Documentation

_dsymatrix::_dsymatrix ( ) [inline]

_dsymatrix constructor without arguments

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

References array, darray, and n.

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

_dsymatrix copy constructor

Definition at line 13 of file _dsymatrix-constructor.hpp.

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

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

dsymatrix destructor

Definition at line 29 of file _dsymatrix-constructor.hpp.

References array, and darray.

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

Member Function Documentation

cast to _zhematrix

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

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

{VERBOSE_REPORT;
  zhematrix newmat(n);
  for(long i=0; i<n; i++){
    for(long j=0; j<=i; j++){
      newmat(i,j) =comple((*this)(i,j),0.0);
    }
  }
  
  destroy();
  return _(newmat);
}

convert to _dgematrix

Definition at line 22 of file _dsymatrix-cast.hpp.

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

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

{VERBOSE_REPORT;
  dgematrix 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);
}
_dssmatrix _dsymatrix::to_dssmatrix ( const double  = DBL_MIN) const [inline]
double & _dsymatrix::operator() ( const long &  i,
const long &  j 
) const [inline]

operator() for object

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

References darray, i, 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 array[i+n*j];
    return darray[j][i];
  } else {
    //return array[j+n*i];
    return darray[i][j];
  }
}
void _dsymatrix::write ( const char *  filename) const [inline]

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

References destroy(), i, 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 << "#dsymatrix" << " " << n << std::endl;
  for(long i=0; i<n; i++){
    for(long j=0; j<=i; j++ ){
      ofs << operator()(i,j) << " ";
    }
    ofs << std::endl;
  }
  
  ofs.close();
  destroy();
}
void _dsymatrix::nullify ( ) const [inline]

nullify all the matrix data

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

References array, darray, and n.

Referenced by _dsymatrix(), dsymatrix::dsymatrix(), and dsymatrix::shallow_copy().

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

destroy all the matrix data

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

References array, and darray.

Referenced by operator*(), dgematrix::operator*=(), operator+(), dsymatrix::operator+=(), dgematrix::operator+=(), operator-(), dsymatrix::operator-=(), dgematrix::operator-=(), operator<<(), to_dgematrix(), to_zhematrix(), and write().

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

complete the upper-right components

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

References 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] =darray[j][i];
    }
  }
}

Friends And Related Function Documentation

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

Definition at line 77 of file dsymatrix-io.hpp.

{VERBOSE_REPORT;
  for(long i=0; i<mat.n; i++){
    for(long j=0; j<=i; j++){
      s << " " << mat(i,j) << " ";
    }
    for(long j=i+1; j<mat.n; j++){
      s << "{" << mat(i,j) << "}";
    }
    s << std::endl;
  }
  return s;
}
_dsymatrix t ( const _dsymatrix mat) [friend]

return transposed _dsymatrix

Definition at line 3 of file _dsymatrix-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;
}
_dsymatrix i ( const _dsymatrix mat) [friend]

return its inverse matrix

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

Referenced by complete(), operator()(), to_dgematrix(), to_zhematrix(), and write().

{VERBOSE_REPORT;
  dsymatrix mat_cp(mat);
  dsymatrix mat_inv(mat_cp.n);
  mat_inv.identity();
  
  char UPLO('l');
  long NRHS(mat.n), LDA(mat.n), *IPIV(new long[mat.n]), LDB(mat.n), LWORK(-1), INFO(1);
  double *WORK( new double[1] );
  dsysv_(UPLO, mat_cp.n, NRHS, mat_cp.array, LDA, IPIV, mat_inv.array, LDB, WORK, LWORK, INFO);
  LWORK = long(WORK[0]);
  delete [] WORK;  WORK = new double[LWORK];
  dsysv_(UPLO, mat_cp.n, NRHS, mat_cp.array, LDA, IPIV, mat_inv.array, LDB, WORK, LWORK, INFO);
  delete [] WORK; delete [] IPIV;
  if(INFO!=0){
    WARNING_REPORT;
    std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
  }
  
  return _(mat_inv);
}
void idamax ( long &  i,
long &  j,
const _dsymatrix mat 
) [friend]

search the index of element having the largest absolute value in 0-based numbering system

Definition at line 44 of file _dsymatrix-calc.hpp.

{VERBOSE_REPORT;
  dsymatrix newmat(mat);
  idamax(i, j, newmat);
}
double damax ( const _dsymatrix mat) [friend]

return its largest absolute value

Definition at line 52 of file _dsymatrix-calc.hpp.

{VERBOSE_REPORT;
  dsymatrix newmat(mat);
  return damax(newmat);
}
const _dsymatrix& operator+ ( const _dsymatrix mat) [friend]

+_dsymatrix operator

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

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

-_dsymatrix operator

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

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

_dsymatrix+dgematrix operator

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

_dgematrix+dsymatrix operator

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

_dsymatrix+dsymatrix operator

Definition at line 3 of file _dsymatrix-dsymatrix.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++){
      matA.darray[j][i] +=matB.darray[j][i];
    }
  }
  
  return matA;
}
_dsymatrix operator+ ( const _dsymatrix matA,
const _dsymatrix matB 
) [friend]

_dsymatrix+_dsymatrix operator

Definition at line 3 of file _dsymatrix-_dsymatrix.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++){
      matA.darray[j][i] +=matB.darray[j][i];
    }
  }

  matB.destroy();
  return matA;
}
_dgematrix operator+ ( const _dsymatrix matA,
const dgbmatrix matB 
) [friend]

_dsymatrix+dgbmatrix operator

Definition at line 3 of file _dsymatrix-dgbmatrix.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
  
  dgematrix newmat(matA.n, matA.n);
  for(long i=0; i<matB.m; i++){
    for(long j=i; j<matA.n; j++){
      newmat(i,j) = newmat(j,i) = 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);
}
_dgematrix operator+ ( const _dsymatrix matA,
const _dgbmatrix matB 
) [friend]

_dsymatrix+_dgbmatrix operator

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

_dsymatrix+dgsmatrix operator

Definition at line 3 of file _dsymatrix-dgsmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m || 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.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat( matA.to_dgematrix() );
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  return _(newmat);
}
_dgematrix operator+ ( const _dsymatrix matA,
const _dgsmatrix matB 
) [friend]

_dsymatrix+_dgsmatrix operator

Definition at line 3 of file _dsymatrix-_dgsmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m || 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.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat( matA.to_dgematrix() );
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_dsymatrix operator+ ( const _dsymatrix ,
const dssmatrix  
) [friend]
_dsymatrix operator+ ( const _dsymatrix ,
const _dssmatrix  
) [friend]
_dgematrix operator- ( const _dsymatrix matA,
const dgematrix matB 
) [friend]

_dsymatrix-dgematrix operator

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

_dsymatrix-dgematrix operator

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

_dsymatrix-dsymatrix operator

Definition at line 25 of file _dsymatrix-dsymatrix.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++){
      matA.darray[j][i] -=matB.darray[j][i];
    }
  }

  return matA;
}
_dsymatrix operator- ( const _dsymatrix matA,
const _dsymatrix matB 
) [friend]

_dsymatrix-_dsymatrix operator

Definition at line 26 of file _dsymatrix-_dsymatrix.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++){
      matA.darray[j][i] -=matB.darray[j][i];
    }
  }
  
  matB.destroy();
  return matA;
}
_dgematrix operator- ( const _dsymatrix matA,
const dgbmatrix matB 
) [friend]

_dsymatrix-dgbmatrix operator

Definition at line 30 of file _dsymatrix-dgbmatrix.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
  
  dgematrix newmat(matA.n, matA.n);
  for(long i=0; i<matB.m; i++){
    for(long j=i; j<matA.n; j++){
      newmat(i,j) = newmat(j,i) = 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);
}
_dgematrix operator- ( const _dsymatrix matA,
const _dgbmatrix matB 
) [friend]

_dsymatrix-_dgbmatrix operator

Definition at line 31 of file _dsymatrix-_dgbmatrix.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
  
  dgematrix newmat(matA.n, matA.n);
  for(long i=0; i<matB.m; i++){
    for(long j=i; j<matA.n; j++){
      newmat(i,j) = newmat(j,i) = matA(i,j);
    }
    for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){
      newmat(i,j) -= matB(i,j);
    }
  }

  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_dgematrix operator- ( const _dsymatrix matA,
const dgsmatrix matB 
) [friend]

_dsymatrix-dgsmatrix operator

Definition at line 25 of file _dsymatrix-dgsmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m || 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.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat( matA.to_dgematrix() );
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    newmat(it->i,it->j) -= it->v;
  }
  
  matA.destroy();
  return _(newmat);
}
_dgematrix operator- ( const _dsymatrix matA,
const _dgsmatrix matB 
) [friend]

_dsymatrix-_dgsmatrix operator

Definition at line 26 of file _dsymatrix-_dgsmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m || 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.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG

  dgematrix newmat( matA.to_dgematrix() );
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    newmat(it->i,it->j) -= it->v;
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_dsymatrix operator- ( const _dsymatrix ,
const dssmatrix  
) [friend]
_dsymatrix operator- ( const _dsymatrix ,
const _dssmatrix  
) [friend]
_dcovector operator* ( const _dsymatrix mat,
const dcovector vec 
) [friend]

_dsymatrix*dcovector operator

Definition at line 3 of file _dsymatrix-dcovector.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(mat.n!=vec.l){
    ERROR_REPORT;
    std::cerr << "These matrix and vector can not make a product." << std::endl
              << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dcovector newvec(mat.n);
  dsymv_( 'l', mat.n, 1.0, mat.array, mat.n,
          vec.array, 1, 0.0, newvec.array, 1 );
  
  mat.destroy();
  return _(newvec);
}
_dcovector operator* ( const _dsymatrix mat,
const _dcovector vec 
) [friend]

_dsymatrix*_dcovector operator

Definition at line 3 of file _dsymatrix-_dcovector.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(mat.n!=vec.l){
    ERROR_REPORT;
    std::cerr << "These matrix and vector can not make a product." << std::endl
              << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dcovector newvec(mat.n);
  dsymv_( 'l', mat.n, 1.0, mat.array, mat.n,
          vec.array, 1, 0.0, newvec.array, 1 );
  
  mat.destroy();
  vec.destroy();
  return _(newvec);
}
_dgematrix operator* ( const _dsymatrix matA,
const dgematrix matB 
) [friend]

_dsymatrix*dgematrix operator

Definition at line 51 of file _dsymatrix-dgematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat( matA.n, matB.n );
  dsymm_( 'l', 'l', matA.n, matB.n, 1.0, matA.array, matA.n, 
          matB.array, matB.m, 0.0, newmat.array, newmat.m );
  
  matA.destroy();
  return _(newmat);
}
_dgematrix operator* ( const _dsymatrix matA,
const _dgematrix matB 
) [friend]

_dgematrix*dgematrix operator

Definition at line 49 of file _dsymatrix-_dgematrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat( matA.n, matB.n );
  dsymm_( 'l', 'l', matA.n, matB.n, 1.0, matA.array, matA.n, 
          matB.array, matB.m, 0.0, newmat.array, newmat.m );
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_dgematrix operator* ( const _dsymatrix matA,
const dsymatrix matB 
) [friend]

_dsymatrix*dsymatrix operator

Definition at line 47 of file _dsymatrix-dsymatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  matA.complete();
  matB.complete();
  dgematrix newmat(matA.n, matA.n);
  
  dgemm_( 'n', 'n', matA.n, matB.n, matA.n, 1.0, matA.array, matA.n,
          matB.array, matB.n, 0.0, newmat.array, matA.n );
  
  matA.destroy();
  return _(newmat);
}
_dgematrix operator* ( const _dsymatrix matA,
const _dsymatrix matB 
) [friend]

_dsymatrix*_dsymatrix operator

Definition at line 49 of file _dsymatrix-_dsymatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  matA.complete();
  matB.complete();
  dgematrix newmat(matA.n, matA.n);
  
  dgemm_( 'n', 'n', matA.n, matB.n, matA.n, 1.0, matA.array, matA.n,
          matB.array, matB.n, 0.0, newmat.array, matA.n );
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_dgematrix operator* ( const _dsymatrix matA,
const dgbmatrix matB 
) [friend]

_dgematrix*dgbmatrix operator

Definition at line 57 of file _dsymatrix-dgbmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix 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);
}
_dgematrix operator* ( const _dsymatrix matA,
const _dgbmatrix matB 
) [friend]

_dsymatrix*_dgbmatrix operator

Definition at line 59 of file _dsymatrix-_dgbmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix 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);
}
_dgematrix operator* ( const _dsymatrix matA,
const dgsmatrix matB 
) [friend]

_dsymatrix*dgsmatrix operator

Definition at line 47 of file _dsymatrix-dgsmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat(matA.n, matB.n);
  newmat.zero();
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    for(long i=0; i<matA.n; i++){
      newmat(i,it->j) += matB(i,it->i)*it->v;
    }
  }
  
  matA.destroy();
  return _(newmat);
}
_dgematrix operator* ( const _dsymatrix matA,
const _dgsmatrix matB 
) [friend]

_dsymatrix*_dgsmatrix operator

Definition at line 49 of file _dsymatrix-_dgsmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.m){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat(matA.n, matB.n);
  newmat.zero();
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    for(long i=0; i<matA.n; i++){
      newmat(i,it->j) += matB(i,it->i)*it->v;
    }
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_dgematrix operator* ( const _dsymatrix ,
const dssmatrix  
) [friend]
_dgematrix operator* ( const _dsymatrix ,
const _dssmatrix  
) [friend]
_dsymatrix operator* ( const _dsymatrix mat,
const double &  d 
) [friend]

_dsymatrix*double operator

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

{VERBOSE_REPORT;
  for(long i=0; i<mat.n; i++){
    for(long j=0; j<=i; j++){
      mat.darray[j][i] *=d;
    }
  }
  return mat;
}
_dsymatrix operator/ ( const _dsymatrix mat,
const double &  d 
) [friend]

dsymatrix/double operator

Definition at line 15 of file _dsymatrix-double.hpp.

{VERBOSE_REPORT;
  for(long i=0; i<mat.n; i++){
    for(long j=0; j<=i; j++){
      mat.darray[j][i] /=d;
    }
  }
  return mat;
}
_dsymatrix operator* ( const double &  d,
const _dsymatrix mat 
) [friend]

double*_dsymatrix operator

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

{VERBOSE_REPORT;
  for(long i=0; i<mat.n; i++){
    for(long j=0; j<=i; j++){
      mat.darray[j][i] *=d;
    }
  }
  
  return mat;
}

Member Data Documentation

long const& _dsymatrix::m [mutable]

matrix row size

Definition at line 9 of file _dsymatrix.hpp.

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

long _dsymatrix::n [mutable]
double* _dsymatrix::array [mutable]
double** _dsymatrix::darray [mutable]

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