Matlab椭圆曲线RMP功能

时间:2012-06-12 14:28:40

标签: matlab elliptic-curve

function [X,Y,n] = PC(A,B,p)
% This function m-file finds and plots all the points that lie in E_p(A,B)
% These points are on the curve y^2 = x^3 + AX + b (mod p)
    RHS = zeros(3,1);
    LHS = zeros(3,1);
    X = zeros(2,1);
    Y = zeros(2,1);
    for i=0:1:(p-1)
        RHS(i+1) = (i)^3 + A*(i) + B;
        RHS(i+1) = rmp(RHS(i+1),p);
        LHS(i+1) = (i)^2;
        LHS(i+1) = rmp(LHS(i+1),p);

    end
    ii=1;
    for z=0:1:(p-1)
        I=find(RHS==z);
        J=find(LHS==z);
        q1 = isempty(I);
        q2 = isempty(J);
        if (q1) == 0
            if q2 == 0
                n=length(I);
                m=length(J);
                for h=1:1:n
                    for g=1:m
                        X(ii)=I(h)-1;
                        Y(ii)=J(g)-1;
                        ii=ii+1;
                    end
                end
            end
        end
    end
    n=length(X) + 1;
    %%%%%%%PLOTTING%%%%%%%%%%%
    h=plot(X,Y,'ko');
    set(h(1),'LineWidth',1.5)
    axis([0, (max(X)+1), 0,(max(Y)+1) ])
    xlabel('X','FontSize',15,'FontWeight','bold')
    ylabel('Y','FontSize',15,'FontWeight','bold')
    title(['The points in E_{',int2str(p),'}',int2str(A),',',int2str(B),')'],'FontSize',12,'FontWeight','bold')

代码将查找并绘制特定主曲线上的所有点。这个m文件作为输入,A,B和p和 产生两个向量X,Y,它们包含所有位于其上的点(x,y) y2 x3 + Ax + B(mod p)。

我只是想知道什么是rmp功能及其使用原因。我试着在matlab文档中找到它,但我找不到它。

0 个答案:

没有答案