CPPLapack
 All Classes Files Functions Variables Friends Pages
zhsmatrix-calc.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! return transposed zhsmatrix */
3 inline _zhsmatrix t(const zhsmatrix& mat)
4 {CPPL_VERBOSE_REPORT;
5  zhsmatrix newmat(mat);
6 
7  const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end();
8  for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){
9  it->v =std::conj(it->v);
10  }
11 
12  return _(newmat);
13 }
14 
15 ///////////////////////////////////////////////////////////////////////////////
16 ///////////////////////////////////////////////////////////////////////////////
17 ///////////////////////////////////////////////////////////////////////////////
18 
19 //=============================================================================
20 /*! return its conjugate matrix */
21 inline _zhsmatrix conj(const zhsmatrix& mat)
22 {CPPL_VERBOSE_REPORT;
23  zhsmatrix newmat(mat);
24 
25  const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end();
26  for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){
27  it->v =std::conj(it->v);
28  }
29 
30  return _(newmat);
31 }
32 
33 //=============================================================================
34 /*! return its conjugate matrix */
35 inline _zhsmatrix conjt(const zhsmatrix& mat)
36 {CPPL_VERBOSE_REPORT;
37 #ifdef CPPL_DEBUG
38  WARNING_REPORT;
39  std::cerr << "This function call has no effect since the matrix is Hermitian." << std::endl;
40 #endif//CPPL_DEBUG
41 
42  zhsmatrix newmat(mat);
43  return _(newmat);
44 }
45 
46 ///////////////////////////////////////////////////////////////////////////////
47 ///////////////////////////////////////////////////////////////////////////////
48 ///////////////////////////////////////////////////////////////////////////////
49 
50 //=============================================================================
51 /*! search the index of element having the largest absolute value
52  in 0-based numbering system */
53 inline void idamax(CPPL_INT& i, CPPL_INT& j, const zhsmatrix& mat)
54 {CPPL_VERBOSE_REPORT;
55  std::vector<zcomponent>::const_iterator itx(mat.data.begin());
56  double vmax =0.;
57 
58  const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end();
59  for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
60  if( vmax < norm(it->v) ){
61  vmax =norm(it->v);
62  itx =it;
63  }
64  }
65 
66  i =itx->i;
67  j =itx->j;
68 }
69 
70 //=============================================================================
71 /*! return its largest absolute value */
72 inline comple damax(const zhsmatrix& mat)
73 {CPPL_VERBOSE_REPORT;
74  std::vector<zcomponent>::const_iterator itx(mat.data.begin());
75  double vmax =0.;
76 
77  const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end();
78  for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
79  if( vmax < norm(it->v) ){
80  vmax =norm(it->v);
81  itx =it;
82  }
83  }
84 
85  return itx->v;
86 }
comple damax(const zhsmatrix &mat)
_zhsmatrix conjt(const zhsmatrix &mat)
_dgematrix i(const _dgbmatrix &mat)
_zhsmatrix conj(const zhsmatrix &mat)
std::vector< zcomponent > data
matrix data
Definition: zhsmatrix.hpp:11
_zhsmatrix t(const zhsmatrix &mat)
Complex Double-precision Hermitian Sparse Matrix Class.
Definition: zhsmatrix.hpp:3
_dcovector _(dcovector &vec)
(DO NOT USE) Smart-temporary Complex Double-precision Hermitian Sparse Matrix Class ...
Definition: _zhsmatrix.hpp:3
void idamax(CPPL_INT &i, CPPL_INT &j, const zhsmatrix &mat)