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

Go to the source code of this file.

Functions

_zgematrix t (const _zgematrix &mat)
_zgematrix i (const _zgematrix &mat)
_zgematrix conj (const _zgematrix &mat)
_zgematrix conjt (const _zgematrix &mat)
void idamax (long &i, long &j, const _zgematrix &mat)
comple damax (const _zgematrix &mat)

Function Documentation

_zgematrix t ( const _zgematrix mat) [inline]

return transposed zgematrix

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

References _(), _zgematrix::destroy(), i(), zgematrix::m, _zgematrix::m, _zgematrix::n, and zgematrix::n.

{VERBOSE_REPORT;
  zgematrix newmat(mat.n,mat.m);
  
  for(long i=0; i<newmat.m; i++){
    for(long j=0; j<newmat.n; j++){
      newmat(i,j) =mat(j,i);
    }
  }
  
  mat.destroy();
  return _(newmat);
}
_zgematrix i ( const _zgematrix mat) [inline]

return its inverse matrix

Definition at line 19 of file _zgematrix-calc.hpp.

References _(), zgematrix::identity(), _zgematrix::m, zgematrix::m, zgematrix::n, _zgematrix::n, and zgematrix::zgesv().

{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(mat.m!=mat.n){
    ERROR_REPORT;
    std::cerr << "This matrix is not square and has no inverse matrix." << std::endl
              << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  zgematrix mat_cp(mat);
  zgematrix mat_inv(mat_cp.m,mat_cp.n);
  mat_inv.identity();
  mat_cp.zgesv(mat_inv);
  
  return _(mat_inv);
}
_zgematrix conj ( const _zgematrix mat) [inline]

return its conjugate matrix

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

References conj(), i(), _zgematrix::m, and _zgematrix::n.

{VERBOSE_REPORT;
  for(long i=0; i<mat.m; i++){ for(long j=0; j<mat.n; j++){
    mat(i,j) =std::conj(mat(i,j));
  }}
  
  return mat;
}
_zgematrix conjt ( const _zgematrix mat) [inline]

return its conjugate transposed matrix

Definition at line 54 of file _zgematrix-calc.hpp.

References _(), conj(), _zgematrix::destroy(), i(), zgematrix::m, _zgematrix::m, _zgematrix::n, and zgematrix::n.

{VERBOSE_REPORT;
  zgematrix newmat(mat.n,mat.m);
  for(long i=0; i<newmat.m; i++){
    for(long j=0; j<newmat.n; j++){
      newmat(i,j) =std::conj(mat(j,i));
    }
  }
  
  mat.destroy();
  return _(newmat);
}
void idamax ( long &  i,
long &  j,
const _zgematrix mat 
) [inline]

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

Definition at line 74 of file _zgematrix-calc.hpp.

References _zgematrix::array, _zgematrix::destroy(), _zgematrix::m, and _zgematrix::n.

{VERBOSE_REPORT;
  long index( izamax_(mat.m*mat.n, mat.array, 1) -1 );
  i =index%mat.m;
  j =index/mat.m;
  
  mat.destroy();
}
comple damax ( const _zgematrix mat) [inline]

return its largest absolute value

Definition at line 85 of file _zgematrix-calc.hpp.

References _zgematrix::array, _zgematrix::destroy(), _zgematrix::m, and _zgematrix::n.

{VERBOSE_REPORT;
  comple val( mat.array[izamax_(mat.m*mat.n, mat.array, 1) -1] );
  
  mat.destroy();
  return val;
}
 All Classes Files Functions Variables Friends