[BACK]Return to dp.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2018 / builtin

Diff for /OpenXM_contrib2/asir2018/builtin/dp.c between version 1.14 and 1.19

version 1.14, 2019/09/13 09:02:49 version 1.19, 2019/11/21 04:03:16
Line 45 
Line 45 
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  *   *
  * $OpenXM: OpenXM_contrib2/asir2018/builtin/dp.c,v 1.13 2019/09/05 08:49:43 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2018/builtin/dp.c,v 1.18 2019/11/19 10:50:31 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "base.h"  #include "base.h"
Line 79  void Pdp_nf_mod(),Pdp_true_nf_mod();
Line 79  void Pdp_nf_mod(),Pdp_true_nf_mod();
 void Pdp_criB(),Pdp_nelim();  void Pdp_criB(),Pdp_nelim();
 void Pdp_minp(),Pdp_sp_mod();  void Pdp_minp(),Pdp_sp_mod();
 void Pdp_homo(),Pdp_dehomo();  void Pdp_homo(),Pdp_dehomo();
   void Pdpm_homo(),Pdpm_dehomo();
 void Pdp_gr_mod_main(),Pdp_gr_f_main();  void Pdp_gr_mod_main(),Pdp_gr_f_main();
 void Pdp_gr_main(),Pdp_gr_hm_main(),Pdp_gr_d_main(),Pdp_gr_flags();  void Pdp_gr_main(),Pdp_gr_hm_main(),Pdp_gr_d_main(),Pdp_gr_flags();
 void Pdp_interreduce();  void Pdp_interreduce();
Line 89  void Pdp_vtoe(), Pdp_etov(), Pdp_dtov(), Pdp_idiv(), P
Line 90  void Pdp_vtoe(), Pdp_etov(), Pdp_dtov(), Pdp_idiv(), P
 void Pdp_cont();  void Pdp_cont();
 void Pdp_gr_checklist();  void Pdp_gr_checklist();
 void Pdp_ltod(),Pdpv_ord(),Pdpv_ht(),Pdpv_hm(),Pdpv_hc();  void Pdp_ltod(),Pdpv_ord(),Pdpv_ht(),Pdpv_hm(),Pdpv_hc();
 void Pdpm_ltod(),Pdpm_dtol(),Pdpm_set_schreyer(),Pdpm_nf(),Pdpm_weyl_nf(),Pdpm_sp(),Pdpm_weyl_sp(),Pdpm_nf_and_quotient();  void Pdpm_ltod(),Pdpm_dtol(),Pdpm_set_schreyer(),Pdpm_nf(),Pdpm_weyl_nf(),Pdpm_sp(),Pdpm_weyl_sp(),Pdpm_nf_and_quotient(),Pdpm_nf_and_quotient2();
   void Pdpm_schreyer_frame(),Pdpm_set_schreyer_level();
   void Pdpm_list_to_array(),Pdpm_sp_nf(),Pdpm_insert_to_zlist();
 void Pdpm_hm(),Pdpm_ht(),Pdpm_hc(),Pdpm_hp(),Pdpm_rest(),Pdpm_shift(),Pdpm_split(),Pdpm_sort(),Pdpm_dptodpm(),Pdpm_redble();  void Pdpm_hm(),Pdpm_ht(),Pdpm_hc(),Pdpm_hp(),Pdpm_rest(),Pdpm_shift(),Pdpm_split(),Pdpm_sort(),Pdpm_dptodpm(),Pdpm_redble();
 void Pdpm_schreyer_base(),Pdpm_simplify_syz();  void Pdpm_schreyer_base(),Pdpm_simplify_syz(),Pdpm_td();
   
 void Pdp_weyl_red();  void Pdp_weyl_red();
 void Pdp_weyl_sp();  void Pdp_weyl_sp();
Line 159  struct ftab dp_tab[] = {
Line 162  struct ftab dp_tab[] = {
   {"dp_nf_mod",Pdp_nf_mod,5},    {"dp_nf_mod",Pdp_nf_mod,5},
   {"dp_nf_f",Pdp_nf_f,4},    {"dp_nf_f",Pdp_nf_f,4},
   {"dpm_nf_and_quotient",Pdpm_nf_and_quotient,-3},    {"dpm_nf_and_quotient",Pdpm_nf_and_quotient,-3},
     {"dpm_nf_and_quotient2",Pdpm_nf_and_quotient2,-3},
   {"dpm_nf_f",Pdpm_nf_f,-4},    {"dpm_nf_f",Pdpm_nf_f,-4},
   {"dpm_weyl_nf_f",Pdpm_weyl_nf_f,-4},    {"dpm_weyl_nf_f",Pdpm_weyl_nf_f,-4},
   {"dpm_nf",Pdpm_nf,-4},    {"dpm_nf",Pdpm_nf,-4},
Line 255  struct ftab dp_supp_tab[] = {
Line 259  struct ftab dp_supp_tab[] = {
   {"dp_sort",Pdp_sort,1},    {"dp_sort",Pdp_sort,1},
   {"dp_ord",Pdp_ord,-1},    {"dp_ord",Pdp_ord,-1},
   {"dpm_set_schreyer",Pdpm_set_schreyer,-1},    {"dpm_set_schreyer",Pdpm_set_schreyer,-1},
     {"dpm_set_schreyer_level",Pdpm_set_schreyer_level,1},
     {"dpm_schreyer_frame",Pdpm_schreyer_frame,1},
   {"dpv_ord",Pdpv_ord,-2},    {"dpv_ord",Pdpv_ord,-2},
   {"dp_set_kara",Pdp_set_kara,-1},    {"dp_set_kara",Pdp_set_kara,-1},
   {"dp_nelim",Pdp_nelim,-1},    {"dp_nelim",Pdp_nelim,-1},
Line 278  struct ftab dp_supp_tab[] = {
Line 284  struct ftab dp_supp_tab[] = {
   {"dpm_ltod",Pdpm_ltod,2},    {"dpm_ltod",Pdpm_ltod,2},
   {"dpm_dptodpm",Pdpm_dptodpm,2},    {"dpm_dptodpm",Pdpm_dptodpm,2},
   {"dpm_dtol",Pdpm_dtol,2},    {"dpm_dtol",Pdpm_dtol,2},
     {"dpm_homo",Pdpm_homo,1},
     {"dpm_dehomo",Pdpm_dehomo,1},
   
   /* criteria */    /* criteria */
   {"dp_cri1",Pdp_cri1,2},    {"dp_cri1",Pdp_cri1,2},
Line 311  struct ftab dp_supp_tab[] = {
Line 319  struct ftab dp_supp_tab[] = {
   {"dp_mag",Pdp_mag,1},    {"dp_mag",Pdp_mag,1},
   {"dp_sugar",Pdp_sugar,1},    {"dp_sugar",Pdp_sugar,1},
   {"dp_set_sugar",Pdp_set_sugar,2},    {"dp_set_sugar",Pdp_set_sugar,2},
     {"dpm_td",Pdpm_td,1},
   
   /* misc */    /* misc */
   {"dp_mbase",Pdp_mbase,1},    {"dp_mbase",Pdp_mbase,1},
Line 326  struct ftab dp_supp_tab[] = {
Line 335  struct ftab dp_supp_tab[] = {
   {"dp_mono_raddec",Pdp_mono_raddec,2},    {"dp_mono_raddec",Pdp_mono_raddec,2},
   {"dp_mono_reduce",Pdp_mono_reduce,2},    {"dp_mono_reduce",Pdp_mono_reduce,2},
   {"dpm_schreyer_base",Pdpm_schreyer_base,1},    {"dpm_schreyer_base",Pdpm_schreyer_base,1},
     {"dpm_list_to_array",Pdpm_list_to_array,1},
     {"dpm_sp_nf",Pdpm_sp_nf,4},
     {"dpm_insert_to_zlist",Pdpm_insert_to_zlist,3},
   {"dpm_simplify_syz",Pdpm_simplify_syz,2},    {"dpm_simplify_syz",Pdpm_simplify_syz,2},
   
   {"dp_rref2",Pdp_rref2,2},    {"dp_rref2",Pdp_rref2,2},
Line 929  void Pdp_ord(NODE arg,Obj *rp)
Line 941  void Pdp_ord(NODE arg,Obj *rp)
     else if ( !create_order_spec(0,(Obj)ARG0(arg),&spec) )      else if ( !create_order_spec(0,(Obj)ARG0(arg),&spec) )
       error("dp_ord : invalid order specification");        error("dp_ord : invalid order specification");
     initd(spec); *rp = spec->obj;      initd(spec); *rp = spec->obj;
     if ( spec->id >= 256 ) dpm_ordtype = spec->ispot;      if ( spec->id >= 256 ) dpm_ordtype = spec->module_ordtype;
   }    }
 }  }
   
Line 1094  void Pdpm_dptodpm(NODE arg,DPM *rp)
Line 1106  void Pdpm_dptodpm(NODE arg,DPM *rp)
 {  {
   DP p;    DP p;
   MP mp;    MP mp;
   int pos;    int pos,shift;
   DMM m0,m;    DMM m0,m;
   
   p = (DP)ARG0(arg);    p = (DP)ARG0(arg);
Line 1106  void Pdpm_dptodpm(NODE arg,DPM *rp)
Line 1118  void Pdpm_dptodpm(NODE arg,DPM *rp)
     for ( m0 = 0, mp = BDY(p); mp; mp = NEXT(mp) ) {      for ( m0 = 0, mp = BDY(p); mp; mp = NEXT(mp) ) {
       NEXTDMM(m0,m); m->dl = mp->dl; m->c = mp->c; m->pos = pos;        NEXTDMM(m0,m); m->dl = mp->dl; m->c = mp->c; m->pos = pos;
     }      }
     MKDPM(p->nv,m0,*rp); (*rp)->sugar = p->sugar;      if ( dp_current_spec->module_rank ) {
         if ( pos > dp_current_spec->module_rank )
           error("dpm_dptodpm : inconsistent order spec");
         shift = dp_current_spec->module_top_weight[pos-1];
         m->dl->td += shift;
       } else
         shift = 0;
   
       MKDPM(p->nv,m0,*rp); (*rp)->sugar = p->sugar+shift;
   }    }
 }  }
   
Line 1332  void Pdpm_nf(NODE arg,DPM *rp)
Line 1352  void Pdpm_nf(NODE arg,DPM *rp)
 }  }
   
 DP *dpm_nf_and_quotient(NODE b,DPM g,VECT ps,DPM *rp,P *dnp);  DP *dpm_nf_and_quotient(NODE b,DPM g,VECT ps,DPM *rp,P *dnp);
   DPM dpm_nf_and_quotient2(NODE b,DPM g,VECT ps,DPM *rp,P *dnp);
   
 void Pdpm_nf_and_quotient(NODE arg,LIST *rp)  void Pdpm_nf_and_quotient(NODE arg,LIST *rp)
 {  {
Line 1366  void Pdpm_nf_and_quotient(NODE arg,LIST *rp)
Line 1387  void Pdpm_nf_and_quotient(NODE arg,LIST *rp)
   MKLIST(*rp,n);    MKLIST(*rp,n);
 }  }
   
   void Pdpm_nf_and_quotient2(NODE arg,LIST *rp)
   {
     NODE b;
     VECT ps;
     DPM g,nm,q;
     P dn;
     NODE n;
     int ac;
   
     do_weyl = 0; dp_fcoeffs = 0;
     ac = argc(arg);
     if ( ac < 2 )
       error("dpm_nf_and_quotient2 : invalid arguments");
     else if ( ac == 2 ) {
       asir_assert(ARG1(arg),O_VECT,"dpm_nf_and_quotient2");
       b = 0; g = (DPM)ARG0(arg); ps = (VECT)ARG1(arg);
     } else if ( ac == 3 ) {
       asir_assert(ARG0(arg),O_LIST,"dpm_nf_and_quotient2");
       asir_assert(ARG2(arg),O_VECT,"dpm_nf_and_quotient2");
       b = BDY((LIST)ARG0(arg)); g = (DPM)ARG1(arg); ps = (VECT)ARG2(arg);
     }
     if ( g ) {
       q = dpm_nf_and_quotient2(b,g,ps,&nm,&dn);
     } else {
       q = 0; nm = 0; dn = (P)ONE;
     }
     n = mknode(3,nm,dn,q);
     MKLIST(*rp,n);
   }
   
 void Pdpm_weyl_nf(NODE arg,DPM *rp)  void Pdpm_weyl_nf(NODE arg,DPM *rp)
 {  {
   NODE b;    NODE b;
Line 1877  void Pdpm_redble(NODE arg,Z *rp)
Line 1928  void Pdpm_redble(NODE arg,Z *rp)
 }  }
   
 void dpm_schreyer_base(LIST g,LIST *s);  void dpm_schreyer_base(LIST g,LIST *s);
   void dpm_schreyer_base_zlist(LIST g,LIST *s);
   
 void Pdpm_schreyer_base(NODE arg,LIST *rp)  void Pdpm_schreyer_base(NODE arg,LIST *rp)
 {  {
   asir_assert(ARG0(arg),O_LIST,"dpm_schreyer_base");    asir_assert(ARG0(arg),O_LIST,"dpm_schreyer_base");
   dpm_schreyer_base((LIST)ARG0(arg),rp);    dpm_schreyer_base_zlist((LIST)ARG0(arg),rp);
 }  }
   
 void dpm_simplify_syz(LIST m,LIST s,LIST *m1,LIST *s1);  void dpm_list_to_array(LIST g,VECT *psv,VECT *psiv);
   
   void Pdpm_list_to_array(NODE arg,LIST *rp)
   {
     VECT psv,psiv;
     NODE nd;
   
     asir_assert(ARG0(arg),O_LIST,"dpm_list_to_array");
     dpm_list_to_array((LIST)ARG0(arg),&psv,&psiv);
     nd = mknode(2,psv,psiv);
     MKLIST(*rp,nd);
   }
   
   /* [quo,nf] = dpm_sp_nf(psv,psiv,i,j) */
   DPM dpm_sp_nf_zlist(VECT psv,VECT psiv,int i,int j,DPM *nf);
   
   void Pdpm_sp_nf(NODE arg,LIST *rp)
   {
     VECT psv,psiv;
     DPM quo,nf;
     int i,j;
     NODE nd;
   
     asir_assert(ARG0(arg),O_VECT,"dpm_sp_nf"); psv = (VECT)ARG0(arg);
     asir_assert(ARG1(arg),O_VECT,"dpm_sp_nf"); psiv = (VECT)ARG1(arg);
     asir_assert(ARG2(arg),O_N,"dpm_sp_nf"); i = ZTOS((Q)ARG2(arg));
     asir_assert(ARG3(arg),O_N,"dpm_sp_nf"); j = ZTOS((Q)ARG3(arg));
     quo = dpm_sp_nf_zlist(psv,psiv,i,j,&nf);
     nd = mknode(2,quo,nf);
     MKLIST(*rp,nd);
   }
   
   void dpm_insert_to_zlist(VECT psiv,int pos,int i);
   
   /* insert_to_zlist(indarray,dpm_hp(f),i) */
   void Pdpm_insert_to_zlist(NODE arg,VECT *rp)
   {
     VECT psiv;
     int i,pos;
   
     asir_assert(ARG0(arg),O_VECT,"dpm_insert_to_zlist"); psiv = (VECT)ARG0(arg);
     asir_assert(ARG1(arg),O_N,"dpm_insert_to_zlist"); pos = ZTOS((Q)ARG1(arg));
     asir_assert(ARG2(arg),O_N,"dpm_insert_to_zlist"); i = ZTOS((Q)ARG2(arg));
     dpm_insert_to_zlist(psiv,pos,i);
     *rp = psiv;
   }
   
   
   void dpm_simplify_syz(LIST m,LIST s,LIST *m1,LIST *s1,LIST *w1);
   
 void Pdpm_simplify_syz(NODE arg,LIST *rp)  void Pdpm_simplify_syz(NODE arg,LIST *rp)
 {  {
   LIST s1,m1;    LIST s1,m1,w1;
   NODE t;    NODE t;
   
   asir_assert(ARG0(arg),O_LIST,"dpm_simplify_syz");    asir_assert(ARG0(arg),O_LIST,"dpm_simplify_syz");
   asir_assert(ARG1(arg),O_LIST,"dpm_simplify_syz");    asir_assert(ARG1(arg),O_LIST,"dpm_simplify_syz");
   dpm_simplify_syz((LIST)ARG0(arg),(LIST)ARG1(arg),&s1,&m1);    dpm_simplify_syz((LIST)ARG0(arg),(LIST)ARG1(arg),&s1,&m1,&w1);
   t = mknode(2,s1,m1);    t = mknode(3,s1,m1,w1);
   MKLIST(*rp,t);    MKLIST(*rp,t);
 }  }
   
Line 2182  void Pdp_td(NODE arg,Z *rp)
Line 2282  void Pdp_td(NODE arg,Z *rp)
     STOZ(BDY(p)->dl->td,*rp);      STOZ(BDY(p)->dl->td,*rp);
 }  }
   
   void Pdpm_td(NODE arg,Z *rp)
   {
     DPM p;
   
     p = (DPM)ARG0(arg); asir_assert(p,O_DPM,"dpm_td");
     if ( !p )
       *rp = 0;
     else
       STOZ(BDY(p)->dl->td,*rp);
   }
   
 void Pdp_sugar(NODE arg,Z *rp)  void Pdp_sugar(NODE arg,Z *rp)
 {  {
   DP p;    DP p;
Line 2422  void Pdp_dehomo(NODE arg,DP *rp)
Line 2533  void Pdp_dehomo(NODE arg,DP *rp)
   dp_dehomo((DP)ARG0(arg),rp);    dp_dehomo((DP)ARG0(arg),rp);
 }  }
   
   void dpm_homo(DPM a,DPM *b);
   void dpm_dehomo(DPM a,DPM *b);
   
   void Pdpm_homo(NODE arg,DPM *rp)
   {
     asir_assert(ARG0(arg),O_DPM,"dpm_homo");
     dpm_homo((DPM)ARG0(arg),rp);
   }
   
   void Pdpm_dehomo(NODE arg,DPM *rp)
   {
     asir_assert(ARG0(arg),O_DPM,"dpm_dehomo");
     dpm_dehomo((DPM)ARG0(arg),rp);
   }
   
   
 void Pdp_gr_flags(NODE arg,LIST *rp)  void Pdp_gr_flags(NODE arg,LIST *rp)
 {  {
   Obj name,value;    Obj name,value;
Line 3920  void Pdpv_ord(NODE arg,Obj *rp)
Line 4047  void Pdpv_ord(NODE arg,Obj *rp)
 }  }
   
 extern int dpm_ordtype;  extern int dpm_ordtype;
   extern DMMstack dmm_stack;
   
 void set_schreyer_order(LIST n);  void set_schreyer_order(LIST n);
   
 LIST schreyer_obj;  
   
 void Pdpm_set_schreyer(NODE arg,LIST *rp)  void Pdpm_set_schreyer(NODE arg,LIST *rp)
 {  {
   if ( argc(arg) ) {    if ( argc(arg) ) {
     schreyer_obj = (LIST)ARG0(arg);      set_schreyer_order(ARG0(arg)?(LIST)ARG0(arg):0);
     set_schreyer_order(schreyer_obj);  
   }    }
   *rp = schreyer_obj;    if ( dmm_stack )
       *rp = dmm_stack->obj;
     else
       *rp = 0;
 }  }
   
   DMMstack_array Schreyer_Frame;
   DMMstack_array dpm_schreyer_frame(NODE n);
   void set_schreyer_level(DMMstack_array array,int level);
   
   void Pdpm_set_schreyer_level(NODE arg,Q *rp)
   {
     set_schreyer_level(Schreyer_Frame,ZTOS((Q)ARG0(arg)));
     *rp = (Q)ARG0(arg);
   }
   
   void Pdpm_schreyer_frame(NODE arg,LIST *rp)
   {
     DMMstack_array a;
     DMMstack *body;
     NODE b,b1;
     LIST l;
     int len,i;
   
     Schreyer_Frame = a = dpm_schreyer_frame(BDY((LIST)ARG0(arg)));
     len = a->len;
     body = a->body;
     b = 0;
     for ( i = 0; i < len; i++ ) {
       MKNODE(b1,(pointer)body[i]->obj,b);
       b = b1;
     }
     MKLIST(l,b);
     *rp = l;
   }
   
   
 void Pdpm_hm(NODE arg,DPM *rp)  void Pdpm_hm(NODE arg,DPM *rp)
 {  {

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.19

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