[BACK]Return to ntl.rr CVS log [TXT][DIR] Up to [local] / OpenXM / src / ox_ntl

Diff for /OpenXM/src/ox_ntl/ntl.rr between version 1.2 and 1.3

version 1.2, 2003/11/15 09:06:20 version 1.3, 2003/11/25 13:48:50
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/ox_ntl/ntl.rr,v 1.1 2003/11/03 03:11:21 iwane Exp $ */  /* $OpenXM: OpenXM/src/ox_ntl/ntl.rr,v 1.2 2003/11/15 09:06:20 iwane Exp $ */
   
 module ntl;  module ntl;
 localf factor$  localf factor$
Line 14  localf list2mat$
Line 14  localf list2mat$
 /* extern variables */  /* extern variables */
   
 #if 1  #if 1
 localf test$  localf test_factor$
   localf test_lll$
   
 /*&usage begin: ntl.test(PID, POLY)  /*&usage begin: ntl.test_factor(PID, POLY)
  compare on ox_NTL and on asir.   compare on ox_NTL and on asir.
   
 example:  example:
Line 28  x^16-136*x^14+6476*x^12-141912*x^10+1513334*x^8-745317
Line 29  x^16-136*x^14+6476*x^12-141912*x^10+1513334*x^8-745317
 [1031] ntl.test(PID, F);  [1031] ntl.test(PID, F);
 [CPU,0.121539,0.001354,GC,0.0222,0]  [CPU,0.121539,0.001354,GC,0.0222,0]
   
   
 end: */  end: */
 def test(PID, F)  def test_factor(PID, F)
 {  {
         T0 = time();          T0 = time();
         fctr(F);          fctr(F);
Line 41  def test(PID, F)
Line 41  def test(PID, F)
         return (["CPU", T1[0]-T0[0],T2[0]-T1[0],"GC",T1[1]-T0[1],T2[1]-T1[1]]);          return (["CPU", T1[0]-T0[0],T2[0]-T1[0],"GC",T1[1]-T0[1],T2[1]-T1[1]]);
 }  }
   
   def test_lll(PID, F)
   {
           T0 = time();
           pari(lllint, F);
           T1 = time();
           ntl.lll(PID, F);
           T2 = time();
   
           return (["CPU", T1[0]-T0[0],T2[0]-T1[0],"GC",T1[1]-T0[1],T2[1]-T1[1]]);
   }
   
 #endif  #endif
   
 /*&usage begin: ntl.factor(PID, POLY)  /*&usage begin: ntl.factor(PID, POLY)
Line 195  def list2mat(L)
Line 206  def list2mat(L)
         if (type(COL) == 10)          if (type(COL) == 10)
                 COL = int32ton(COL);                  COL = int32ton(COL);
   
         A = newmat(2, 2); /*, [[1, 0],[0, 1]]); /* COL, COL); */          A = newmat(ROW, COL);
   
         C = 2;          C = 2;
         for (I = 0; I < ROW; I++) {          for (I = 0; I < ROW; I++) {
Line 218  def list2mat(L)
Line 229  def list2mat(L)
         Matrix which element is Integer.          Matrix which element is Integer.
   
 example:  example:
 [1081] M=newmat(2,2,[[10,0],[-7,3]]);  [1046] def trans(M) {
 [ 10 0 ]    RET = newmat(size(M)[1], size(M)[0]);
 [ -7 3 ]      for (I = 0; I < size(M)[0]; I++)
 [1082] ntl.lll(PID, M);        for (J = 0; J < size(M)[1]; J++)
 [ 3 3 ]          RET[J][I] = M[I][J];
 [ 4 -6 ]    return (RET);
 [1083] pari(lll, M);  }
 [ 0 1 ]  [1047] def lllpari(A) {
 [ 1 2 ]                 <== why ?    return (trans(trans(A) * pari(lllint, trans(A))));
   }
   [1048] M=newmat(3, 3, [[10,0, 10], [-7,3, 30], [7, 3, 20]]);
   [ 10 0 10 ]
   [ -7 3 30 ]
   [ 7 3 20 ]
   [1049] ntl.lll(PID, M);
   [ 2 -6 0 ]
   [ -1 -3 10 ]
   [ 11 3 0 ]
   [1050] lllpari(M);
   [ 2 -6 0 ]
   [ -1 -3 10 ]
   [ 11 3 0 ]
   
   
 ref:  ref:
Line 238  def lll(PID, M)
Line 262  def lll(PID, M)
         /* parameter check */          /* parameter check */
         TYPE = type(M);          TYPE = type(M);
         if (TYPE != 6) {        /* matrix */          if (TYPE != 6) {        /* matrix */
                 error("ntl.lll: invalid argument");                  MES = "ntl.lll: invalid argument: " + TYPE;
                   error(MES);
         }          }
   
         A = mat2list(M);          A = mat2list(M);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>