Changeset 5a229c in git


Ignore:
Timestamp:
Nov 5, 2002, 7:16:12 PM (21 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
030fcb083622316619951241eba12a84c7c3cd28
Parents:
21a8befd0c11806b3654c34f88c08f7a750354cb
Message:
+ bucketplay


git-svn-id: file:///usr/local/Singular/svn/trunk@6310 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/tgb.cc

    r21a8be r5a229c  
    22#include <omalloc.h>
    33#include "p_polys.h"
    4 #include "prCopy.h"
     4//#include "prCopy.h"
    55#include "ideals.h"
    66#include "ring.h"
     
    1717
    1818#define FULLREDUCTIONS
    19 #define HALFREDUCTIONS
     19//#define HALFREDUCTIONS
    2020#define HEAD_BIN
    2121//#define HOMOGENEOUS_EXAMPLE
    2222#define REDTAIL_S
     23#define PAR_N 5
    2324//#define REDTAIL_PROT
    2425//#define QUICK_SPOLY_TEST
     
    3031  int b;
    3132};
     33int bucket_guess(kBucket* bucket){
     34  int sum=0;
     35  int i;
     36  for (i=0;i<MAX_BUCKET+1;i++){
     37    sum+=bucket->buckets_length[i];
     38  }
     39  return sum;
     40}
     41struct redNF_inf{
     42  poly h;
     43  LObject* P;
     44  int_pair_node* pending;
     45  int len_upper_bound;
     46  int i;
     47  int j;
     48  BOOLEAN need_std_rep;
     49  BOOLEAN is_free;
     50  BOOLEAN started;
     51};
     52
    3253#ifdef RANDOM_WALK
    3354int my_rand(int n){
     
    4263    UNCALCULATED,
    4364    HASTREP,
    44     UNIMPORTANT
     65    UNIMPORTANT,
     66    SOONTREP
    4567  };
    4668struct calc_dat
     
    5779  int* misses;
    5880  int_pair_node* soon_free;
     81  redNF_inf* work_on;
    5982#ifdef HEAD_BIN
    6083  struct omBin_s*   HeadBin;
     
    7396  int misses_series;
    7497};
    75 bool find_next_pair(calc_dat* c);
     98BOOLEAN find_next_pair(calc_dat* c);
    7699void shorten_tails(calc_dat* c, poly monom);
    77100void replace_pair(int & i, int & j, calc_dat* c);
     
    80103void do_this_spoly_stuff(int i,int j,calc_dat* c);
    81104ideal t_rep_gb(ring r,ideal arg_I);
    82 bool has_t_rep(const int & arg_i, const int & arg_j, calc_dat* state);
     105BOOLEAN has_t_rep(const int & arg_i, const int & arg_j, calc_dat* state);
    83106int* make_connections(int from, poly bound, calc_dat* c);
    84107int* make_connections(int from, int to, poly bound, calc_dat* c);
    85 void now_t_rep(int arg_i, int arg_j, calc_dat* c);
     108void now_t_rep(const int & arg_i, const int & arg_j, calc_dat* c);
     109void soon_t_rep(const int & arg_i, const int & arg_j, calc_dat* c);
    86110int pLcmDeg(poly a, poly b);
    87111int simple_posInS (kStrategy strat, poly p,int len);
    88112
    89 bool find_next_pair(calc_dat* c)
     113BOOLEAN find_next_pair(calc_dat* c)
    90114{
    91115  int start_i,start_j,i,j;
     
    118142            c->continue_i=c->found_i=i;
    119143            c->continue_j=c->found_j=j;
    120             return true;
     144            return TRUE;
    121145          }
    122146        else
     
    152176              c->continue_i=c->found_i=i;
    153177              c->continue_j=c->found_j=j;
    154               return true;
     178              return TRUE;
    155179            }
    156180          else
     
    175199    return find_next_pair(c);
    176200  }
    177   return false;
     201  return FALSE;
    178202}
    179203void move_forward_in_S(int old_pos, int new_pos,kStrategy strat)
     
    255279      if (pFDeg(lm)>=deciding_deg)
    256280        {
     281          soon_t_rep(i_con[m],j_con[n],c);
    257282          int_pair_node* h= (int_pair_node*)omalloc(sizeof(int_pair_node));
    258283          if (last!=NULL)
     
    391416  int con_checked=0;
    392417  int pos;
    393   bool can_find_more=true;
     418  BOOLEAN can_find_more=TRUE;
    394419  while(((not_yet_found>0) && (con_checked<connected_length))||can_find_more){
    395420    if ((con_checked<connected_length)&& (not_yet_found>0)){
     
    473498}
    474499#endif
     500int init_red_phase1(calc_dat* c, int i, int j){
     501  int counter;
     502  for(counter=0;(counter<PAR_N)||(c->work_on[i].is_free);counter++){}
     503  assume(counter<PAR_N);
     504
     505  int pos=counter;
     506  c->work_on[pos].is_free=FALSE;
     507  c->work_on[pos].i=i;
     508  c->work_on[pos].j=j;
     509  return pos;
     510}
     511void init_red_spoly_phase2(calc_dat* c,int pos){
     512  poly h=ksOldCreateSpoly(c->S->m[c->work_on[pos].i], c->S->m[c->work_on[pos].j], NULL, c->r);
     513  if (h==NULL){
     514    c->work_on[pos].is_free=TRUE;
     515    return;
     516  }
     517  if (c->work_on[pos].P!=NULL)
     518    delete c->work_on[pos].P;
     519  c->work_on[pos].P=new LObject(h);
     520
     521 
     522  int len=pLength(h);
     523  c->work_on[pos].len_upper_bound=len;
     524  c->work_on[pos].P=new LObject(h);
     525  c->work_on[pos].P->SetShortExpVector();
     526  c->work_on[pos].P->bucket = kBucketCreate(currRing);
     527  kBucketInit(c->work_on[pos].P->bucket,c->work_on[pos].P->p,len /*pLength(P.p)*/);
     528 
     529};
    475530void initial_data(calc_dat* c){
    476531  void* h;
    477532  int i,j;
     533  c->work_on=(redNF_inf*) omalloc(PAR_N*sizeof(redNF_inf));
     534  int counter;
     535  for(counter=0;counter<PAR_N;counter++){
     536    c->work_on[counter].is_free=TRUE;
     537  }
    478538  c->misses_series=0;
    479539  c->soon_free=NULL;
     
    804864}
    805865#else
     866
    806867static poly redNF2 (poly h,calc_dat* c , int &len)
    807868{
     
    824885  loop
    825886    {
     887      int compare_bound;
     888      compare_bound=bucket_guess(P.bucket);
     889      len_upper_bound=min(compare_bound,len_upper_bound);
    826890      j=kFindDivisibleByInS(strat->S,strat->sevS,strat->sl,&P);
    827891      if (j>=0)
     
    829893          poly sec_copy=NULL;
    830894          //pseudo code
    831           bool must_replace_in_basis=(len_upper_bound<=strat->lenS[j]);//first test
     895          BOOLEAN must_replace_in_basis=(len_upper_bound<=strat->lenS[j]);//first test
    832896          if (must_replace_in_basis)
    833897            {
     
    841905              else
    842906                {
    843                   must_replace_in_basis=false;
     907                  must_replace_in_basis=FALSE;
    844908                }
    845909            }
     
    857921          number coef=kBucketPolyRed(P.bucket,strat->S[j],
    858922                                     strat->lenS[j]/*pLength(strat->S[j])*/,
    859   strat->kNoether);
    860  nDelete(&coef);
    861  h = kBucketGetLm(P.bucket);
    862  //pseudo code
    863  if (must_replace_in_basis){
    864    int old_pos_in_c=-1;
    865    poly p=strat->S[j];
    866    int z;
     923                                     strat->kNoether);
     924          nDelete(&coef);
     925          h = kBucketGetLm(P.bucket);
     926          //pseudo code
     927          if (must_replace_in_basis){
     928            int old_pos_in_c=-1;
     929            poly p=strat->S[j];
     930            int z;
    867931   
    868    int new_length=pLength(sec_copy);
    869    Print("%i",strat->lenS[j]-new_length);
    870    len_upper_bound=new_length +strat->lenS[j]-2;//old entries length
    871    int new_pos=simple_posInS(c->strat,strat->S[j],new_length);
     932            int new_length=pLength(sec_copy);
     933            Print("%i",strat->lenS[j]-new_length);
     934            len_upper_bound=new_length +strat->lenS[j]-2;//old entries length
     935            int new_pos=simple_posInS(c->strat,strat->S[j],new_length);//hack
    872936   strat->S[j]=sec_copy;
    873937   c->strat->lenS[j]=new_length;
     
    907971
    908972     int old_pos=j;
     973     new_pos=min(old_pos, new_pos);
    909974     assume(new_pos<=old_pos);
    910975 
     
    12091274  return(I);
    12101275}
    1211 void now_t_rep(int arg_i, int arg_j, calc_dat* c){
     1276void now_t_rep(const int & arg_i, const int & arg_j, calc_dat* c){
    12121277  int i,j;
    12131278  if (arg_i==arg_j){
     
    12231288  c->states[j][i]=HASTREP;
    12241289}
    1225 bool has_t_rep(const int & arg_i, const  int & arg_j, calc_dat* state){
     1290void soon_t_rep(const int& arg_i, const int& arg_j, calc_dat* c)
     1291{
     1292  int i,j;
     1293  if (arg_i==arg_j){
     1294    return;
     1295  }
     1296  if (arg_i>arg_j){
     1297    i=arg_j;
     1298    j=arg_i;
     1299  } else {
     1300    i=arg_i;
     1301    j=arg_j;
     1302  }
     1303  if (!
     1304      (c->states[j][i]==HASTREP))
     1305    c->states[j][i]=SOONTREP;
     1306}
     1307BOOLEAN has_t_rep(const int & arg_i, const  int & arg_j, calc_dat* state){
    12261308
    12271309  if (arg_i==arg_j)
    12281310    {
    1229       return (true);
     1311      return (TRUE);
    12301312    }
    12311313  if (arg_i>arg_j)
     
    12811363      poly tail=c->S->m[i]->next;
    12821364      poly prev=c->S->m[i];
    1283       bool did_something=false;
     1365      BOOLEAN did_something=FALSE;
    12841366      while((tail!=NULL)&& (pLmCmp(tail, monom)>=0))
    12851367        {
    12861368          if (p_LmDivisibleBy(monom,tail,c->r))
    12871369            {
    1288               did_something=true;
     1370              did_something=TRUE;
    12891371              prev->next=tail->next;
    12901372              tail->next=NULL;
Note: See TracChangeset for help on using the changeset viewer.