CPPLapack
 All Classes Files Functions Variables Friends
Functions
_dgematrix-calc.hpp File Reference

Go to the source code of this file.

Functions

_dgematrix t (const _dgematrix &mat)
_dgematrix i (const _dgematrix &mat)
void idamax (long &i, long &j, const _dgematrix &mat)
double damax (const _dgematrix &mat)

Function Documentation

_dgematrix t ( const _dgematrix mat) [inline]

return transposed dgematrix

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

References _(), _dgematrix::destroy(), i(), dgematrix::m, _dgematrix::m, _dgematrix::n, and dgematrix::n.

{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) [inline]

return its inverse matrix

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

References _(), dgematrix::dgesv(), dgematrix::identity(), _dgematrix::m, dgematrix::m, dgematrix::n, and _dgematrix::n.

{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 
) [inline]

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

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

References _dgematrix::array, _dgematrix::destroy(), _dgematrix::m, and _dgematrix::n.

{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) [inline]

return its largest absolute value

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

References _dgematrix::array, _dgematrix::destroy(), _dgematrix::m, and _dgematrix::n.

{VERBOSE_REPORT;
  double val( mat.array[idamax_(mat.m*mat.n, mat.array, 1) -1] );
  
  mat.destroy();
  return val;
}
 All Classes Files Functions Variables Friends