source: git/kernel/tgb_internal.h @ 85eb7d

spielwiese
Last change on this file since 85eb7d was bddc9d, checked in by Michael Brickenstein <bricken@…>, 19 years ago
*bricken: -shared bucket git-svn-id: file:///usr/local/Singular/svn/trunk@8157 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 5.6 KB
Line 
1#ifndef TGB_INTERNAL_H
2#define TGB_INTERNAL_H
3//!\file tgb_internal.h
4/****************************************
5*  Computer Algebra System SINGULAR     *
6****************************************/
7/* $Id: tgb_internal.h,v 1.7 2005-05-11 14:58:35 bricken Exp $ */
8/*
9 * ABSTRACT: tgb internal .h file
10*/
11#include "mod2.h"
12#include <omalloc.h>
13#include "p_polys.h"
14
15#include "ideals.h"
16#include "ring.h"
17#include "febase.h"
18#include "structs.h"
19#include "polys.h"
20#include "stdlib.h"
21
22
23#include "kutil.h"
24#include "kInline.cc"
25#include "kstd1.h"
26#include "kbuckets.h"
27
28
29
30
31//#define TGB_DEBUG
32#define FULLREDUCTIONS
33#define HANS_IDEA
34//#define HALFREDUCTIONS
35//#define HEAD_BIN
36//#define HOMOGENEOUS_EXAMPLE
37#define REDTAIL_S
38#define PAR_N 100
39#define PAR_N_F4 5000
40#define AC_NEW_MIN 2
41#define AC_FLATTEN 1
42
43//#define FIND_DETERMINISTIC
44//#define REDTAIL_PROT
45//#define QUICK_SPOLY_TEST
46struct sorted_pair_node{
47  //criterium, which is stable 0. small lcm 1. small i 2. small j
48  int i;
49  int j;
50  int deg;
51  int expected_length;
52  poly lcm_of_lm;
53};
54
55
56//static ideal debug_Ideal;
57
58
59struct poly_list_node{
60  poly p;
61  poly_list_node* next;
62};
63
64struct int_pair_node{
65  int_pair_node* next;
66  int a;
67  int b;
68};
69struct monom_poly{
70  poly m;
71  poly f;
72};
73struct mp_array_list{
74  monom_poly* mp;
75  int size;
76  mp_array_list* next;
77};
78
79
80struct poly_array_list{
81  poly* p;
82  int size;
83  poly_array_list* next;
84};
85struct calc_dat
86{
87  int* rep;
88  char** states;
89  ideal S;
90  ring r;
91  int* lengths;
92  long* short_Exps;
93  kStrategy strat;
94  int* T_deg;
95  int* T_deg_full;
96  poly tmp_lm;
97  poly* tmp_pair_lm;
98  sorted_pair_node** tmp_spn;
99  poly* expandS;
100  poly* gcd_of_terms;
101  int_pair_node* soon_free;
102  sorted_pair_node** apairs;
103  BOOLEAN* modifiedS;
104  poly_list_node* to_destroy;
105  //for F4
106  mp_array_list* F;
107  poly_array_list* F_minus;
108
109  //end for F4
110#ifdef HEAD_BIN
111  struct omBin_s*   HeadBin;
112#endif
113  unsigned int reduction_steps;
114  int n;
115  int normal_forms;
116  int current_degree;
117  int Rcounter;
118  int last_index;
119  int max_pairs;
120  int pair_top;
121  int easy_product_crit;
122  int extended_product_crit;
123  int average_length;
124  BOOLEAN is_char0;
125  BOOLEAN is_homog;
126  BOOLEAN F4_mode;
127};
128class red_object{
129 public:
130  kBucket_pt bucket;
131  poly p;
132  unsigned long sev;
133  void flatten();
134  void validate();
135  void adjust_coefs(number c_r, number c_ac_r);
136  int guess_quality(calc_dat* c);
137  int clear_to_poly();
138  void canonicalize();
139};
140
141
142enum calc_state
143  {
144    UNCALCULATED,
145    HASTREP,
146    UNIMPORTANT,
147    SOONTREP
148  };
149
150static int add_to_reductors(calc_dat* c, poly h, int len);
151static int bucket_guess(kBucket* bucket);
152static poly redNFTail (poly h,const int sl,kStrategy strat, int len);
153static poly redNF2 (poly h,calc_dat* c , int &len, number&  m,int n=0);
154static void free_sorted_pair_node(sorted_pair_node* s, ring r);
155static void shorten_tails(calc_dat* c, poly monom);
156static void replace_pair(int & i, int & j, calc_dat* c);
157static sorted_pair_node** add_to_basis(poly h, int i, int j,calc_dat* c, int* ip=NULL);
158static void do_this_spoly_stuff(int i,int j,calc_dat* c);
159//ideal t_rep_gb(ring r,ideal arg_I);
160static BOOLEAN has_t_rep(const int & arg_i, const int & arg_j, calc_dat* state);
161static int* make_connections(int from, poly bound, calc_dat* c);
162static int* make_connections(int from, int to, poly bound, calc_dat* c);
163static void now_t_rep(const int & arg_i, const int & arg_j, calc_dat* c);
164static void soon_t_rep(const int & arg_i, const int & arg_j, calc_dat* c);
165static int pLcmDeg(poly a, poly b);
166static int simple_posInS (kStrategy strat, poly p,int len);
167static BOOLEAN find_next_pair(calc_dat* c, BOOLEAN go_higher=TRUE);
168
169static sorted_pair_node* pop_pair(calc_dat* c);
170static BOOLEAN no_pairs(calc_dat* c);
171static void clean_top_of_pair_list(calc_dat* c);
172static void super_clean_top_of_pair_list(calc_dat* c);
173static BOOLEAN state_is(calc_state state, const int & i, const int & j, calc_dat* c);
174static BOOLEAN pair_better(sorted_pair_node* a,sorted_pair_node* b, calc_dat* c);
175static int pair_better_gen(const void* ap,const void* bp);
176static poly redTailShort(poly h, kStrategy strat);
177static poly gcd_of_terms(poly p, ring r);
178static BOOLEAN extended_product_criterion(poly p1, poly gcd1, poly p2, poly gcd2, calc_dat* c);
179static poly kBucketGcd(kBucket* b, ring r);
180static void multi_reduction(red_object* los, int & losl, calc_dat* c);
181static sorted_pair_node* quick_pop_pair(calc_dat* c);
182static sorted_pair_node* top_pair(calc_dat* c);
183//static int quality(poly p, int len, calc_dat* c);
184/**
185   makes on each red_object in a region a single_step
186 **/
187class reduction_step{
188 public:
189  /// we assume hat all occuring red_objects have same lm, and all
190  /// occ. lm's in r[l...u] are the same, only reductor does not occur
191  virtual void reduce(red_object* r, int l, int u);
192  //int reduction_id;
193  virtual ~reduction_step();
194  calc_dat* c;
195  int reduction_id;
196};
197class simple_reducer:public reduction_step{
198 public:
199  poly p;
200  kBucket_pt fill_back;
201  int p_len;
202  simple_reducer(poly p, int p_len, calc_dat* c =NULL){
203    this->p=p;
204    assume(p_len==pLength(p));
205    this->p_len=p_len;
206    this->c=c;
207  }
208  virtual void pre_reduce(red_object* r, int l, int u);
209  virtual void reduce(red_object* r, int l, int u);
210  ~simple_reducer();
211
212
213  virtual void target_is_no_sum_reduce(red_object & ro);
214};
215
216//class sum_canceling_reducer:public reduction_step {
217//  void reduce(red_object* r, int l, int u);
218//};
219struct find_erg{
220  poly expand;
221  int expand_length;
222  int to_reduce_u;
223  int to_reduce_l;
224  int reduce_by;//index of reductor
225  BOOLEAN fromS;//else from los
226
227};
228
229static void multi_reduce_step(find_erg & erg, red_object* r, calc_dat* c);
230static void finalize_reduction_step(reduction_step* r);
231
232
233
234
235
236
237#endif
Note: See TracBrowser for help on using the repository browser.