1 | #ifndef TGB_H |
---|
2 | #define TGB_H |
---|
3 | |
---|
4 | #include "mod2.h" |
---|
5 | #include <omalloc.h> |
---|
6 | #include "p_polys.h" |
---|
7 | |
---|
8 | #include "ideals.h" |
---|
9 | #include "ring.h" |
---|
10 | #include "febase.h" |
---|
11 | #include "structs.h" |
---|
12 | #include "polys.h" |
---|
13 | #include "stdlib.h" |
---|
14 | |
---|
15 | |
---|
16 | #include "kutil.h" |
---|
17 | #include "kInline.cc" |
---|
18 | #include "kstd1.h" |
---|
19 | #include "kbuckets.h" |
---|
20 | |
---|
21 | #define FULLREDUCTIONS |
---|
22 | //#define HALFREDUCTIONS |
---|
23 | //#define HEAD_BIN |
---|
24 | //#define HOMOGENEOUS_EXAMPLE |
---|
25 | #define REDTAIL_S |
---|
26 | |
---|
27 | //#define REDTAIL_PROT |
---|
28 | //#define QUICK_SPOLY_TEST |
---|
29 | |
---|
30 | |
---|
31 | struct int_pair_node{ |
---|
32 | int_pair_node* next; |
---|
33 | int a; |
---|
34 | int b; |
---|
35 | }; |
---|
36 | struct red_object{ |
---|
37 | kBucket_pt bucket; |
---|
38 | poly p; |
---|
39 | unsigned long sev; |
---|
40 | }; |
---|
41 | struct sorted_pair_node{ |
---|
42 | //criterium, which is stable 0. small lcm 1. small i 2. small j |
---|
43 | int i; |
---|
44 | int j; |
---|
45 | int deg; |
---|
46 | int expected_length; |
---|
47 | poly lcm_of_lm; |
---|
48 | }; |
---|
49 | |
---|
50 | |
---|
51 | enum calc_state |
---|
52 | { |
---|
53 | UNCALCULATED, |
---|
54 | HASTREP, |
---|
55 | UNIMPORTANT, |
---|
56 | SOONTREP |
---|
57 | }; |
---|
58 | struct calc_dat |
---|
59 | { |
---|
60 | int* rep; |
---|
61 | char** states; |
---|
62 | ideal S; |
---|
63 | ring r; |
---|
64 | int* lengths; |
---|
65 | long* short_Exps; |
---|
66 | kStrategy strat; |
---|
67 | int* T_deg; |
---|
68 | poly* gcd_of_terms; |
---|
69 | int_pair_node* soon_free; |
---|
70 | sorted_pair_node** apairs; |
---|
71 | #ifdef HEAD_BIN |
---|
72 | struct omBin_s* HeadBin; |
---|
73 | #endif |
---|
74 | unsigned int reduction_steps; |
---|
75 | int n; |
---|
76 | int normal_forms; |
---|
77 | int current_degree; |
---|
78 | int Rcounter; |
---|
79 | int last_index; |
---|
80 | int max_pairs; |
---|
81 | int pair_top; |
---|
82 | int easy_product_crit; |
---|
83 | int extended_product_crit; |
---|
84 | BOOLEAN is_char0; |
---|
85 | }; |
---|
86 | static int add_to_reductors(calc_dat* c, poly h, int len); |
---|
87 | static int bucket_guess(kBucket* bucket); |
---|
88 | static poly redNFTail (poly h,const int sl,kStrategy strat, int len); |
---|
89 | static poly redNF2 (poly h,calc_dat* c , int &len); |
---|
90 | static void free_sorted_pair_node(sorted_pair_node* s, ring r); |
---|
91 | static void shorten_tails(calc_dat* c, poly monom); |
---|
92 | static void replace_pair(int & i, int & j, calc_dat* c); |
---|
93 | static sorted_pair_node** add_to_basis(poly h, int i, int j,calc_dat* c, int* ip=NULL); |
---|
94 | static void do_this_spoly_stuff(int i,int j,calc_dat* c); |
---|
95 | ideal t_rep_gb(ring r,ideal arg_I); |
---|
96 | static BOOLEAN has_t_rep(const int & arg_i, const int & arg_j, calc_dat* state); |
---|
97 | static int* make_connections(int from, poly bound, calc_dat* c); |
---|
98 | static int* make_connections(int from, int to, poly bound, calc_dat* c); |
---|
99 | static void now_t_rep(const int & arg_i, const int & arg_j, calc_dat* c); |
---|
100 | static void soon_t_rep(const int & arg_i, const int & arg_j, calc_dat* c); |
---|
101 | static int pLcmDeg(poly a, poly b); |
---|
102 | static int simple_posInS (kStrategy strat, poly p,int len, BOOLEAN is_char0); |
---|
103 | static BOOLEAN find_next_pair(calc_dat* c, BOOLEAN go_higher=TRUE); |
---|
104 | |
---|
105 | static sorted_pair_node* pop_pair(calc_dat* c); |
---|
106 | static BOOLEAN no_pairs(calc_dat* c); |
---|
107 | static void clean_top_of_pair_list(calc_dat* c); |
---|
108 | static void super_clean_top_of_pair_list(calc_dat* c); |
---|
109 | static BOOLEAN state_is(calc_state state, const int & i, const int & j, calc_dat* c); |
---|
110 | static BOOLEAN pair_better(sorted_pair_node* a,sorted_pair_node* b, calc_dat* c); |
---|
111 | static int pair_better_gen(const void* ap,const void* bp); |
---|
112 | static poly redTailShort(poly h, kStrategy strat); |
---|
113 | static poly gcd_of_terms(poly p, ring r); |
---|
114 | static BOOLEAN extended_product_criterion(poly p1, poly gcd1, poly p2, poly gcd2, calc_dat* c); |
---|
115 | static poly kBucketGcd(kBucket* b, ring r); |
---|
116 | static void multi_reduction(red_object* los, int & losl, calc_dat* c); |
---|
117 | static sorted_pair_node* quick_pop_pair(calc_dat* c); |
---|
118 | static sorted_pair_node* top_pair(calc_dat* c); |
---|
119 | #endif |
---|