[BACK]Return to nd.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2018 / engine

Diff for /OpenXM_contrib2/asir2018/engine/nd.h between version 1.2 and 1.11

version 1.2, 2018/09/25 21:51:21 version 1.11, 2020/10/26 02:41:05
Line 1 
Line 1 
 /* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.h,v 1.1 2018/09/19 05:45:07 noro Exp $ */  /* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.h,v 1.10 2020/07/03 03:37:59 noro Exp $ */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
 #include "ox.h"  #include "ox.h"
Line 28  typedef struct oPGeoBucket {
Line 28  typedef struct oPGeoBucket {
   struct oND *body[32];    struct oND *body[32];
 } *PGeoBucket;  } *PGeoBucket;
   
   typedef struct oSIG {
     int pos;
     DL dl;
   } *SIG;
   
 /* distributed polynomial; linked list rep. */  /* distributed polynomial; linked list rep. */
 typedef struct oND {  typedef struct oND {
   struct oNM *body;    struct oNM *body;
   int nv;    int nv;
   int len;    int len;
   int sugar;    int sugar;
     SIG sig;
 } *ND;  } *ND;
   
 /* distributed polynomial; array rep. */  /* distributed polynomial; array rep. */
Line 42  typedef struct oNDV {
Line 48  typedef struct oNDV {
   int nv;    int nv;
   int len;    int len;
   int sugar;    int sugar;
     SIG sig;
 } *NDV;  } *NDV;
   
 typedef union oNDC {  typedef union oNDC {
   int m;    long m;
   Z z;    Z z;
   LM lm;    LM lm;
   Z gz;  
   P p;    P p;
   R r;    R r;
   DAlg a;    DAlg a;
Line 72  typedef struct oRHist {
Line 78  typedef struct oRHist {
   struct oRHist *next;    struct oRHist *next;
   int index;    int index;
   int sugar;    int sugar;
     SIG sig;
   UINT dl[1];    UINT dl[1];
 } *RHist;  } *RHist;
   
Line 81  typedef struct oND_pairs {
Line 88  typedef struct oND_pairs {
   int i1,i2;    int i1,i2;
   int sugar;    int sugar;
   int sugar2;    int sugar2;
     SIG sig;
     int zero;
   UINT lcm[1];    UINT lcm[1];
 } *ND_pairs;  } *ND_pairs;
   
Line 106  typedef struct oNM_ind_pair
Line 115  typedef struct oNM_ind_pair
 {  {
   NM mul;    NM mul;
   int index,sugar;    int index,sugar;
     SIG sig;
 } *NM_ind_pair;  } *NM_ind_pair;
   
 typedef struct oIndArray  typedef struct oIndArray
Line 145  extern int *current_module_weight_vector;
Line 155  extern int *current_module_weight_vector;
 #define HCU(d) ((d)->body->c)  #define HCU(d) ((d)->body->c)
 #define HCM(d) ((d)->body->c.m)  #define HCM(d) ((d)->body->c.m)
 #define HCLM(d) ((d)->body->c.lm)  #define HCLM(d) ((d)->body->c.lm)
 #define HCQ(d) ((d)->body->c.z)  #define HCZ(d) ((d)->body->c.z)
 #define HCZ(d) ((d)->body->c.gz)  
 #define HCP(d) ((d)->body->c.p)  #define HCP(d) ((d)->body->c.p)
 #define HCA(d) ((d)->body->c.a)  #define HCA(d) ((d)->body->c.a)
 #define CM(x) ((x)->c.m)  #define CM(x) ((x)->c.m)
 #define CLM(x) ((x)->c.lm)  #define CLM(x) ((x)->c.lm)
 #define CQ(x) ((x)->c.z)  #define CZ(x) ((x)->c.z)
 #define CZ(x) ((x)->c.gz)  
 #define CP(x) ((x)->c.p)  #define CP(x) ((x)->c.p)
 #define CA(x) ((x)->c.a)  #define CA(x) ((x)->c.a)
 #define DL(x) ((x)->dl)  #define DL(x) ((x)->dl)
Line 189  extern int *current_module_weight_vector;
Line 197  extern int *current_module_weight_vector;
 ((r)=(RHist)MALLOC(sizeof(struct oRHist)+(nd_wpd-1)*sizeof(UINT)))  ((r)=(RHist)MALLOC(sizeof(struct oRHist)+(nd_wpd-1)*sizeof(UINT)))
 #define NEWND_pairs(m) \  #define NEWND_pairs(m) \
 if(!_ndp_free_list)_NDP_alloc();\  if(!_ndp_free_list)_NDP_alloc();\
 (m)=_ndp_free_list; _ndp_free_list = NEXT(_ndp_free_list)  (m)=_ndp_free_list; (m)->zero = 0; _ndp_free_list = NEXT(_ndp_free_list)
 #define NEWNM(m)\  #define NEWNM(m)\
 if(!_nm_free_list)_NM_alloc();\  if(!_nm_free_list)_NM_alloc();\
 (m)=_nm_free_list; _nm_free_list = NEXT(_nm_free_list)  (m)=_nm_free_list; _nm_free_list = NEXT(_nm_free_list)
Line 201  NV(d)=(n); LEN(d)=(len); BDY(d)=(m)
Line 209  NV(d)=(n); LEN(d)=(len); BDY(d)=(m)
 #define MKNDV(n,m,l,d) NEWNDV(d); NV(d)=(n); BDY(d)=(m); LEN(d) = l;  #define MKNDV(n,m,l,d) NEWNDV(d); NV(d)=(n); BDY(d)=(m); LEN(d) = l;
 #define NEWNM_ind_pair(p)\  #define NEWNM_ind_pair(p)\
 ((p)=(NM_ind_pair)MALLOC(sizeof(struct oNM_ind_pair)))  ((p)=(NM_ind_pair)MALLOC(sizeof(struct oNM_ind_pair)))
   #define NEWSIG(r) \
   ((r)=(SIG)MALLOC(sizeof(struct oSIG)),NEWDL((r)->dl,nd_nvar))
   
 /* allocate and link a new object */  /* allocate and link a new object */
 #define NEXTRHist(r,c) \  #define NEXTRHist(r,c) \
Line 211  if(!(r)){NEWNM(r);(c)=(r);}else{NEWNM(NEXT(c));(c)=NEX
Line 221  if(!(r)){NEWNM(r);(c)=(r);}else{NEWNM(NEXT(c));(c)=NEX
 if(!(r)){(c)=(r)=(s);}else{NEXT(c)=(s);(c)=(s);}  if(!(r)){(c)=(r)=(s);}else{NEXT(c)=(s);(c)=(s);}
 #define NEXTND_pairs(r,c) \  #define NEXTND_pairs(r,c) \
 if(!(r)){NEWND_pairs(r);(c)=(r);}else{NEWND_pairs(NEXT(c));(c)=NEXT(c);}  if(!(r)){NEWND_pairs(r);(c)=(r);}else{NEWND_pairs(NEXT(c));(c)=NEXT(c);}
 #define MKNM_ind_pair(p,m,i,s) (NEWNM_ind_pair(p),(p)->mul=(m),(p)->index=(i),(p)->sugar = (s))  #define MKNM_ind_pair(p,m,i,s,sg)\
    (NEWNM_ind_pair(p),(p)->mul=(m),(p)->index=(i),(p)->sugar = (s),(p)->sig=(sg))
   
 /* deallocators */  /* deallocators */
 #define FREENM(m) NEXT(m)=_nm_free_list; _nm_free_list=(m)  #define FREENM(m) NEXT(m)=_nm_free_list; _nm_free_list=(m)
Line 260  ND_pairs crit_B( ND_pairs d, int s );
Line 271  ND_pairs crit_B( ND_pairs d, int s );
 ND_pairs crit_M( ND_pairs d1 );  ND_pairs crit_M( ND_pairs d1 );
 ND_pairs crit_F( ND_pairs d1 );  ND_pairs crit_F( ND_pairs d1 );
 int crit_2( int dp1, int dp2 );  int crit_2( int dp1, int dp2 );
 int ndv_newps(int m,NDV a,NDV aq,int f4);  int ndv_newps(int m,NDV a,NDV aq);
   
 /* top level functions */  /* top level functions */
 void nd_gr(LIST f,LIST v,int m,int homo,int retdp,int f4,struct order_spec *ord,LIST *rp);  void nd_gr(LIST f,LIST v,int m,int homo,int retdp,int f4,struct order_spec *ord,LIST *rp);
 void nd_gr_trace(LIST f,LIST v,int trace,int homo,int f4,struct order_spec *ord,LIST *rp);  void nd_gr_trace(LIST f,LIST v,int trace,int homo,int retdp,int f4,struct order_spec *ord,LIST *rp);
 NODE nd_f4(int m,int checkonly,int **indp);  NODE nd_f4(int m,int checkonly,int **indp);
 NODE nd_gb(int m,int ishomo,int checkonly,int gensyz,int **indp);  NODE nd_gb(int m,int ishomo,int checkonly,int gensyz,int **indp);
 NODE nd_gb_trace(int m,int ishomo,int **indp);  NODE nd_gb_trace(int m,int ishomo,int **indp);
 NODE nd_f4_trace(int m,int **indp);  NODE nd_f4_trace(int m,int **indp);
   void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int f4,struct order_spec *ord,LIST *rp);
   
 /* ndl functions */  /* ndl functions */
 int ndl_weight(UINT *d);  int ndl_weight(UINT *d);
Line 293  INLINE int ndl_hash_value(UINT *d);
Line 305  INLINE int ndl_hash_value(UINT *d);
 INLINE int ndl_find_reducer(UINT *g);  INLINE int ndl_find_reducer(UINT *g);
 int nd_sp(int mod,int trace,ND_pairs p,ND *nf);  int nd_sp(int mod,int trace,ND_pairs p,ND *nf);
 int nd_sp_f4(int m,int trace,ND_pairs l,PGeoBucket bucket);  int nd_sp_f4(int m,int trace,ND_pairs l,PGeoBucket bucket);
 int nd_nf(int mod,ND d,ND g,NDV *ps,int full,NDC dn,ND *nf);  int nd_nf(int mod,ND d,ND g,NDV *ps,int full,ND *nf);
 int nd_nf_pbucket(int mod,ND g,NDV *ps,int full,ND *nf);  int nd_nf_pbucket(int mod,ND g,NDV *ps,int full,ND *nf);
   
 /* finalizers */  /* finalizers */
Line 317  void ndp_print(ND_pairs d);
Line 329  void ndp_print(ND_pairs d);
 /* setup, reconstruct */  /* setup, reconstruct */
 void nd_init_ord(struct order_spec *spec);  void nd_init_ord(struct order_spec *spec);
 ND_pairs nd_reconstruct(int trace,ND_pairs ndp);  ND_pairs nd_reconstruct(int trace,ND_pairs ndp);
 int ndv_setup(int mod,int trace,NODE f,int dont_sort,int dont_removecont);  void nd_reconstruct_s(int trace,ND_pairs *ndp);
   int ndv_setup(int mod,int trace,NODE f,int dont_sort,int dont_removecont,int sba);
 void nd_setup_parameters(int nvar,int max);  void nd_setup_parameters(int nvar,int max);
 BlockMask nd_create_blockmask(struct order_spec *ord);  BlockMask nd_create_blockmask(struct order_spec *ord);
 EPOS nd_create_epos(struct order_spec *ord);  EPOS nd_create_epos(struct order_spec *ord);
Line 386  P ndvtop(int mod,VL vl,VL dvl,NDV p);
Line 399  P ndvtop(int mod,VL vl,VL dvl,NDV p);
 NDV ndtondv(int mod,ND p);  NDV ndtondv(int mod,ND p);
 ND ndvtond(int mod,NDV p);  ND ndvtond(int mod,NDV p);
 Z *nm_ind_pair_to_vect(int m,UINT *s0,int n,NM_ind_pair pair);  Z *nm_ind_pair_to_vect(int m,UINT *s0,int n,NM_ind_pair pair);
 IndArray nm_ind_pair_to_vect_compress(int m,UINT *s0,int n,int *s0hash,NM_ind_pair pair);  IndArray nm_ind_pair_to_vect_compress(int m,UINT *s0,int n,NM_ind_pair pair,int prevh);
 int nd_to_vect(int mod,UINT *s0,int n,ND d,UINT *r);  int nd_to_vect(int mod,UINT *s0,int n,ND d,UINT *r);
 int nd_to_vect_q(UINT *s0,int n,ND d,Z *r);  int nd_to_vect_q(UINT *s0,int n,ND d,Z *r);
 NDV vect_to_ndv_q(Z *vect,int spcol,int col,int *rhead,UINT *s0vect);  NDV vect_to_ndv_q(Z *vect,int spcol,int col,int *rhead,UINT *s0vect);
Line 398  int nd_gauss_elim_q(Z **mat0,int *sugar,int row,int co
Line 411  int nd_gauss_elim_q(Z **mat0,int *sugar,int row,int co
   
 int ndl_ww_lex_compare(UINT *a1,UINT *a2);  int ndl_ww_lex_compare(UINT *a1,UINT *a2);
   
 #if defined(__GNUC__) && SIZEOF_LONG == 8  #if SIZEOF_LONG == 8
 int nd_to_vect64(int mod,UINT *s0,int n,ND d,U64 *r);  int nd_to_vect64(int mod,UINT *s0,int n,ND d,mp_limb_t *r);
 int ndv_reduce_vect64(int m,U64 *svect,U64 *cvect,int col,IndArray *imat,NM_ind_pair *rp0,int nred);  int ndv_reduce_vect64(int m,mp_limb_t *svect,mp_limb_t *cvect,int col,IndArray *imat,NM_ind_pair *rp0,int nred,SIG sig);
 NDV vect64_to_ndv(U64 *vect,int spcol,int col,int *rhead,UINT *s0vect);  NDV vect64_to_ndv(mp_limb_t *vect,int spcol,int col,int *rhead,UINT *s0vect);
 void red_by_vect64(int m, U64 *p,unsigned int *c,U64 *r,unsigned int hc,int len);  void red_by_vect64(int m, mp_limb_t *p,unsigned int *c,mp_limb_t *r,unsigned int hc,int len);
 int nd_gauss_elim_mod64(U64 **mat,int *sugar,ND_pairs *spactive,int row,int col,int md,int *colstat);  int nd_gauss_elim_mod64(mp_limb_t **mat,int *sugar,ND_pairs *spactive,int row,int col,int md,int *colstat);
 #endif  #endif
   
   

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

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