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