function [v,d,flagsecon]=realM0n(v,d,lambdamin2)

global A  n  a delta
%===============================================================
alpha1=[];base1=[];
flag_shd=1;
base1=[base1,v];
alpha1=[alpha1;d/(v'*v)];
flagsecon=1;
while flag_shd
    opts.v0=randn(2*n,1);
    opts.isreal=0;
    opts.issym=0;
    [v,d]=eigs(@Areal,2*n,1,'lr',opts);
    if (real(d))<=-lambdamin2
        flagsecon=0;
        break;
    elseif (abs(imag(d)))<=1e-8
        break;
    end
    alpha1=[alpha1;d/(v'*v)];
    base1=[base1,v];
    
end

    function [v] = Areal(x)
        if flag_shd==1
            v=[-A*x(1:n)+a*(a'*x(n+1:end))/delta;x(1:n)-A*x(n+1:end)]-(base1*(alpha1.*(base1'*x)));
        end
    end
end

