Changeset 24d494 in git


Ignore:
Timestamp:
Oct 11, 2004, 4:17:33 PM (20 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38077648e7239f98078663eb941c3c979511150a')
Children:
9cc4c6b84ee92bb1ff3d8fba533c57da37835d12
Parents:
46c5be3948f584f211de3b771d83246ab6ec948b
Message:
*bricken: progresses at weighted lengths


git-svn-id: file:///usr/local/Singular/svn/trunk@7562 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Singular/tgb.cc

    r46c5be r24d494  
    3636inline int pSLength(poly p, int l) {
    3737  return l; }
    38 inline int kSBucketLength(kBucket* bucket) {return bucket_guess(bucket);}
     38inline int kSBucketLength(kBucket* bucket, poly lm) {return bucket_guess(bucket);}
    3939#endif
    4040
     
    107107}
    108108#endif
     109static int do_pELength(poly p, calc_dat* c, int dlm=-1){
     110  if(p==NULL) return 0;
     111  int s=0;
     112  poly pi=p;
     113  if(dlm<0){
     114    dlm=pTotaldegree(p,c->r);
     115    s=1;
     116    pi=p->next;
     117  }
     118 
     119  while(pi){
     120    int d=pTotaldegree(pi,c->r);
     121    if(d>dlm)
     122      s+=1+d-dlm;
     123    else
     124      ++s;
     125    pi=pi->next;
     126  }
     127  return s;
     128}
     129int kEBucketLength(kBucket* b, poly lm,calc_dat* ca)
     130{
     131  int s=0;
     132  if(lm==NULL){
     133    lm=kBucketGetLm(b);
     134  }
     135  if(lm==NULL) return 0;
     136  int d=pTotaldegree(lm,ca->r);
     137  int i;
     138  for (i=b->buckets_used;i>=0;i--)
     139  {
     140    if(b->buckets[i]==NULL) continue;
     141    s+=do_pELength(b->buckets[i],ca,d);
     142  }
     143  return s;
     144}
     145
     146static inline int pELength(poly p, calc_dat* c,int l){
     147  if (p==NULL) return 0;
     148  return do_pELength(p,c);
     149}
     150// static int quality(poly p, int len, calc_dat* c){
     151//   if (c->is_char0) return pSLength(p,len);
     152//   return pLength(p);
     153// }
     154static inline int pQuality(poly p, calc_dat* c, int l=-1){
     155 
     156  if(l<0)
     157    l=pLength(p);
     158  if(c->is_char0) return pSLength(p,l);
     159  if((pLexOrder) &&(!c->is_homog)) return pELength(p,c,l);
     160  return l;
     161}
     162
     163
     164int red_object::guess_quality(calc_dat* c){
     165    //works at the moment only for lenvar 1, because in different
     166    //case, you have to look on coefs
     167    int s=0;
     168    if (c->is_char0)
     169      s=kSBucketLength(bucket,this->p);
     170    else
     171    {
     172      if((pLexOrder) &&(!c->is_homog))
     173        s=kEBucketLength(this->bucket,this->p,c);
     174      else s=bucket_guess(bucket);
     175    }
     176    if (sum!=NULL){
     177      if (c->is_char0)
     178        s+=kSBucketLength(sum->ac->bucket);
     179      else
     180      {
     181        if((pLexOrder) &&(!c->is_homog))
     182          s=kEBucketLength(sum->ac->bucket,this->p,c);
     183        else
     184          s+=bucket_guess(sum->ac->bucket);
     185      }
     186    }
     187    return s;
     188}
     189// static int guess_quality(const red_object & p, calc_dat* c){
     190//   //looks only on bucket
     191//   if (c->is_char0) return kSBucketLength(p.bucket,p.p);
     192//   if((pLexOrder) &&(!c->is_homog)) return kEBucketLength(p.bucket,p.p,c);
     193//   return (bucket_guess(p.bucket));
     194// }
     195
    109196static void finalize_reduction_step(reduction_step* r){
    110197  delete r;
     
    519606 
    520607  int i;
    521   if (c->is_char0)
    522        i=simple_posInS(c->strat,h,pSLength(h,len),c->is_char0);
    523   else
    524     i=simple_posInS(c->strat,h,len,c->is_char0);
    525  
     608//   if (c->is_char0)
     609//        i=simple_posInS(c->strat,h,pSLength(h,len),c->is_char0);
     610//   else
     611//     i=simple_posInS(c->strat,h,len,c->is_char0);
     612
    526613  LObject P; memset(&P,0,sizeof(P));
    527614  P.tailRing=c->r;
     
    537624    pNorm(P.p);
    538625  pNormalize(P.p);
    539 
     626  int pq=pQuality(h,c,len);
     627  i=simple_posInS(c->strat,h,pq);
    540628  c->strat->enterS(P,i,c->strat);
    541629 
     
    545633 
    546634  if(c->strat->lenSw)
    547     c->strat->lenSw[i]=pSLength(P.p,len);
     635    c->strat->lenSw[i]=pq;
    548636  return i;
    549637 
     
    574662}
    575663
    576 static void move_forward_in_S(int old_pos, int new_pos,kStrategy strat, BOOLEAN is_char0)
     664static void move_forward_in_S(int old_pos, int new_pos,kStrategy strat)
    577665{
    578666  assume(old_pos>=new_pos);
     
    583671  int length=strat->lenS[old_pos];
    584672  int length_w;
    585   if(is_char0)
     673  if(strat->lenSw)
    586674    length_w=strat->lenSw[old_pos];
    587675  int i;
     
    605693  strat->S_2_R[new_pos]=s_2_r;
    606694  strat->lenS[new_pos]=length;
    607   if(is_char0)
     695  if(strat->lenSw)
    608696    strat->lenSw[new_pos]=length_w;
    609697  //assume(lenS_correct(strat));
     
    856944
    857945//len should be weighted length in char 0
    858 static int simple_posInS (kStrategy strat, poly p,int len, BOOLEAN is_char0)
     946static int simple_posInS (kStrategy strat, poly p,int len)
    859947{
    860948
     
    863951  polyset set=strat->S;
    864952  intset setL=strat->lenS;
    865   if (is_char0) setL=strat->lenSw;
     953  if (strat->lenSw) setL=strat->lenSw;
    866954  int length=strat->sl;
    867955  int i;
     
    18661954      else
    18671955        qal=c->strat->lenS[z2];
    1868       int new_pos=simple_posInS(c->strat,c->strat->S[z2],qal,c->is_char0);
     1956      int new_pos=simple_posInS(c->strat,c->strat->S[z2],qal);
    18691957      if (new_pos<z2)
    18701958      {
    1871         move_forward_in_S(z2,new_pos,c->strat,c->is_char0);
     1959        move_forward_in_S(z2,new_pos,c->strat);
    18721960      }
    18731961    }
     
    37793867  c->easy_product_crit=0;
    37803868  c->extended_product_crit=0;
    3781   c->is_char0=(rChar()==0);
     3869  if (rField_is_Zp(c->r))
     3870    c->is_char0=FALSE;
     3871  else
     3872    c->is_char0=TRUE;
     3873  //not fully correct
     3874
     3875//(rChar()==0);
    37823876  c->F4_mode=F4_mode;
    37833877  c->reduction_steps=0;
     
    38453939  c->strat->S=c->strat->Shdl->m;
    38463940  c->strat->lenS=(int*)omAlloc0(i*sizeof(int));
    3847   if(c->is_char0)
     3941  if((c->is_char0)||((pLexOrder) &&(!c->is_homog)))
    38483942    c->strat->lenSw=(int*)omAlloc0(i*sizeof(int));
    38493943  else
     
    41234217      int new_pos;
    41244218      int q;
    4125       q=quality(c->S->m[i],c->lengths[i],c);
    4126       new_pos=simple_posInS(c->strat,c->S->m[i],q,c->is_char0);
     4219      q=pQuality(c->S->m[i],c,c->lengths[i]);
     4220      new_pos=simple_posInS(c->strat,c->S->m[i],q);
    41274221
    41284222      int old_pos=-1;
     
    41534247
    41544248      if (new_pos<old_pos)
    4155         move_forward_in_S(old_pos,new_pos,c->strat, c->is_char0);
     4249        move_forward_in_S(old_pos,new_pos,c->strat);
    41564250
    41574251      length_one_crit(c,i,c->lengths[i]);
     
    43654459
    43664460
    4367 static int guess_quality(const red_object & p, calc_dat* c){
    4368   //looks only on bucket
    4369   if (c->is_char0) return kSBucketLength(p.bucket,p.p);
    4370   return (bucket_guess(p.bucket));
    4371 }
    4372 static int pQuality(poly p, calc_dat* c){
    4373   if(c->is_char0) return pSLength(p,pLength(p));
    4374   return pLength(p);
    4375 }
    4376 static int quality_of_pos_in_strat_S(int pos, calc_dat* c){
    4377   if (c->is_char0) return c->strat->lenSw[pos];
     4461
     4462static inline int quality_of_pos_in_strat_S(int pos, calc_dat* c){
     4463  if (c->strat->lenSw!=NULL) return c->strat->lenSw[pos];
    43784464  return c->strat->lenS[pos];
    43794465}
    4380 static int quality(poly p, int len, calc_dat* c){
    4381   if (c->is_char0) return pSLength(p,len);
    4382   return pLength(p);
    4383 }
     4466
    43844467static void multi_reduction_lls_trick(red_object* los, int losl,calc_dat* c,find_erg & erg){
    43854468  erg.expand=NULL;
     
    45444627    los[bp].p=p;
    45454628    kBucketInit(los[bp].bucket,p,old_length);
    4546     int qal=quality(clear_into,new_length,c);
     4629    int qal=pQuality(clear_into,c,new_length);
    45474630    int pos_in_c=-1;   
    45484631    int z;
    45494632    int new_pos;
    4550     new_pos=simple_posInS(c->strat,clear_into,qal,c->is_char0);
     4633    new_pos=simple_posInS(c->strat,clear_into,qal);
    45514634    assume(new_pos<=j);
    45524635    for (z=c->n;z;z--)
     
    45844667    if (new_pos<j)
    45854668    {
    4586       move_forward_in_S(j,new_pos,c->strat,c->is_char0);
     4669      move_forward_in_S(j,new_pos,c->strat);
    45874670      erg.reduce_by=new_pos;
    45884671    }
     
    49775060
    49785061}
    4979 int red_object::guess_quality(calc_dat* c){
    4980     //works at the moment only for lenvar 1, because in different
    4981     //case, you have to look on coefs
    4982     int s=0;
    4983     if (c->is_char0)
    4984       s=kSBucketLength(bucket);
    4985     else
    4986       s=bucket_guess(bucket);
    4987     if (sum!=NULL){
    4988       if (c->is_char0)
    4989       s+=kSBucketLength(sum->ac->bucket);
    4990     else
    4991       s+=bucket_guess(sum->ac->bucket);
    4992     }
    4993     return s;
    4994 }
     5062
    49955063void reduction_step::reduce(red_object* r, int l, int u){}
    49965064void simple_reducer::target_is_no_sum_reduce(red_object & ro){
  • Singular/tgb.h

    r46c5be r24d494  
    256256static void soon_t_rep(const int & arg_i, const int & arg_j, calc_dat* c);
    257257static int pLcmDeg(poly a, poly b);
    258 static int simple_posInS (kStrategy strat, poly p,int len, BOOLEAN is_char0);
     258static int simple_posInS (kStrategy strat, poly p,int len);
    259259static BOOLEAN find_next_pair(calc_dat* c, BOOLEAN go_higher=TRUE);
    260260
     
    273273static sorted_pair_node* quick_pop_pair(calc_dat* c);
    274274static sorted_pair_node* top_pair(calc_dat* c);
    275 static int quality(poly p, int len, calc_dat* c);
     275//static int quality(poly p, int len, calc_dat* c);
    276276/**
    277277   makes on each red_object in a region a single_step
Note: See TracChangeset for help on using the changeset viewer.