CPPLapack
 All Classes Files Functions Variables Friends Pages
_dssmatrix-calc.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! return transposed _dssmatrix */
3 inline _dssmatrix t(const _dssmatrix& mat)
4 {CPPL_VERBOSE_REPORT;
5  return mat;
6 }
7 
8 ///////////////////////////////////////////////////////////////////////////////
9 ///////////////////////////////////////////////////////////////////////////////
10 ///////////////////////////////////////////////////////////////////////////////
11 
12 //=============================================================================
13 /*! search the index of element having the largest absolute value
14  in 0-based numbering system */
15 inline void idamax(CPPL_INT& i, CPPL_INT& j, const _dssmatrix& mat)
16 {CPPL_VERBOSE_REPORT;
17  std::vector<dcomponent>::const_iterator itx(mat.data.begin());
18  double vmax(0);
19 
20  const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end();
21  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
22  if(vmax < it->v){
23  vmax=fabs(it->v);
24  itx=it;
25  }
26  }
27 
28  i=itx->i;
29  j=itx->j;
30 
31  mat.destroy();
32 }
33 
34 //=============================================================================
35 /*! return its largest absolute value */
36 inline double damax(const _dssmatrix& mat)
37 {CPPL_VERBOSE_REPORT;
38  std::vector<dcomponent>::const_iterator itx(mat.data.begin());
39  double vmax(0);
40 
41  const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end();
42  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
43  if(vmax < it->v){
44  vmax=fabs(it->v);
45  itx=it;
46  }
47  }
48 
49  double val(itx->v);
50  mat.destroy();
51  return val;
52 }
void idamax(CPPL_INT &i, CPPL_INT &j, const _dssmatrix &mat)
std::vector< dcomponent > data
matrix data
Definition: _dssmatrix.hpp:12
_dssmatrix t(const _dssmatrix &mat)
(DO NOT USE) Smart-temporary Real Double-precision Symmetric Sparse Matrix Class
Definition: _dssmatrix.hpp:3
_dgematrix i(const _dgbmatrix &mat)
double damax(const _dssmatrix &mat)
void destroy() const