function [lambd,Vp,iter,err] = RAYONSPECTRALREEL(A,epsilon,tol,Niter)
% [lambd,Vp,iter,err] = RAYONSPECTRALREEL(A,epsilon,tol, Niter) 
[N,N]  = size(A);      
X0     = 2*tol*(rand(N,1)-1/2);   
X0     = X0/norm(X0); Vp = X0; lambd = X0'*A*X0;   
err    = 2*epsilon ; iter = 0;  
while (err > epsilon) & iter < Niter   
Vpold  = Vp ; Vpaux = A*Vpold; Vp = Vpaux/norm(Vpaux);  
lambd  = Vp'*A*Vp;  
err    = min(norm(Vp-Vpold),norm(Vp+Vpold)); 
iter   = iter + 1;  
end              
end