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

Go to the source code of this file.

Functions

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

Function Documentation

_dgsmatrix t ( const dgsmatrix mat) [inline]

return transposed dgsmatrix

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

References _(), dgsmatrix::cols, dgsmatrix::data, dgsmatrix::rows, and swap().

{VERBOSE_REPORT;
  dgsmatrix newmat(mat);
  for(std::vector<dcomponent>::iterator it=newmat.data.begin(); it!=newmat.data.end(); it++){
    std::swap(it->i,it->j);
  }
  std::swap(newmat.rows,newmat.cols);
  
  return _(newmat);
}
void idamax ( long &  i,
long &  j,
const dgsmatrix mat 
) [inline]

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

Definition at line 21 of file dgsmatrix-calc.hpp.

References dgsmatrix::data.

{VERBOSE_REPORT;
  std::vector<dcomponent>::const_iterator itx(mat.data.begin());
  double vmax =0.;
  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    if( vmax < fabs(it->v) ){
      vmax =fabs(it->v);
      itx =it;
    }
  }
  i =itx->i;
  j =itx->j;
}
double damax ( const dgsmatrix mat) [inline]

return its largest absolute value

Definition at line 37 of file dgsmatrix-calc.hpp.

References dgsmatrix::data.

{VERBOSE_REPORT;
  std::vector<dcomponent>::const_iterator itx(mat.data.begin());
  double vmax =0.;
  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
    if( vmax < fabs(it->v) ){
      vmax =fabs(it->v);
      itx =it;
    }
  }
  return itx->v;
}
 All Classes Files Functions Variables Friends