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 _(), i(), dgematrix::m, 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);
    }
  }
  
  return _(newmat);
}
_dgematrix i ( const dgematrix mat) [inline]

return its inverse matrix

Definition at line 18 of file dgematrix-calc.hpp.

References _(), dgematrix::dgesv(), dgematrix::identity(), dgematrix::m, 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), mat_inv(mat.m,mat.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 43 of file dgematrix-calc.hpp.

References dgematrix::array, 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;
}
double damax ( const dgematrix mat) [inline]

return its largest absolute value

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

References dgematrix::array, dgematrix::m, and dgematrix::n.

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