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