template<class C>
Karhunen Loeve mapping (PCA) Principal Componant Analysis to reduce matrix to newDim dimensions.
Definition at line 811 of file MatrixTem.h. References Impala::Core::Matrix::MatrixTem< C >::_nc, and Impala::Core::Matrix::MatrixTem< C >::_nr. 00812 { 00813 printf("fix this function (MatrixTem::klm) before use\n"); 00814 if (newDim<1 || newDim>_nc) 00815 { 00816 printf("klm: new dimensionality is invalid, dimsize is set as 1...\n"); 00817 newDim = 1; 00818 } 00819 00820 MatrixTem<C> newfvec(_nr,newDim); 00821 00822 /* MatrixTem<C> a = this->covariance() ; 00823 00824 VectorTem<C> d(_nc) ; 00825 00826 VectorTem<C> e(_nc) ; 00827 00828 tred2(a,d,e); 00829 00830 tqli(d,e,a); 00831 00832 // d[k] is an eigenvalue and a[][k] is a corresponding eigenvector 00833 00834 for (int k=0; k<_nr; k++) 00835 for (int i=0; i<newDim; i++) { 00836 double vl = 0.0; 00837 for (int j=0; j<_nc; j++) vl += ((*this)[k][j]*a[j][i]); 00838 newfvec[k][i] = vl; 00839 }*/ 00840 00841 return newfvec; 00842 }
|