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

Go to the source code of this file.

Functions

_zgsmatrix t (const zgsmatrix &mat)
 
_zgsmatrix conj (const zgsmatrix &mat)
 
_zgsmatrix conjt (const zgsmatrix &mat)
 
void idamax (CPPL_INT &i, CPPL_INT &j, const zgsmatrix &mat)
 
comple damax (const zgsmatrix &mat)
 

Function Documentation

_zgsmatrix t ( const zgsmatrix mat)
inline

return transposed zgsmatrix

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

References _(), zgsmatrix::cols, zgsmatrix::data, zgsmatrix::m, zgsmatrix::n, zgsmatrix::rows, and swap().

4 {CPPL_VERBOSE_REPORT;
5  zgsmatrix newmat =mat;
6 
7  std::swap(newmat.m,newmat.n);
8  std::swap(newmat.rows,newmat.cols);
9  const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end();
10  for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){
11  std::swap(it->i,it->j);
12  }
13 
14  return _(newmat);
15 }
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
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< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
void swap(dcovector &u, dcovector &v)
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: zgsmatrix.hpp:13
CPPL_INT m
matrix row size
Definition: zgsmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgsmatrix.hpp:10
_dcovector _(dcovector &vec)
_zgsmatrix conj ( const zgsmatrix mat)
inline

return its conjugate matrix

Definition at line 23 of file zgsmatrix-calc.hpp.

References _(), and zgsmatrix::data.

Referenced by conjt().

24 {CPPL_VERBOSE_REPORT;
25  zgsmatrix newmat(mat);
26 
27  const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end();
28  for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){
29  it->v =std::conj(it->v);
30  }
31 
32  return _(newmat);
33 }
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
_zgsmatrix conj(const zgsmatrix &mat)
_dcovector _(dcovector &vec)
_zgsmatrix conjt ( const zgsmatrix mat)
inline

return its conjugate transposed matrix

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

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

38 {CPPL_VERBOSE_REPORT;
39  zgsmatrix newmat(mat);
40  std::swap(newmat.rows,newmat.cols);
41 
42  const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end();
43  for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){
44  std::swap(it->i,it->j);
45  it->v =std::conj(it->v);
46  }
47 
48  return _(newmat);
49 }
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
void swap(dcovector &u, dcovector &v)
_zgsmatrix conj(const zgsmatrix &mat)
_dcovector _(dcovector &vec)
void idamax ( CPPL_INT &  i,
CPPL_INT &  j,
const zgsmatrix mat 
)
inline

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

Definition at line 57 of file zgsmatrix-calc.hpp.

References zgsmatrix::data.

58 {CPPL_VERBOSE_REPORT;
59  std::vector<zcomponent>::const_iterator itx(mat.data.begin());
60  double vmax =0.;
61 
62  const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end();
63  for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
64  if( vmax < norm(it->v) ){
65  vmax =norm(it->v);
66  itx =it;
67  }
68  }
69 
70  i=itx->i;
71  j=itx->j;
72 }
_dgematrix i(const _dgbmatrix &mat)
friend _dgematrix i(const _dgematrix &)
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
comple damax ( const zgsmatrix mat)
inline

return its largest absolute value

Definition at line 76 of file zgsmatrix-calc.hpp.

References zgsmatrix::data.

77 {CPPL_VERBOSE_REPORT;
78  std::vector<zcomponent>::const_iterator itx(mat.data.begin());
79  double vmax =0.;
80 
81  const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end();
82  for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
83  if( vmax < norm(it->v) ){
84  vmax =norm(it->v);
85  itx =it;
86  }
87  }
88 
89  return itx->v;
90 }
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11