//Computes the second-largest eigenvalue of a matrix A. //Uses the power method on A^2. #include #include "defs.h" #define S (N*L) /* dimension of the lift matrix is N*L by K */ typedef real vector[S]; #define EPSILON (1E-10) //First, some functions: /* compute y = A*x */ inline void matrix_vect_mult (lift_graph H, vector x, vector y){ index i,j; for(i=0; i */ s /= S; /* s is now the average of the entries of z */ t=0.0; l=0.0; for(i=0; i EPSILON*s*s); return sqrt(l); /* since we used A^2 */ }