function [r1,r2]=myeig(A,param);
if param==1
    for i=1:length(A)
        v=randn(length(A),1);vold=v+1;
        while norm(abs(vold)-abs(v))/norm(abs(v))>1e-6
              vold=v;z=A*v;v=z/sqrt(z'*z);
              sgn=sign(vold(1)*v(1));
        end
        ozvektor=v;ozdeger=sgn*sqrt(z'*z);
        r1(i,1)=ozdeger;r2(:,i)=ozvektor;
        A=A-ozdeger*ozvektor*ozvektor';
    end
end

if param==2
    i=1;
    while i<length(A)+1
       
        v=rand(length(A),1);vold=v+1;
        while norm(abs(vold)-abs(v))/norm(abs(v))>1e-6
              vold=v;z=pinv(A)*v;v=z/sqrt(z'*z);
              sgn=sign(vold(1)*v(1));
        end
         ozvektor=v;ozdeger=sgn/sqrt(z'*z);
        if abs(1/sqrt(z'*z))>1e-6 
        r1(i,1)=ozdeger,r2(:,i)=ozvektor,
        i=i+1;
        end
         A=A-ozdeger*ozvektor*ozvektor';
    
    end
end

if param==3
    check=1;P=eye(length(A),length(A));
    while check > 1e-6
        R=eye(length(A),length(A));
        [d1,i1]=max(abs(A-diag(diag(A))));
        [d2,i2]=max(d1);i1=i1(i2);
        th=acot((A(i2,i2)-A(i1,i1))/(2*A(i1,i2)))/2;
        R(i1,i1)=cos(th); R(i2,i2)=cos(th);
        R(i1,i2)=sin(th); R(i2,i1)=-sin(th);
        A=R'*A*R,P=P*R;
        check=sum(abs(A-diag(diag(A))))/sum(abs(diag(A)));
    end
    r2=P;r1=diag(A);
end




