source: git/kernel/tgb_internal.h @ 6d7605

spielwiese
Last change on this file since 6d7605 was 6d7605, checked in by Michael Brickenstein <bricken@…>, 19 years ago
*bricken: better reallocation strategy git-svn-id: file:///usr/local/Singular/svn/trunk@8168 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 5.7 KB
RevLine 
[f4adfcb]1#ifndef TGB_INTERNAL_H
2#define TGB_INTERNAL_H
[b553e5]3//!\file tgb_internal.h
[6b9532]4/****************************************
5*  Computer Algebra System SINGULAR     *
6****************************************/
[6d7605]7/* $Id: tgb_internal.h,v 1.8 2005-05-12 08:12:30 bricken Exp $ */
[6b9532]8/*
9 * ABSTRACT: tgb internal .h file
10*/
[f4adfcb]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
[b055de9]42
[f4adfcb]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};
[bddc9d]63
[f4adfcb]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};
[b055de9]78
79
[f4adfcb]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;
[6d7605]115  //! array_lengths should be greater equal n;
116  int array_lengths; 
[f4adfcb]117  int normal_forms;
118  int current_degree;
119  int Rcounter;
120  int last_index;
121  int max_pairs;
122  int pair_top;
123  int easy_product_crit;
124  int extended_product_crit;
125  int average_length;
126  BOOLEAN is_char0;
127  BOOLEAN is_homog;
128  BOOLEAN F4_mode;
129};
130class red_object{
131 public:
132  kBucket_pt bucket;
133  poly p;
134  unsigned long sev;
135  void flatten();
136  void validate();
137  void adjust_coefs(number c_r, number c_ac_r);
138  int guess_quality(calc_dat* c);
139  int clear_to_poly();
140  void canonicalize();
141};
142
143
144enum calc_state
145  {
146    UNCALCULATED,
147    HASTREP,
148    UNIMPORTANT,
149    SOONTREP
150  };
151
152static int add_to_reductors(calc_dat* c, poly h, int len);
153static int bucket_guess(kBucket* bucket);
154static poly redNFTail (poly h,const int sl,kStrategy strat, int len);
155static poly redNF2 (poly h,calc_dat* c , int &len, number&  m,int n=0);
156static void free_sorted_pair_node(sorted_pair_node* s, ring r);
157static void shorten_tails(calc_dat* c, poly monom);
158static void replace_pair(int & i, int & j, calc_dat* c);
159static sorted_pair_node** add_to_basis(poly h, int i, int j,calc_dat* c, int* ip=NULL);
160static void do_this_spoly_stuff(int i,int j,calc_dat* c);
161//ideal t_rep_gb(ring r,ideal arg_I);
162static BOOLEAN has_t_rep(const int & arg_i, const int & arg_j, calc_dat* state);
163static int* make_connections(int from, poly bound, calc_dat* c);
164static int* make_connections(int from, int to, poly bound, calc_dat* c);
165static void now_t_rep(const int & arg_i, const int & arg_j, calc_dat* c);
166static void soon_t_rep(const int & arg_i, const int & arg_j, calc_dat* c);
167static int pLcmDeg(poly a, poly b);
168static int simple_posInS (kStrategy strat, poly p,int len);
169static BOOLEAN find_next_pair(calc_dat* c, BOOLEAN go_higher=TRUE);
170
171static sorted_pair_node* pop_pair(calc_dat* c);
172static BOOLEAN no_pairs(calc_dat* c);
173static void clean_top_of_pair_list(calc_dat* c);
174static void super_clean_top_of_pair_list(calc_dat* c);
175static BOOLEAN state_is(calc_state state, const int & i, const int & j, calc_dat* c);
176static BOOLEAN pair_better(sorted_pair_node* a,sorted_pair_node* b, calc_dat* c);
177static int pair_better_gen(const void* ap,const void* bp);
178static poly redTailShort(poly h, kStrategy strat);
179static poly gcd_of_terms(poly p, ring r);
180static BOOLEAN extended_product_criterion(poly p1, poly gcd1, poly p2, poly gcd2, calc_dat* c);
181static poly kBucketGcd(kBucket* b, ring r);
182static void multi_reduction(red_object* los, int & losl, calc_dat* c);
183static sorted_pair_node* quick_pop_pair(calc_dat* c);
184static sorted_pair_node* top_pair(calc_dat* c);
185//static int quality(poly p, int len, calc_dat* c);
186/**
187   makes on each red_object in a region a single_step
188 **/
189class reduction_step{
190 public:
191  /// we assume hat all occuring red_objects have same lm, and all
192  /// occ. lm's in r[l...u] are the same, only reductor does not occur
193  virtual void reduce(red_object* r, int l, int u);
194  //int reduction_id;
195  virtual ~reduction_step();
196  calc_dat* c;
197  int reduction_id;
198};
199class simple_reducer:public reduction_step{
200 public:
201  poly p;
202  kBucket_pt fill_back;
203  int p_len;
204  simple_reducer(poly p, int p_len, calc_dat* c =NULL){
205    this->p=p;
206    assume(p_len==pLength(p));
207    this->p_len=p_len;
208    this->c=c;
209  }
210  virtual void pre_reduce(red_object* r, int l, int u);
211  virtual void reduce(red_object* r, int l, int u);
212  ~simple_reducer();
213
[bddc9d]214
[f4adfcb]215  virtual void target_is_no_sum_reduce(red_object & ro);
216};
[36b1aa]217
[f4adfcb]218//class sum_canceling_reducer:public reduction_step {
219//  void reduce(red_object* r, int l, int u);
220//};
221struct find_erg{
222  poly expand;
223  int expand_length;
224  int to_reduce_u;
225  int to_reduce_l;
226  int reduce_by;//index of reductor
227  BOOLEAN fromS;//else from los
228
229};
230
231static void multi_reduce_step(find_erg & erg, red_object* r, calc_dat* c);
232static void finalize_reduction_step(reduction_step* r);
[b055de9]233
234
235
236
237
238
[f4adfcb]239#endif
Note: See TracBrowser for help on using the repository browser.