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

Go to the source code of this file.

Functions

_dgsmatrix t (const _dgsmatrix &mat)
 
void idamax (CPPL_INT &i, CPPL_INT &j, const _dgsmatrix &mat)
 
double damax (const _dgsmatrix &mat)
 

Function Documentation

_dgsmatrix t ( const _dgsmatrix mat)
inline

return transposed _dgsmatrix

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

References _dgsmatrix::cols, _dgsmatrix::data, _dgsmatrix::rows, and swap().

4 {CPPL_VERBOSE_REPORT;
5  const std::vector<dcomponent>::iterator mat_data_end =mat.data.end();
6  for(std::vector<dcomponent>::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 }
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: _dgsmatrix.hpp:13
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _dgsmatrix.hpp:12
void swap(dcovector &u, dcovector &v)
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
void idamax ( CPPL_INT &  i,
CPPL_INT &  j,
const _dgsmatrix mat 
)
inline

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

Definition at line 22 of file _dgsmatrix-calc.hpp.

References _dgsmatrix::data, and _dgsmatrix::destroy().

23 {CPPL_VERBOSE_REPORT;
24  std::vector<dcomponent>::const_iterator itx(mat.data.begin());
25  double vmax(0);
26 
27  const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end();
28  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
29  if(vmax < it->v){
30  vmax=fabs(it->v);
31  itx=it;
32  }
33  }
34 
35  i=itx->i;
36  j=itx->j;
37 
38  mat.destroy();
39 }
_dgematrix i(const _dgbmatrix &mat)
friend _dgematrix i(const _dgematrix &)
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
double damax ( const _dgsmatrix mat)
inline

return its largest absolute value

Definition at line 43 of file _dgsmatrix-calc.hpp.

References _dgsmatrix::data, and _dgsmatrix::destroy().

44 {CPPL_VERBOSE_REPORT;
45  std::vector<dcomponent>::const_iterator itx(mat.data.begin());
46  double vmax(0);
47 
48  const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end();
49  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
50  if(vmax < it->v){
51  vmax=fabs(it->v);
52  itx=it;
53  }
54  }
55 
56  mat.destroy();
57  return itx->v;
58 }
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11