CPPLapack
 All Classes Files Functions Variables Friends
zgsmatrix-calc.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! return transposed zgsmatrix */
00003 inline _zgsmatrix t(const zgsmatrix& mat)
00004 {VERBOSE_REPORT;
00005   zgsmatrix newmat(mat);
00006   std::swap(newmat.rows,newmat.cols);
00007   
00008   for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat.data.end(); it++){
00009     std::swap(it->i,it->j);
00010   }
00011   
00012   return _(newmat);
00013 }
00014 
00015 ///////////////////////////////////////////////////////////////////////////////
00016 ///////////////////////////////////////////////////////////////////////////////
00017 ///////////////////////////////////////////////////////////////////////////////
00018 
00019 //=============================================================================
00020 /*! return its conjugate matrix */
00021 inline _zgsmatrix conj(const zgsmatrix& mat)
00022 {VERBOSE_REPORT;
00023   zgsmatrix newmat(mat);
00024   
00025   for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat.data.end(); it++){
00026     it->v =std::conj(it->v);
00027   }
00028   
00029   return _(newmat);
00030 }
00031 
00032 //=============================================================================
00033 /*! return its conjugate transposed matrix */
00034 inline _zgsmatrix conjt(const zgsmatrix& mat)
00035 {VERBOSE_REPORT;
00036   zgsmatrix newmat(mat);
00037   std::swap(newmat.rows,newmat.cols);
00038   
00039   for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat.data.end(); it++){
00040     std::swap(it->i,it->j);
00041     it->v =std::conj(it->v);
00042   }
00043   
00044   return _(newmat);
00045 }
00046 
00047 ///////////////////////////////////////////////////////////////////////////////
00048 ///////////////////////////////////////////////////////////////////////////////
00049 ///////////////////////////////////////////////////////////////////////////////
00050 
00051 //=============================================================================
00052 /*! search the index of element having the largest absolute value in 0-based numbering system */
00053 inline void idamax(long& i, long& j, const zgsmatrix& mat)
00054 {VERBOSE_REPORT;
00055   std::vector<zcomponent>::const_iterator itx(mat.data.begin());
00056   double vmax =0.;
00057   for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
00058     if( vmax < norm(it->v) ){
00059       vmax =norm(it->v);
00060       itx =it;
00061     }
00062   }
00063   i=itx->i;
00064   j=itx->j;
00065 }
00066 
00067 //=============================================================================
00068 /*! return its largest absolute value */
00069 inline comple damax(const zgsmatrix& mat)
00070 {VERBOSE_REPORT;
00071   std::vector<zcomponent>::const_iterator itx(mat.data.begin());
00072   double vmax =0.;
00073   for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
00074     if( vmax < norm(it->v) ){
00075       vmax =norm(it->v);
00076       itx =it;
00077     }
00078   }
00079   return itx->v;
00080 }
 All Classes Files Functions Variables Friends