| version 1.36, 2017/02/21 09:20:23 |
version 1.40, 2020/11/02 08:30:55 |
|
|
| /* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.h,v 1.35 2017/01/08 03:05:40 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.h,v 1.39 2020/10/04 03:14:08 noro Exp $ */ |
| #include "ca.h" |
#include "ca.h" |
| #include "parse.h" |
#include "parse.h" |
| #include "ox.h" |
#include "ox.h" |
| Line 24 typedef unsigned int UINT; |
|
| Line 24 typedef unsigned int UINT; |
|
| /* GeoBucket for polynomial addition */ |
/* GeoBucket for polynomial addition */ |
| |
|
| typedef struct oPGeoBucket { |
typedef struct oPGeoBucket { |
| int m; |
int m; |
| struct oND *body[32]; |
struct oND *body[32]; |
| } *PGeoBucket; |
} *PGeoBucket; |
| |
|
| /* 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; |
| } *ND; |
} *ND; |
| |
|
| /* distributed polynomial; array rep. */ |
/* distributed polynomial; array rep. */ |
| typedef struct oNDV { |
typedef struct oNDV { |
| struct oNMV *body; |
struct oNMV *body; |
| int nv; |
int nv; |
| int len; |
int len; |
| int sugar; |
int sugar; |
| } *NDV; |
} *NDV; |
| |
|
| typedef union oNDC { |
typedef union oNDC { |
| int m; |
int m; |
| Q z; |
Q z; |
| LM lm; |
LM lm; |
| GZ gz; |
GZ gz; |
| P p; |
P p; |
| R r; |
R r; |
| DAlg a; |
DAlg a; |
| } *NDC; |
} *NDC; |
| |
|
| /* monomial; linked list rep. */ |
/* monomial; linked list rep. */ |
| typedef struct oNM { |
typedef struct oNM { |
| struct oNM *next; |
struct oNM *next; |
| union oNDC c; |
union oNDC c; |
| UINT dl[1]; |
UINT dl[1]; |
| } *NM; |
} *NM; |
| |
|
| /* monomial; array rep. */ |
/* monomial; array rep. */ |
| typedef struct oNMV { |
typedef struct oNMV { |
| union oNDC c; |
union oNDC c; |
| UINT dl[1]; |
UINT dl[1]; |
| } *NMV; |
} *NMV; |
| |
|
| /* history of reducer */ |
/* history of reducer */ |
| typedef struct oRHist { |
typedef struct oRHist { |
| struct oRHist *next; |
struct oRHist *next; |
| int index; |
int index; |
| int sugar; |
int sugar; |
| UINT dl[1]; |
UINT dl[1]; |
| } *RHist; |
} *RHist; |
| |
|
| /* S-pair list */ |
/* S-pair list */ |
| typedef struct oND_pairs { |
typedef struct oND_pairs { |
| struct oND_pairs *next; |
struct oND_pairs *next; |
| int i1,i2; |
int i1,i2; |
| int sugar; |
int sugar; |
| int sugar2; |
int sugar2; |
| UINT lcm[1]; |
UINT lcm[1]; |
| } *ND_pairs; |
} *ND_pairs; |
| |
|
| /* index and shift count for each exponent */ |
/* index and shift count for each exponent */ |
| typedef struct oEPOS { |
typedef struct oEPOS { |
| int i; /* index */ |
int i; /* index */ |
| int s; /* shift */ |
int s; /* shift */ |
| } *EPOS; |
} *EPOS; |
| |
|
| typedef struct oBlockMask { |
typedef struct oBlockMask { |
| int n; |
int n; |
| struct order_pair *order_pair; |
struct order_pair *order_pair; |
| UINT **mask; |
UINT **mask; |
| } *BlockMask; |
} *BlockMask; |
| |
|
| typedef struct oBaseSet { |
typedef struct oBaseSet { |
| int len; |
int len; |
| NDV *ps; |
NDV *ps; |
| UINT **bound; |
UINT **bound; |
| } *BaseSet; |
} *BaseSet; |
| |
|
| typedef struct oNM_ind_pair |
typedef struct oNM_ind_pair |
| { |
{ |
| NM mul; |
NM mul; |
| int index,sugar; |
int index,sugar; |
| } *NM_ind_pair; |
} *NM_ind_pair; |
| |
|
| typedef struct oIndArray |
typedef struct oIndArray |
| { |
{ |
| char width; |
char width; |
| int head; |
int head; |
| union { |
union { |
| unsigned char *c; |
unsigned char *c; |
| unsigned short *s; |
unsigned short *s; |
| unsigned int *i; |
unsigned int *i; |
| } index; |
} index; |
| } *IndArray; |
} *IndArray; |
| |
|
| typedef struct oNDVI { |
typedef struct oNDVI { |
| NDV p; |
NDV p; |
| int i; |
int i; |
| } *NDVI; |
} *NDVI; |
| |
|
| extern int (*ndl_compare_function)(UINT *a1,UINT *a2); |
extern int (*ndl_compare_function)(UINT *a1,UINT *a2); |
| Line 178 extern int *current_module_weight_vector; |
|
| Line 178 extern int *current_module_weight_vector; |
|
| (nd_dcomp>0?TD_DL_COMPARE(d1,d2)\ |
(nd_dcomp>0?TD_DL_COMPARE(d1,d2)\ |
| :(nd_dcomp==0?ndl_lex_compare(d1,d2)\ |
:(nd_dcomp==0?ndl_lex_compare(d1,d2)\ |
| :(nd_blockmask?ndl_block_compare(d1,d2)\ |
:(nd_blockmask?ndl_block_compare(d1,d2)\ |
| :(*ndl_compare_function)(d1,d2)))) |
:(*ndl_compare_function)(d1,d2)))) |
| #else |
#else |
| #define DL_COMPARE(d1,d2)\ |
#define DL_COMPARE(d1,d2)\ |
| (nd_dcomp>0?TD_DL_COMPARE(d1,d2):(*ndl_compare_function)(d1,d2)) |
(nd_dcomp>0?TD_DL_COMPARE(d1,d2):(*ndl_compare_function)(d1,d2)) |
| Line 241 void removecont_array_q(Q *c,int n); |
|
| Line 241 void removecont_array_q(Q *c,int n); |
|
| ND normalize_pbucket(int mod,PGeoBucket g); |
ND normalize_pbucket(int mod,PGeoBucket g); |
| int head_pbucket(int mod,PGeoBucket g); |
int head_pbucket(int mod,PGeoBucket g); |
| int head_pbucket_q(PGeoBucket g); |
int head_pbucket_q(PGeoBucket g); |
| |
int head_pbucket_lf(PGeoBucket g); |
| void add_pbucket_symbolic(PGeoBucket g,ND d); |
void add_pbucket_symbolic(PGeoBucket g,ND d); |
| void add_pbucket(int mod,PGeoBucket g,ND d); |
void add_pbucket(int mod,PGeoBucket g,ND d); |
| void free_pbucket(PGeoBucket b); |
void free_pbucket(PGeoBucket b); |
| Line 292 INLINE int ndl_hash_value(UINT *d); |
|
| Line 293 INLINE int ndl_hash_value(UINT *d); |
|
| /* normal forms */ |
/* normal forms */ |
| 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_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,NDC dn,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); |
| |
|
| Line 325 void ndv_mod(int mod,NDV p); |
|
| Line 327 void ndv_mod(int mod,NDV p); |
|
| NDV ndv_dup(int mod,NDV p); |
NDV ndv_dup(int mod,NDV p); |
| NDV ndv_symbolic(int mod,NDV p); |
NDV ndv_symbolic(int mod,NDV p); |
| ND nd_dup(ND p); |
ND nd_dup(ND p); |
| |
int ndv_ishomo(NDV p); |
| |
|
| /* ND functions */ |
/* ND functions */ |
| int ndv_check_membership(int m,NODE input,int obpe,int oadv,EPOS oepos,NODE cand); |
int ndv_check_membership(int m,NODE input,int obpe,int oadv,EPOS oepos,NODE cand); |
| Line 347 INLINE int nd_length(ND p); |
|
| Line 350 INLINE int nd_length(ND p); |
|
| NODE nd_f4_red(int m,ND_pairs sp0,int trace,UINT *s0vect,int col,NODE rp0,ND_pairs *nz); |
NODE nd_f4_red(int m,ND_pairs sp0,int trace,UINT *s0vect,int col,NODE rp0,ND_pairs *nz); |
| NODE nd_f4_red_dist(int m,ND_pairs sp0,UINT *s0vect,int col,NODE rp0, ND_pairs *nz); |
NODE nd_f4_red_dist(int m,ND_pairs sp0,UINT *s0vect,int col,NODE rp0, ND_pairs *nz); |
| NODE nd_f4_red_main(int m,ND_pairs sp0,int nsp,UINT *s0vect,int col, |
NODE nd_f4_red_main(int m,ND_pairs sp0,int nsp,UINT *s0vect,int col, |
| NM_ind_pair *rvect,int *rhead,IndArray *imat,int nred,ND_pairs *nz); |
NM_ind_pair *rvect,int *rhead,IndArray *imat,int nred,ND_pairs *nz); |
| |
NODE nd_f4_red_mod_main(int m,ND_pairs sp0,int nsp,UINT *s0vect,int col, |
| |
NM_ind_pair *rvect,int *rhead,IndArray *imat,int nred,ND_pairs *nz); |
| |
NODE nd_f4_red_sf_main(int m,ND_pairs sp0,int nsp,UINT *s0vect,int col, |
| |
NM_ind_pair *rvect,int *rhead,IndArray *imat,int nred,ND_pairs *nz); |
| NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,UINT *s0vect,int col, |
NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,UINT *s0vect,int col, |
| NM_ind_pair *rvect,int *rhead,IndArray *imat,int nred); |
NM_ind_pair *rvect,int *rhead,IndArray *imat,int nred); |
| NODE nd_f4_red_gz_main(ND_pairs sp0,int nsp,int trace,UINT *s0vect,int col, |
NODE nd_f4_red_gz_main(ND_pairs sp0,int nsp,int trace,UINT *s0vect,int col, |
| NM_ind_pair *rvect,int *rhead,IndArray *imat,int nred); |
NM_ind_pair *rvect,int *rhead,IndArray *imat,int nred); |
| |
|
| /* NDV functions */ |
/* NDV functions */ |
| ND weyl_ndv_mul_nm(int mod,NM m0,NDV p); |
ND weyl_ndv_mul_nm(int mod,NM m0,NDV p); |
| Line 391 int nd_gauss_elim_q(Q **mat0,int *sugar,int row,int co |
|
| Line 398 int nd_gauss_elim_q(Q **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); |
| |
|
| |
void red_by_vect_lf(mpz_t *p,mpz_t *r,mpz_t hc,int len); |
| |
int nd_symbolic_preproc(PGeoBucket bucket,int trace,UINT **s0vect,NODE *r); |
| |
|
| |
#if SIZEOF_LONG==8 |
| |
void red_by_vect64(int m, U64 *p,unsigned int *c,U64 *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); |
| |
#endif |
| |
|