function [lambda,v] = rayleighiter(A)

[n,n2] = size(A);

q = randn(n,1);
q =	q/norm(q);
lambda = q'*A*q;

iter = 1;

while (norm(A*q - lambda*q) > 10^-12)

    pause(0.3);
    fprintf('iter:%d lambda:%.12f\n',iter,lambda);

	q = (A-lambda*eye(n))\q;
	q = q/norm(q);

	lambda = q'*A*q;

	iter = iter + 1;
end

v = q;

return
