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   for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat.data.end(); it++){
00006     std::swap(it->i,it->j);
00007   }
00008   std::swap(mat.rows,mat.cols);
00009   
00010   return mat;
00011 }
00012 
00013 ///////////////////////////////////////////////////////////////////////////////
00014 ///////////////////////////////////////////////////////////////////////////////
00015 ///////////////////////////////////////////////////////////////////////////////
00016 
00017 //=============================================================================
00018 /*! search the index of element having the largest absolute value in 0-based numbering system */
00019 inline void idamax(long& i, long& j, const _zgsmatrix& mat)
00020 {VERBOSE_REPORT;
00021   std::vector<zcomponent>::const_iterator itx(mat.data.begin());
00022   double vmax =0.;
00023   for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
00024     if( vmax < norm(it->v) ){
00025       vmax =norm(it->v);
00026       itx =it;
00027     }
00028   }
00029   i=itx->i;
00030   j=itx->j;
00031   
00032   mat.destroy();
00033 }
00034 
00035 //=============================================================================
00036 /*! return its largest absolute value */
00037 inline comple damax(const _zgsmatrix& mat)
00038 {VERBOSE_REPORT;
00039   std::vector<zcomponent>::const_iterator itx(mat.data.begin());
00040   double vmax =0.;
00041   for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
00042     if( vmax < norm(it->v) ){
00043       vmax =norm(it->v);
00044       itx =it;
00045     }
00046   }
00047   
00048   mat.destroy();
00049   return itx->v;
00050 }
 All Classes Files Functions Variables Friends