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

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

#include <_dgematrix.hpp>

List of all members.

Public Member Functions

 _dgematrix ()
 _dgematrix (const _dgematrix &)
 ~_dgematrix ()
_zgematrix to_zgematrix () const
double & operator() (const long &, const long &) const
void write (const char *) const
void nullify () const
void destroy () const

Public Attributes

long m
 matrix row size
long n
 matrix column size
double * array
 1D array to store matrix data
double ** darray
 array of pointers of column head addresses

Friends

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

Detailed Description

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

Definition at line 3 of file _dgematrix.hpp.


Constructor & Destructor Documentation

_dgematrix::_dgematrix ( ) [inline]

_dgematrix constructor without arguments

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

References array, darray, m, and n.

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

_dgematrix copy constructor

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

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

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

dgematrix destructor

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

References array, and darray.

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

Member Function Documentation

cast to _zgematrix

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

References _(), array, zgematrix::array, destroy(), i, m, and n.

{VERBOSE_REPORT;
  zgematrix newmat(m,n);
  for(long i=0; i<m*n; i++){
    newmat.array[i] =comple(array[i],0.0);
  }
  
  destroy();
  return _(newmat);
}
double & _dgematrix::operator() ( const long &  i,
const long &  j 
) const [inline]

operator() for object

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

References darray, i, m, and n.

Referenced by write().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if( i<0 || j<0 || m<=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
  
  //double val(array[i+m*j]);
  return darray[j][i];
}
void _dgematrix::write ( const char *  filename) const [inline]

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

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

{VERBOSE_REPORT;
  std::ofstream ofs(filename, std::ios::trunc);
  ofs.setf(std::cout.flags());
  ofs.precision(std::cout.precision());
  ofs.width(std::cout.width());
  ofs.fill(std::cout.fill());
  
  ofs << "#dgematrix" << " " << m << " " << n << std::endl;
  for(long i=0; i<m; i++){
    for(long j=0; j<n; j++ ){
      ofs << operator()(i,j) << " ";
    }
    ofs << std::endl;
  }
  
  ofs.close();
  destroy();
}
void _dgematrix::nullify ( ) const [inline]

nullify all the matrix data

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

References array, darray, m, and n.

Referenced by _dgematrix(), dgematrix::dgematrix(), and dgematrix::shallow_copy().

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

destroy all the matrix data

Definition at line 13 of file _dgematrix-misc.hpp.

References array, and darray.

Referenced by damax(), idamax(), operator*(), dgematrix::operator*=(), operator+(), dgematrix::operator+=(), operator-(), dgematrix::operator-=(), operator<<(), t(), to_zgematrix(), and write().

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

Friends And Related Function Documentation

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

Definition at line 63 of file dgematrix-io.hpp.

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

return transposed dgematrix

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

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

return its inverse matrix

Definition at line 19 of file _dgematrix-calc.hpp.

Referenced by operator()(), operator*(), to_zgematrix(), and write().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(mat.m!=mat.n){
    ERROR_REPORT;
    std::cerr << "This matrix is not square and has no inverse matrix." << std::endl
              << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix mat_cp(mat);
  dgematrix mat_inv(mat_cp.m,mat_cp.n);
  mat_inv.identity();
  mat_cp.dgesv(mat_inv);
  
  return _(mat_inv);
}
void idamax ( long &  i,
long &  j,
const _dgematrix mat 
) [friend]

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

Definition at line 45 of file _dgematrix-calc.hpp.

{VERBOSE_REPORT;
  long index( idamax_(mat.m*mat.n, mat.array, 1) -1 );
  i =index%mat.m;
  j =index/mat.m;
  
  mat.destroy();
}
double damax ( const _dgematrix mat) [friend]

return its largest absolute value

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

{VERBOSE_REPORT;
  double val( mat.array[idamax_(mat.m*mat.n, mat.array, 1) -1] );
  
  mat.destroy();
  return val;
}
const _dgematrix& operator+ ( const _dgematrix mat) [friend]

+_dgematrix operator

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

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

-_dgematrix operator

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

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

_dgematrix+dgematrix operator

Definition at line 3 of file _dgematrix-dgematrix.hpp.

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

_dgematrix+_dgematrix operator

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

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

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

_dgematrix+dsymatrix operator

Definition at line 3 of file _dgematrix-dsymatrix.hpp.

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

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

_dgematrix+_dsymatrix operator

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

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

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

_dgematrix+dgbmatrix operator

Definition at line 3 of file _dgematrix-dgbmatrix.hpp.

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

_dgematrix+_dgbmatrix operator

Definition at line 3 of file _dgematrix-_dgbmatrix.hpp.

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

_dgematrix+dgsmatrix operator

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

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

_dgematrix+_dgsmatrix operator

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

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

_dgematrix-dgematrix operator

Definition at line 21 of file _dgematrix-dgematrix.hpp.

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

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

_dgematrix-_dgematrix operator

Definition at line 22 of file _dgematrix-_dgematrix.hpp.

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

  for(long i=0; i<matA.m*matA.n; i++){ matA.array[i]-=matB.array[i]; }
  
  matB.destroy();
  return matA;
}
_dgematrix operator- ( const _dgematrix matA,
const dsymatrix matB 
) [friend]

_dgematrix-dsymatrix operator

Definition at line 25 of file _dgematrix-dsymatrix.hpp.

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

_dgematrix-_dsymatrix operator

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

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

_dgematrix-dgbmatrix operator

Definition at line 25 of file _dgematrix-dgbmatrix.hpp.

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

_dgematrix-_dgbmatrix operator

Definition at line 26 of file _dgematrix-_dgbmatrix.hpp.

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

_dgematrix-dgsmatrix operator

Definition at line 23 of file _dgematrix-dgsmatrix.hpp.

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

_dgematrix-_dgsmatrix operator

Definition at line 24 of file _dgematrix-_dgsmatrix.hpp.

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.m!=matB.m || matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a subtraction." << std::endl
              << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  //// change sign ////
  for(long i=0; i<matA.m*matA.n; i++){
    matA.array[i]=-matA.array[i];
  }
  
  //// add ////
  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB.data.end(); it++){
    matA(it->i,it->j) += it->v;
  }
  
  matB.destroy();
  return matA;
}
_dgematrix operator- ( const _dgematrix ,
const dssmatrix  
) [friend]
_dgematrix operator- ( const _dgematrix ,
const _dssmatrix  
) [friend]
_dcovector operator* ( const _dgematrix mat,
const dcovector vec 
) [friend]

_dgematrix*dcovector operator

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

_dgematrix*_dcovector operator

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

_dgematrix*dgematrix operator

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

_dgematrix*_dgematrix operator

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

_dgematrix*dsymatrix operator

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

_dgematrix*_dsymatrix operator

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

_dgematrix*dgbmatrix operator

Definition at line 47 of file _dgematrix-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.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat( matA.m, matB.n );
  newmat.zero();
  
  for(long i=0; i<newmat.m; i++){
    for(long j=0; j<newmat.n; j++){
      for(long k=std::max(long(0),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 _dgematrix matA,
const _dgbmatrix matB 
) [friend]

_dgematrix*_dgbmatrix operator

Definition at line 49 of file _dgematrix-_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.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat( matA.m, matB.n );
  newmat.zero();
  
  for(long i=0; i<newmat.m; i++){
    for(long j=0; j<newmat.n; j++){
      for(long k=std::max(long(0),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 _dgematrix matA,
const dgsmatrix matB 
) [friend]

_dgematrix*dgsmatrix operator

Definition at line 49 of file _dgematrix-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.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat(matA.m, 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.m; i++){
      newmat(i,it->j) += matA(i,it->i)*it->v;
    }
  }
  
  matA.destroy();
  return _(newmat);
}
_dgematrix operator* ( const _dgematrix matA,
const _dgsmatrix matB 
) [friend]

_dgematrix*_dgsmatrix operator

Definition at line 51 of file _dgematrix-_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.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  dgematrix newmat(matA.m, 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.m; i++){
      newmat(i,it->j) += matA(i,it->i)*it->v;
    }
  }
  
  matA.destroy();
  matB.destroy();
  return _(newmat);
}
_dgematrix operator* ( const _dgematrix matA,
const dssmatrix matB 
) [friend]

_dgematrix*dssmatrix operator

Definition at line 3 of file _dgematrix-dssmatrix.hpp.

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

_dgematrix*double operator

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

{VERBOSE_REPORT;
  dscal_(mat.m*mat.n, d, mat.array, 1);
  return mat;
}
_dgematrix operator/ ( const _dgematrix mat,
const double &  d 
) [friend]

_dgematrix/double operator

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

{VERBOSE_REPORT;
  dscal_(mat.m*mat.n, 1./d, mat.array, 1);
  return mat;
}
_dgematrix operator* ( const double &  d,
const _dgematrix mat 
) [friend]

double*_dgematrix operator

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

{VERBOSE_REPORT;
  dscal_(mat.m*mat.n, d, mat.array, 1);
  return mat;
}

Member Data Documentation

long _dgematrix::m [mutable]
long _dgematrix::n [mutable]
double* _dgematrix::array [mutable]
double** _dgematrix::darray [mutable]

array of pointers of column head addresses

Definition at line 12 of file _dgematrix.hpp.

Referenced by _(), _dgematrix(), destroy(), dgematrix::dgematrix(), nullify(), operator()(), dgematrix::shallow_copy(), and ~_dgematrix().


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