A = fd3d(30,20,1,0,0,0,0);



[V, d] = Lan(A,2,100, 1);
d
d =
    0.0326
    0.0633



norm(A*V(:,1)-d(1)*V(:,1))
ans =
   6.7155e-09
norm(A*V(:,2)-d(2)*V(:,2))
ans =
   1.9510e-07
[V, d] = Lan(A,2,100, -1);
{Error using sort
DIM must be a positive integer.
Error in Lan (line 45)
 [lam, indx] = sort(diag(lam),orient);} 


[U, d1] = Lan(A,10,200,'ascend');
[U, d1] = Lan(A,10,200,'descend');
d1
d1 =
    7.9674
    7.9367
    7.9009
    7.8859
    7.8702
    7.8194
    7.8156
    7.7917
    7.7610
    7.7491
[U, d1] = Lan(A,2,100,'descend');



norm(A*V(:,1)-d(1)*V(:,1))
ans =
   6.7155e-09
norm(A*V(:,2)-d(2)*V(:,2))
ans =
   1.9510e-07

[U, d1] = Lan(A,2,200,'descend');
norm(A*V(:,1)-d(1)*V(:,1))
ans =
   6.7155e-09
[U, d1] = Lan(A,100,200,'descend');
[U, d1] = Lan(A,10,200,'descend');
d
d =
    0.0326
    0.0633
[U, d] = Lan(A,10,200,'descend');


d
d =
    7.9674
    7.9367
    7.9009
    7.8859
    7.8702
    7.8194
    7.8156
    7.7917
    7.7610
    7.7491
norm(A*V(:,1)-d(1)*V(:,1))
ans =
    7.9348
[V, d] = Lan(A,10,200,'descend');
norm(A*V(:,1)-d(1)*V(:,1))
ans =
   2.2015e-14

norm(A*V(:,1)-d(1)*V(:,1))
ans =
   2.2015e-14

[V, d] = Lan(A,10,200,'descend');


d
d =
    7.9674
    7.9674
    7.9367
    7.9367
    7.9009
    7.8859
    7.8736
    7.8702
    7.8194
    7.8156
diary off
