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 #ifdef CPPL_DEBUG
6  WARNING_REPORT;
7  std::cerr << "This function call has no effect since the matrix is symmetric." << std::endl;
8 #endif//CPPL_DEBUG
9 
10  dssmatrix newmat(mat);
11  return _(newmat);
12 }
13 
14 ///////////////////////////////////////////////////////////////////////////////
15 ///////////////////////////////////////////////////////////////////////////////
16 ///////////////////////////////////////////////////////////////////////////////
17 
18 //=============================================================================
19 /*! search the index of element having the largest absolute value
20  in 0-based numbering system */
21 inline void idamax(CPPL_INT& i, CPPL_INT& j, const dssmatrix& mat)
22 {CPPL_VERBOSE_REPORT;
23  std::vector<dcomponent>::const_iterator itx(mat.data.begin());
24  double vmax =0.;
25 
26  const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end();
27  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
28  if( vmax < fabs(it->v) ){
29  vmax =fabs(it->v);
30  itx =it;
31  }
32  }
33 
34  i =itx->i;
35  j =itx->j;
36 }
37 
38 //=============================================================================
39 /*! return its largest absolute value */
40 inline double damax(const dssmatrix& mat)
41 {CPPL_VERBOSE_REPORT;
42  std::vector<dcomponent>::const_iterator itx(mat.data.begin());
43  double vmax =0.;
44 
45  const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end();
46  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
47  if( vmax < fabs(it->v) ){
48  vmax =fabs(it->v);
49  itx =it;
50  }
51  }
52 
53  return itx->v;
54 }
std::vector< dcomponent > data
matrix data
Definition: dssmatrix.hpp:11
(DO NOT USE) Smart-temporary Real Double-precision Symmetric Sparse Matrix Class
Definition: _dssmatrix.hpp:3
_dgematrix i(const _dgbmatrix &mat)
void idamax(CPPL_INT &i, CPPL_INT &j, const dssmatrix &mat)
double damax(const dssmatrix &mat)
Real Double-precision Symmetric Sparse Matrix Class.
Definition: dssmatrix.hpp:3
_dssmatrix t(const dssmatrix &mat)
_dcovector _(dcovector &vec)