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

Go to the source code of this file.

Functions

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

Function Documentation

_dsymatrix t ( const _dsymatrix mat)
inline

return transposed _dsymatrix

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

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  return mat;
11 }
_dsymatrix i ( const _dsymatrix mat)
inline

return its inverse matrix

Definition at line 15 of file _dsymatrix-calc.hpp.

References _(), dsymatrix::array, dsymatrix::identity(), dsymatrix::n, and _dsymatrix::n.

16 {CPPL_VERBOSE_REPORT;
17  dsymatrix mat_cp(mat);
18  dsymatrix mat_inv(mat_cp.n);
19  mat_inv.identity();
20 
21  char UPLO('l');
22  CPPL_INT NRHS(mat.n), LDA(mat.n), *IPIV(new CPPL_INT[mat.n]), LDB(mat.n), LWORK(-1), INFO(1);
23  double *WORK( new double[1] );
24  dsysv_(&UPLO, &mat_cp.n, &NRHS, mat_cp.array, &LDA, IPIV, mat_inv.array, &LDB, WORK, &LWORK, &INFO);
25 
26  LWORK = CPPL_INT(WORK[0]);
27  delete [] WORK;
28  WORK = new double[LWORK];
29  dsysv_(&UPLO, &mat_cp.n, &NRHS, mat_cp.array, &LDA, IPIV, mat_inv.array, &LDB, WORK, &LWORK, &INFO);
30  delete [] WORK;
31  delete [] IPIV;
32 
33  if(INFO!=0){
34  WARNING_REPORT;
35  std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl;
36  }
37 
38  return _(mat_inv);
39 }
Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].
Definition: dsymatrix.hpp:3
CPPL_INT n
matrix column size
Definition: _dsymatrix.hpp:11
_dcovector _(dcovector &vec)
void idamax ( CPPL_INT &  i,
CPPL_INT &  j,
const _dsymatrix mat 
)
inline

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

Definition at line 48 of file _dsymatrix-calc.hpp.

49 {CPPL_VERBOSE_REPORT;
50  dsymatrix newmat =mat;
51  idamax(i, j, newmat);
52 }
_dsymatrix i(const _dsymatrix &mat)
Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].
Definition: dsymatrix.hpp:3
void idamax(CPPL_INT &i, CPPL_INT &j, const _dsymatrix &mat)
double damax ( const _dsymatrix mat)
inline

return its largest absolute value

Definition at line 56 of file _dsymatrix-calc.hpp.

57 {CPPL_VERBOSE_REPORT;
58  dsymatrix newmat =mat;
59  return damax(newmat);
60 }
Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].
Definition: dsymatrix.hpp:3
double damax(const _dsymatrix &mat)