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 _(), i(), zgematrix::m, 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);
  }}
  
  return _(newmat);
}
_zgematrix i ( const zgematrix mat) [inline]

return its inverse matrix

Definition at line 16 of file zgematrix-calc.hpp.

References _(), zgematrix::identity(), zgematrix::m, 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), mat_inv(mat.m,mat.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 40 of file zgematrix-calc.hpp.

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

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

return its conjugate transposed matrix

Definition at line 52 of file zgematrix-calc.hpp.

References _(), conj(), i(), zgematrix::m, 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));
  }}
  
  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 69 of file zgematrix-calc.hpp.

References zgematrix::array, 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;
}
comple damax ( const zgematrix mat) [inline]

return its largest absolute value

Definition at line 78 of file zgematrix-calc.hpp.

References zgematrix::array, zgematrix::m, and zgematrix::n.

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