[BACK]Return to ndbf.rr CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-contrib / testing / noro

Diff for /OpenXM/src/asir-contrib/testing/noro/ndbf.rr between version 1.1 and 1.2

version 1.1, 2009/10/09 07:15:44 version 1.2, 2009/10/12 21:42:59
Line 28  localf weyl_minipolym, weyl_minipoly, weyl_nf, weyl_nf
Line 28  localf weyl_minipolym, weyl_minipoly, weyl_nf, weyl_nf
 localf weyl_nf_quo, weyl_nf_mod, b_subst, v_factorial, w_tdeg$  localf weyl_nf_quo, weyl_nf_mod, b_subst, v_factorial, w_tdeg$
 localf replace_vars_f, replace_vars_v, replace_var$  localf replace_vars_f, replace_vars_v, replace_var$
 localf action_on_gfs, action_on_gfs_1$  localf action_on_gfs, action_on_gfs_1$
   localf nd_gb_candidate$
   
 /* stratification */  /* stratification */
   
Line 65  def bfunction(F)
Line 66  def bfunction(F)
   
 def in_ww(F)  def in_ww(F)
 {  {
           F = ptozp(F);
         V = vars(F);          V = vars(F);
         N = length(V);          N = length(V);
         D = newvect(N);          D = newvect(N);
Line 203  def in_ww_main(F,VW1,VW2)
Line 205  def in_ww_main(F,VW1,VW2)
         VDVH = append(VDV,[TMP_H]);          VDVH = append(VDV,[TMP_H]);
         FH = map(dp_dtop,map(dp_homo,map(dp_ptod,F,VDV)),VDVH);          FH = map(dp_dtop,map(dp_homo,map(dp_ptod,F,VDV)),VDVH);
   
         /* compute a groebner basis of FH w.r.t. MWH */  /*
    * FH is a GB w.r.t. any term order s.t. LT(FH)=[t,dx1,...,dxn]
    * Compute a groebner basis of FH w.r.t. MWH by modular change of
    * ordering.
    * Since F is Z-coef, LC(FH)=[1,...,1] and we can use any prime p
    * for trace algorithm.
    */
 /*      dp_gr_flags(["Top",1,"NoRA",1]); */  /*      dp_gr_flags(["Top",1,"NoRA",1]); */
 #if 0          for ( I = 0, HC=[]; I <= N; I++ ) HC = cons(1,HC);
         GH = dp_weyl_gr_main(FH,VDVH,0,0,11);          GH = nd_gb_candidate(FH,VDVH,11,0,HC,1);
 #else  
 #if 0  
         GH = dp_weyl_gr_main(FH,VDVH,0,-1,11);  
 #else  
         GH = nd_weyl_gr_trace(FH,VDVH,0,-1,11);  
 #endif  
 #endif  
 /*      dp_gr_flags(["Top",0,"NoRA",0]); */  /*      dp_gr_flags(["Top",0,"NoRA",0]); */
   
         /* dehomigenize GH */          /* dehomigenize GH */
Line 232  def in_ww_main(F,VW1,VW2)
Line 233  def in_ww_main(F,VW1,VW2)
   
         AllData = [G,GIN,VDV,W,T,WtV];          AllData = [G,GIN,VDV,W,T,WtV];
         if ( VW2 ) {          if ( VW2 ) {
                   /* take LC(GIN) w.r.t. DRL */
           dp_set_weight(WtV); dp_ord(0);
           HC = map(dp_hc,map(dp_ptod,GIN,VDV));
                 V2 = VW2[0]; DV2 = VW2[1]; WtV2 = VW2[2];                  V2 = VW2[0]; DV2 = VW2[1]; WtV2 = VW2[2];
                 VDV2 = append(V2,DV2);                  VDV2 = append(V2,DV2);
                 dp_set_weight(WtV2);                  dp_set_weight(WtV2);
         GIN2 = nd_weyl_gr_trace(GIN,VDV2,0,-1,0);                  GIN2 = nd_gb_candidate(GIN,VDV2,0,0,HC,1);
                 InData = [GIN2,VDV2,V2,DV2,WtV2];                  InData = [GIN2,VDV2,V2,DV2,WtV2];
         } else {          } else {
                 if ( 0 ) {                  if ( 0 ) {
Line 1304  def bf_strat_stage2(L)
Line 1308  def bf_strat_stage2(L)
                 M = elim_mat(VDV,DVRV);                  M = elim_mat(VDV,DVRV);
                 for ( K = 0; K < N; K++ )                  for ( K = 0; K < N; K++ )
                         M[1][K] = W[K];                          M[1][K] = W[K];
                 dp_ord(0); H1 = map(dp_ht,map(dp_ptod,G1,VDV));                  dp_ord(0); D1 = map(dp_ptod,G1,VDV);
                   H1 = map(dp_ht,D1); HC1 = map(dp_hc,D1);
                 dp_ord(M); H2 = map(dp_ht,map(dp_ptod,G1,VDV));                  dp_ord(M); H2 = map(dp_ht,map(dp_ptod,G1,VDV));
                 if ( H1 == H2 )                  if ( H1 == H2 )
                         G2 = G1;                          G2 = G1;
                 else                  else
                         G2 = nd_weyl_gr_trace(G1,VDV,0,-1,M);                          G2 = nd_gb_candidate(G1,VDV,M,0,HC1,1);
                 G1 = elimination(G2,DVRV);                  G1 = elimination(G2,DVRV);
         }          }
         T1 = time();          T1 = time();
Line 1332  def bf_strat_stage3(L)
Line 1337  def bf_strat_stage3(L)
         QQ = L[0]; V0 = L[2]; B = L[3]; BF = L[4]; W0 = L[5];          QQ = L[0]; V0 = L[2]; B = L[3]; BF = L[4]; W0 = L[5];
         NF = length(BF);          NF = length(BF);
         Data = vector(NF);          Data = vector(NF);
           W1 = W0? cons(1,append(W0,[1])) : 0;
         for ( I = J = 0; I < NF; I++ ) {          for ( I = J = 0; I < NF; I++ ) {
                 DI = tower_in_p(QQ,B,BF[I],V0,W0);                  DI = tower_in_p(QQ,B,BF[I],V0,W0);
                 NDI = length(DI);                  NDI = length(DI);
                   dp_set_weight(W1);
                 for ( K = 0; K < J; K++ ) {                  for ( K = 0; K < J; K++ ) {
                         if ( length(DK=Data[K]) == NDI ) {                          if ( length(DK=Data[K]) == NDI ) {
                                 for ( L = 0; L < NDI; L++ ) {                                  for ( L = 0; L < NDI; L++ ) {
Line 1345  def bf_strat_stage3(L)
Line 1352  def bf_strat_stage3(L)
                                 if ( L == NDI ) break;                                  if ( L == NDI ) break;
                         }                          }
                 }                  }
                   dp_set_weight(0);
                 if ( K < J ) {                  if ( K < J ) {
                         for ( L = 0, T = []; L < NDI; L++ )                          for ( L = 0, T = []; L < NDI; L++ )
                                 T = cons([[DK[L][0][0]*DI[L][0][0],DK[L][0][1]],                                  T = cons([[DK[L][0][0]*DI[L][0][0],DK[L][0][1]],
Line 1357  def bf_strat_stage3(L)
Line 1365  def bf_strat_stage3(L)
         for ( I = 0; I < J; I++ )          for ( I = 0; I < J; I++ )
                 Data1[I] = Data[I];                  Data1[I] = Data[I];
         T1 = time();          T1 = time();
         Str = stratify_bf(Data1,V0);          Str = stratify_bf(Data1,V0,W0);
         T2 = time();          T2 = time();
         print(["tower",(T1[0]+T1[1])-(T0[0]+T0[1])]);          print(["tower",(T1[0]+T1[1])-(T0[0]+T0[1])]);
         print(["strat",(T2[0]+T2[1])-(T1[0]+T1[1])]);          print(["strat",(T2[0]+T2[1])-(T1[0]+T1[1])]);
Line 1453  def conv_tdt(P,F,V0,DV0,T,DT)
Line 1461  def conv_tdt(P,F,V0,DV0,T,DT)
         return subst(R,T,s);          return subst(R,T,s);
 }  }
   
 def merge_tower(Str,Tower,V)  /* W1=[W,1], W2=[1,W,1] */
   
   def merge_tower(Str,Tower,V,W1,W2)
 {  {
         Prev = car(Tower); T = cdr(Tower);          Prev = car(Tower); T = cdr(Tower);
         Str1 = [];          Str1 = [];
Line 1468  def merge_tower(Str,Tower,V)
Line 1478  def merge_tower(Str,Tower,V)
         U = [];          U = [];
         for ( T = Str; T != []; T = cdr(T) ) {          for ( T = Str; T != []; T = cdr(T) ) {
                 for ( S = Str1; S != []; S = cdr(S) ) {                  for ( S = Str1; S != []; S = cdr(S) ) {
                         Int = int_cons(T[0],S[0],V);                          Int = int_cons(T[0],S[0],V,W1,W2);
                         if ( Int[0] != [1] )                          if ( Int[0] != [1] )
                                 U = cons(append(Int,[append(T[0][2],S[0][2])]),U);                                  U = cons(append(Int,[append(T[0][2],S[0][2])]),U);
                 }                  }
Line 1477  def merge_tower(Str,Tower,V)
Line 1487  def merge_tower(Str,Tower,V)
         return U;          return U;
 }  }
   
 def stratify_bf(Data,V)  def stratify_bf(Data,V,W)
 {  {
         N = length(Data);          N = length(Data);
         R = [];          R = [];
           if ( W ) {
                   W1 = append(W,[1]);
                   W2 = cons(1,W1);
           } else
                   W1 = W2 = 0;
         for ( I = 0; I < N; I++ )          for ( I = 0; I < N; I++ )
                 R = merge_tower(R,Data[I],V);                  R = merge_tower(R,Data[I],V,W1,W2);
         return R;          return R;
 }  }
   
Line 1588  def zero_inclusion(A,B,V)
Line 1603  def zero_inclusion(A,B,V)
         NV = ttttt;          NV = ttttt;
         for ( T = A; T != []; T = cdr(T) ) {          for ( T = A; T != []; T = cdr(T) ) {
                 F = car(T);                  F = car(T);
                 G = nd_gr_trace(cons(NV*F-1,B),cons(NV,V),1,-1,0);                  G = nd_gr_trace(cons(NV*F-1,B),cons(NV,V),1,1,0);
                 if ( type(car(G)) != 1 ) return 0;                  if ( type(car(G)) != 1 ) return 0;
         }          }
         return 1;          return 1;
Line 1622  def elim_mat(V,W)
Line 1637  def elim_mat(V,W)
    =(P cap R)-(Q cup S)     =(P cap R)-(Q cup S)
 */  */
   
 def int_cons(A,B,V)  def int_cons(A,B,V,W1,W2)
 {  {
         AZ = A[0]; AN = A[1];          AZ = A[0]; AN = A[1];
         BZ = B[0]; BN = B[1];          BZ = B[0]; BN = B[1];
           if ( W1 ) dp_set_weight(W1);
         CZ = nd_gr_trace(append(AZ,BZ),V,1,1,0);          CZ = nd_gr_trace(append(AZ,BZ),V,1,1,0);
           if ( W2 ) dp_set_weight(W2);
         CN = ideal_intersection(AN,BN,V,0);          CN = ideal_intersection(AN,BN,V,0);
         if ( zero_inclusion(CN,CZ,V) )          ZI = zero_inclusion(CN,CZ,V);
           dp_set_weight(0);
           if ( ZI )
                 return [[1],[]];                  return [[1],[]];
         else          else
                 return [CZ,CN];                  return [CZ,CN];
Line 1641  def ideal_intersection(A,B,V,Ord)
Line 1660  def ideal_intersection(A,B,V,Ord)
                 cons(T,V),1,1,[[0,1],[Ord,length(V)]]);                  cons(T,V),1,1,[[0,1],[Ord,length(V)]]);
         return elimination(G,V);          return elimination(G,V);
 }  }
   
   def nd_gb_candidate(G,V,Ord,Homo,HC,Weyl)
   {
           Ind = 0;
           N = length(HC);
           while ( 1 ) {
                   P = lprime(Ind++);
                   for ( I = 0; I < N; I++ )
                           if ( !(HC[I]%P) ) break;
                   if ( I < N ) continue;
                   if ( Weyl )
                           G = nd_weyl_gr_trace(G,V,Homo,-P,Ord);
                   else
                           G = nd_gr_trace(G,V,Homo,-P,Ord);
                   if ( G ) return G;
           }
   }
   
 endmodule $  endmodule $
 end$  end$
   

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

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