protected void findEigenVectors ( double [ ] [ ] imat , double [ ] [ ] evs , double [ ] lambda ) { final int size = imat . length ; Random rnd = random . getSingleThreadedRandom ( ) ; double [ ] tmp = new double [ size ] ; FiniteProgress prog = LOG . isVerbose ( ) ? new FiniteProgress ( "Learning projections" , tdim , LOG ) : null ; for ( int d = 0 ; d < tdim ; ) { final double [ ] cur = evs [ d ] ; randomInitialization ( cur , rnd ) ; double l = multiply ( imat , cur , tmp ) ; for ( int iter = 0 ; iter < 100 ; iter ++ ) { // This will scale "tmp" to unit length, and copy it to cur: double delta = updateEigenvector ( tmp , cur , l ) ; if ( delta < 1e-10 ) { break ; } l = multiply ( imat , cur , tmp ) ; } lambda [ d ++ ] = l = estimateEigenvalue ( imat , cur ) ; LOG . incrementProcessed ( prog ) ; if ( d == tdim ) { break ; } // Update matrix updateMatrix ( imat , cur , l ) ; } LOG . ensureCompleted ( prog ) ; }
Find the first eigenvectors and eigenvalues using power iterations .