Changeset 9d6f3a in git


Ignore:
Timestamp:
Nov 4, 2009, 2:39:32 PM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '79dfb9a6d258bfeb991428bdb25b8f55e9e809b2')
Children:
d4a2c308a86a41c2637ba8e3d31b5ed78b9f2ee7
Parents:
151f85d6b8f7459eb6a91452f5ce85020f49ae7a
Message:
*hannes: use bigint instead of number

git-svn-id: file:///usr/local/Singular/svn/trunk@12238 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/modstd.lib

    r151f85 r9d6f3a  
    386386   poly result;
    387387   number n;
    388    number N=L[1];
     388   bigint N=L[1];
    389389   for(i=size(L);i>1;i--)
    390390   {
     
    393393   while(h!=0)
    394394   {
    395      n=Farey(N,leadcoef(h));
     395     n=Farey(N,bigint(leadcoef(h)));
    396396     result=result+n*p;
    397397     h=h-lead(h);
     
    420420   number n;
    421421
    422    number N=L[1];
     422   bigint N=L[1];
    423423   for(i=2;i<=size(L);i++)
    424424   {
     
    449449     }
    450450     n=chineseR(TT,L,N);
    451      n=Farey(N,n);
     451     n=Farey(N,bigint(n));
    452452     result=result+n*p;
    453453   }
     
    466466   int i,j;
    467467   number n;
    468    number N=L[1];
     468   bigint N=L[1];
    469469   for(i=2;i<=size(L);i++)
    470470   {
     
    480480        if (p==0) {break;}
    481481        p=p-lead(p);
    482         n=Farey(N,leadcoef(p));
     482        n=Farey(N,bigint(leadcoef(p)));
    483483        result=result+n*leadmonom(p);
    484484     }
     
    488488}
    489489///////////////////////////////////////////////////////////////////////////////
    490 proc Farey (number P, number N)
     490proc Farey (bigint P, bigint N)
    491491"USAGE:  Farey (P,N); P, N number;
    492492RETURN:  a rational number a/b such that a/b=N mod P
     
    496496   if (P<0){P=-P;}
    497497   if (N<0){N=N+P;}
    498    number A,B,C,D,E;
     498   bigint A,B,C,D,E;
    499499   E=P;
    500500   B=1;
     
    503503        if (2*N^2<P)
    504504        {
    505            return(N/B);
     505           return(number(N)/number(B));
    506506        }
    507507        D=E mod N;
    508         C=A-(E-E mod N)/N*B;
     508        C=A-(E div N)*B;
    509509        E=N;
    510510        N=D;
     
    581581  kill r1;
    582582  number c=p;
     583  bigint cb=p;
    583584  matrix G0=transpose(matrix(G));
    584   G0= MmodN(G0+ (c)* G22,c^2);
    585   matrix GF=fareyMatrix(G0,c^2);
    586   Z=MmodN(Z+(c)*Z2,c^2);
     585  G0= MmodN(G0+ (c)* G22,cb^2);
     586  matrix GF=fareyMatrix(G0,cb^2);
     587  Z=MmodN(Z+(c)*Z2,cb^2);
    587588  matrix C=transpose(G);
    588589  int n=3;
     
    596597    M=redmat(G,G1,G22);
    597598    Z2=-M*Z;
    598     Z=MmodN(Z+(c^(n-1))*Z2,c^n);
    599     G0= MmodN(G0+ (c^(n-1))* G22,c^n);
    600     GF=fareyMatrix(G0,c^n);
     599    Z=MmodN(Z+(c^(n-1))*Z2,cb^n);
     600    G0= MmodN(G0+ (c^(n-1))* G22,cb^n);
     601    GF=fareyMatrix(G0,cb^n);
    601602    n++;
    602603  }
     
    691692}
    692693///////////////////////////////////////////////////////////////////////////
    693 proc fareyMatrix(matrix m,number N)
     694proc fareyMatrix(matrix m,bigint N)
    694695"USAGE:  fareyMatrix(m,y); m matrix, y integer;
    695696RETURN:  a matrix k of the matrix m with Farey rational numbers a/b as coefficients
     
    709710      if (p==0) {break;}
    710711      p=p-lead(p);
    711       n=Farey(N,leadcoef(p));
     712      n=Farey(N,bigint(leadcoef(p)));
    712713      result=result+n*leadmonom(p);
    713714    }
     
    726727}
    727728///////////////////////////////////////////////////////////////////////////
    728 proc MmodN(matrix Z,number N)
    729 "USAGE:  MmodN(Z,N);Z matrix, N number;
     729proc MmodN(matrix Z,bigint N)
     730"USAGE:  MmodN(Z,N);Z matrix, N bigint;
    730731RETURN:  the matrix Z mod N
    731732EXAMPLE: example MmodN;
     
    742743      {
    743744        m=leadmonom(Z[i,j][k]);
    744         c=leadcoef(Z[i,j][k]) mod N;
     745        c=bigint(leadcoef(Z[i,j][k])) mod N;
    745746        p=p+c*m;
    746747      }
     
    755756   ring r = 0,(x,y,z),dp;
    756757   matrix m[3][1]= x3+10668x2+10668, z4-12801z2+12802, y5-8728y3+14547;
    757    number p=32003;
     758   bigint p=32003;
    758759   matrix b=MmodN(m,p^2);
    759760   b;
Note: See TracChangeset for help on using the changeset viewer.