source: git/kernel/tgb_internal.h @ b75d13

jengelh-datetimespielwiese
Last change on this file since b75d13 was b75d13, checked in by Michael Brickenstein <bricken@…>, 18 years ago
*bricken: externalized F4 git-svn-id: file:///usr/local/Singular/svn/trunk@8170 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 6.0 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.10 2005-05-12 09:19:43 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  //! array_lengths should be greater equal n;
116  int array_lengths; 
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);
156void 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);
159//static 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);
165void 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);
173void 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 tgb_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);
183sorted_pair_node* quick_pop_pair(calc_dat* c);
184sorted_pair_node* top_pair(calc_dat* c);
185sorted_pair_node** add_to_basis_ideal_quotient(poly h, int i_pos, int j_pos,calc_dat* c, int* ip);
186sorted_pair_node**  spn_merge(sorted_pair_node** p, int pn,sorted_pair_node **q, int qn,calc_dat* c);
187int kFindDivisibleByInS_easy(kStrategy strat,const red_object & obj);
188int tgb_pair_better_gen2(const void* ap,const void* bp);
189int kFindDivisibleByInS_easy(kStrategy strat,poly p, long sev);
190//static int quality(poly p, int len, calc_dat* c);
191/**
192   makes on each red_object in a region a single_step
193 **/
194class reduction_step{
195 public:
196  /// we assume hat all occuring red_objects have same lm, and all
197  /// occ. lm's in r[l...u] are the same, only reductor does not occur
198  virtual void reduce(red_object* r, int l, int u);
199  //int reduction_id;
200  virtual ~reduction_step();
201  calc_dat* c;
202  int reduction_id;
203};
204class simple_reducer:public reduction_step{
205 public:
206  poly p;
207  kBucket_pt fill_back;
208  int p_len;
209  simple_reducer(poly p, int p_len, calc_dat* c =NULL){
210    this->p=p;
211    assume(p_len==pLength(p));
212    this->p_len=p_len;
213    this->c=c;
214  }
215  virtual void pre_reduce(red_object* r, int l, int u);
216  virtual void reduce(red_object* r, int l, int u);
217  ~simple_reducer();
218
219
220  virtual void target_is_no_sum_reduce(red_object & ro);
221};
222
223//class sum_canceling_reducer:public reduction_step {
224//  void reduce(red_object* r, int l, int u);
225//};
226struct find_erg{
227  poly expand;
228  int expand_length;
229  int to_reduce_u;
230  int to_reduce_l;
231  int reduce_by;//index of reductor
232  BOOLEAN fromS;//else from los
233
234};
235
236static void multi_reduce_step(find_erg & erg, red_object* r, calc_dat* c);
237static void finalize_reduction_step(reduction_step* r);
238
239
240
241
242
243
244#endif
Note: See TracBrowser for help on using the repository browser.