Changeset d491e3 in git


Ignore:
Timestamp:
Jul 20, 2005, 1:12:43 PM (18 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
634dab087e9b393fec1655c78c584e20750b3db3
Parents:
cf2307dc9864719fabb9577ce88d785d229b1eea
Message:
*bricken: non commutative seems to work


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

Legend:

Unmodified
Added
Removed
  • kernel/tgb.cc

    rcf2307d rd491e3  
    55*  Computer Algebra System SINGULAR     *
    66****************************************/
    7 /* $Id: tgb.cc,v 1.34 2005-06-02 12:38:51 bricken Exp $ */
     7/* $Id: tgb.cc,v 1.35 2005-07-20 11:12:43 bricken Exp $ */
    88/*
    99* ABSTRACT: slimgb and F4 implementation
     
    1414#include "tgbgauss.h"
    1515#include "F4.h"
     16#include "gring.h"
     17//#include "gr_kstd2.h"
    1618#include "longrat.h"
    1719static const int bundle_size=100;
     
    220222//   return pLength(p);
    221223// }
     224
     225
     226
     227
     228
     229
     230
     231
    222232static inline int pQuality(poly p, slimgb_alg* c, int l=-1){
    223233 
    224234  if(l<0)
    225235    l=pLength(p);
    226   if(c->is_char0) return pSLength(p,l);
     236  if(c->is_char0) {
     237    if((pLexOrder) &&(!c->is_homog)){
     238      int cs;
     239      number coef=pGetCoeff(p);
     240      if (rField_is_Q(currRing)){
     241        cs=QlogSize(coef);
     242      }
     243      else
     244        cs=nSize(coef);
     245      return cs*pELength(p,c,l);
     246    }
     247    return pSLength(p,l);
     248  }
    227249  if((pLexOrder) &&(!c->is_homog)) return pELength(p,c,l);
    228250  return l;
    229251}
     252
    230253static inline int pTotaldegree_full(poly p){
    231254  int r=0;
     
    242265    //case, you have to look on coefs
    243266    int s=0;
    244     if (c->is_char0)
     267    if (c->is_char0){
    245268      //s=kSBucketLength(bucket,this->p);
     269      if((pLexOrder) &&(!c->is_homog)){
     270          int cs;
     271          number coef;
     272         
     273          coef=pGetCoeff(kBucketGetLm(bucket));
     274          //c=nSize(pGetCoeff(kBucketGetLm(b)));
     275         
     276          //c=nSize(pGetCoeff(lm));
     277          if (rField_is_Q(currRing)){
     278            cs=QlogSize(coef);
     279          }
     280          else
     281            cs=nSize(coef);
     282          if (bucket->coef[0]!=NULL){
     283            if (rField_is_Q(currRing)){
     284              int modifier=QlogSize(pGetCoeff(bucket->coef[0]));
     285              cs+=modifier;
     286            }
     287            else{
     288              int modifier=nSize(pGetCoeff(bucket->coef[0]));
     289              cs*=modifier;}
     290          }
     291          return cs*kEBucketLength(this->bucket,this->p,c);
     292      }
    246293      s=kSBucketLength(bucket,NULL);
     294    }
    247295    else
    248296    {
     
    255303    return s;
    256304}
     305
    257306// static int guess_quality(const red_object & p, slimgb_alg* c){
    258307//   //looks only on bucket
     
    583632static void length_one_crit(slimgb_alg* c, int pos, int len)
    584633{
     634  if (c->nc)
     635    return;
    585636  if (len==1)
    586637  {
     
    595646        c->states[i][pos]=HASTREP;
    596647    }
    597     shorten_tails(c,c->S->m[pos]);
     648    if (!c->nc)
     649      shorten_tails(c,c->S->m[pos]);
    598650  }
    599651}
     
    10361088      continue;
    10371089    } else
    1038     if ((c->lengths[i]==1) && (c->lengths[j]==1))
     1090    if ((!c->nc) && (c->lengths[i]==1) && (c->lengths[j]==1))
    10391091      c->states[i][j]=HASTREP;
    1040     else if (pHasNotCF(c->S->m[i],c->S->m[j]))
     1092    else if ((!(c->nc)) &&  (pHasNotCF(c->S->m[i],c->S->m[j])))
    10411093    {
    10421094      c->easy_product_crit++;
     
    11651217  add_to_reductors(c, h, c->lengths[c->n-1]);
    11661218  //i=posInS(c->strat,c->strat->sl,h,0 ecart);
    1167 
    1168   if (c->lengths[c->n-1]==1)
    1169     shorten_tails(c,c->S->m[c->n-1]);
     1219  if (!(c->nc)){
     1220    if (c->lengths[c->n-1]==1)
     1221      shorten_tails(c,c->S->m[c->n-1]);
     1222  }
    11701223  //you should really update c->lengths, c->strat->lenS, and the oder of polys in strat if you sort after lengths
    11711224
     
    11961249
    11971250
    1198 
    1199 
    1200 
    1201 
    1202 
    12031251static poly redNF2 (poly h,slimgb_alg* c , int &len, number&  m,int n)
    12041252{
     
    12191267  // BOOLEAN corr=lenS_correct(strat);
    12201268  kBucketInit(P.bucket,P.p,len /*pLength(P.p)*/);
     1269  intset lenSw=strat->lenS;
     1270  if (strat->lenSw!=NULL)
     1271    lenSw=strat->lenSw;
    12211272  //int max_pos=simple_posInS(strat,P.p);
    12221273  loop
     
    12241275
    12251276      j=kFindDivisibleByInS(strat->S,strat->sevS,strat->sl,&P);
    1226       if ((j>=0) && ((!n)||(strat->lenS[j]<=n)))
     1277      if ((j>=0) && ((!n)||(lenSw[j]<=n)))
    12271278      {
    12281279
     
    12771328
    12781329
     1330
    12791331static poly redTailShort(poly h, kStrategy strat){
    12801332
     
    13121364static void c_S_element_changed_hook(int pos, slimgb_alg* c){
    13131365  length_one_crit(c,pos, c->lengths[pos]);
    1314   line_of_extended_prod(pos,c);
     1366  if (!c->nc)
     1367    line_of_extended_prod(pos,c);
    13151368}
    13161369class poly_tree_node {
     
    15271580    quick_pop_pair(c);
    15281581    if(s->i>=0){
     1582      //be careful replace_pair use createShortSpoly which is not noncommutative
    15291583      //replace_pair(s->i,s->j,c);
    15301584    if(s->i==s->j) {
     
    15341588    }
    15351589    poly h;
    1536     if(s->i>=0)
    1537       h=ksOldCreateSpoly(c->S->m[s->i], c->S->m[s->j], NULL, c->r);
     1590    if(s->i>=0){
     1591      if (!c->nc)
     1592        h=ksOldCreateSpoly(c->S->m[s->i], c->S->m[s->j], NULL, c->r);
     1593      else
     1594        h= nc_CreateSpoly(c->S->m[s->i], c->S->m[s->j], NULL, c->r);
     1595    }
    15381596    else
    15391597      h=s->lcm_of_lm;
     
    15421600    number coef;
    15431601    int mlen=pLength(h);
    1544     h=redNF2(h,c,mlen,coef,2);
    1545     redTailShort(h,c->strat);
    1546     nDelete(&coef);
    1547 
     1602    if (!c->nc){
     1603      h=redNF2(h,c,mlen,coef,2);
     1604      redTailShort(h,c->strat);
     1605      nDelete(&coef);
     1606    }
    15481607    free_sorted_pair_node(s,c->r);
    15491608    if(!h) continue;
     
    16481707    // delete buf[j];
    16491708    //remember to free res here
    1650     p=redTailShort(p, c->strat);
     1709    if (!c->nc)
     1710      p=redTailShort(p, c->strat);
    16511711    sbuf[j]=add_to_basis_ideal_quotient(p,-1,-1,c,ibuf+j);
    16521712    //sbuf[j]=add_to_basis(p,-1,-1,c,ibuf+j);
     
    16831743}
    16841744
    1685 static poly redNF (poly h,kStrategy strat, int &len)
    1686 {
    1687   len=0;
    1688   if (h==NULL) return NULL;
    1689   int j;
    1690 
    1691   len=pLength(h);
    1692   if (0 > strat->sl)
    1693   {
    1694     return h;
    1695   }
    1696   LObject P(h);
    1697   P.SetShortExpVector();
    1698   P.bucket = kBucketCreate(currRing);
    1699   kBucketInit(P.bucket,P.p,len /*pLength(P.p)*/);
    1700   //int max_pos=simple_posInS(strat,P.p);
    1701   loop
    1702     {
    1703       j=kFindDivisibleByInS(strat->S,strat->sevS,strat->sl,&P);
    1704       if (j>=0)
    1705       {
    1706         nNormalize(pGetCoeff(P.p));
    1707 #ifdef KDEBUG
    1708         if (TEST_OPT_DEBUG)
    1709         {
    1710           PrintS("red:");
    1711           wrp(h);
    1712           PrintS(" with ");
    1713           wrp(strat->S[j]);
    1714         }
    1715 #endif
    1716         number coef=kBucketPolyRed(P.bucket,strat->S[j],
    1717                                    strat->lenS[j]/*pLength(strat->S[j])*/,
    1718                                    strat->kNoether);
    1719         nDelete(&coef);
    1720         h = kBucketGetLm(P.bucket);
    1721         if (h==NULL) return NULL;
    1722         P.p=h;
    1723         P.t_p=NULL;
    1724         P.SetShortExpVector();
    1725 #ifdef KDEBUG
    1726         if (TEST_OPT_DEBUG)
    1727         {
    1728           PrintS("\nto:");
    1729           wrp(h);
    1730           PrintLn();
    1731         }
    1732 #endif
    1733       }
    1734       else
    1735       {
    1736         kBucketClear(P.bucket,&(P.p),&len);
    1737         kBucketDestroy(&P.bucket);
    1738         pNormalize(P.p);
    1739         return P.p;
    1740       }
    1741     }
    1742 }
     1745
    17431746
    17441747#ifdef REDTAIL_S
     
    19011904 
    19021905  r=currRing;
     1906  nc=rIsPluralRing(r);
     1907  Print("nc %i",nc);
    19031908  is_homog=TRUE;
    19041909  {
     
    19341939  //(rChar()==0);
    19351940  F4_mode=F4;
     1941 
    19361942  if ((!F4_mode)&&(!is_homog) &&(pLexOrder)){
    19371943    this->doubleSugar=TRUE;
     
    25162522//for impl reasons may return false if the the normal product criterion matches
    25172523static inline BOOLEAN extended_product_criterion(poly p1, poly gcd1, poly p2, poly gcd2, slimgb_alg* c){
     2524  if (c->nc)
     2525    return FALSE;
    25182526  if(gcd1==NULL) return FALSE;
    25192527        if(gcd2==NULL) return FALSE;
     
    30713079void reduction_step::reduce(red_object* r, int l, int u){}
    30723080void simple_reducer::target_is_no_sum_reduce(red_object & ro){
    3073   kBucketPolyRed(ro.bucket,p,
    3074                  p_len,
    3075                  c->strat->kNoether);
     3081  number coef;
     3082  if (!c->nc)
     3083    coef=kBucketPolyRed(ro.bucket,p,
     3084                   p_len,
     3085                   c->strat->kNoether);
     3086  else
     3087    nc_kBucketPolyRed_Z(ro.bucket, p, &coef);
     3088  nDelete(&coef);
    30763089}
    30773090
     
    31463159      pSetExp(m,i,(pGetExp(r[erg.to_reduce_l].p, i)-pGetExp(red,i)));
    31473160    pSetm(m);
    3148     poly red_cp=ppMult_mm(red,m);
    3149    
     3161    poly red_cp;
     3162    if (!c->nc)
     3163      red_cp=ppMult_mm(red,m);
     3164    else
     3165      red_cp=nc_mm_Mult_p(m, pCopy(red), c->r);
    31503166    if(!erg.fromS){
    31513167      kBucketInit(r[rn].bucket,red,red_len);
     
    31533169    //now reduce the copy
    31543170    //static poly redNF2 (poly h,slimgb_alg* c , int &len, number&  m,int n)
    3155     redTailShort(red_cp,c->strat);
     3171    if (!c->nc)
     3172      redTailShort(red_cp,c->strat);
    31563173    //number mul;
    31573174    // red_len--;
  • kernel/tgb_internal.h

    rcf2307d rd491e3  
    55*  Computer Algebra System SINGULAR     *
    66****************************************/
    7 /* $Id: tgb_internal.h,v 1.15 2005-06-01 09:06:04 bricken Exp $ */
     7/* $Id: tgb_internal.h,v 1.16 2005-07-20 11:12:43 bricken Exp $ */
    88/*
    99 * ABSTRACT: tgb internal .h file
     
    130130  BOOLEAN doubleSugar;
    131131  BOOLEAN F4_mode;
     132  BOOLEAN nc;
    132133};
    133134class red_object{
  • kernel/tgb_obsolete.cc

    rcf2307d rd491e3  
    11#include "tgb_internal.h"
     2static poly redNF (poly h,kStrategy strat, int &len)
     3{
     4  len=0;
     5  if (h==NULL) return NULL;
     6  int j;
     7
     8  len=pLength(h);
     9  if (0 > strat->sl)
     10  {
     11    return h;
     12  }
     13  LObject P(h);
     14  P.SetShortExpVector();
     15  P.bucket = kBucketCreate(currRing);
     16  kBucketInit(P.bucket,P.p,len /*pLength(P.p)*/);
     17  //int max_pos=simple_posInS(strat,P.p);
     18  loop
     19    {
     20      j=kFindDivisibleByInS(strat->S,strat->sevS,strat->sl,&P);
     21      if (j>=0)
     22      {
     23        nNormalize(pGetCoeff(P.p));
     24#ifdef KDEBUG
     25        if (TEST_OPT_DEBUG)
     26        {
     27          PrintS("red:");
     28          wrp(h);
     29          PrintS(" with ");
     30          wrp(strat->S[j]);
     31        }
     32#endif
     33        number coef=kBucketPolyRed(P.bucket,strat->S[j],
     34                                   strat->lenS[j]/*pLength(strat->S[j])*/,
     35                                   strat->kNoether);
     36        nDelete(&coef);
     37        h = kBucketGetLm(P.bucket);
     38        if (h==NULL) return NULL;
     39        P.p=h;
     40        P.t_p=NULL;
     41        P.SetShortExpVector();
     42#ifdef KDEBUG
     43        if (TEST_OPT_DEBUG)
     44        {
     45          PrintS("\nto:");
     46          wrp(h);
     47          PrintLn();
     48        }
     49#endif
     50      }
     51      else
     52      {
     53        kBucketClear(P.bucket,&(P.p),&len);
     54        kBucketDestroy(&P.bucket);
     55        pNormalize(P.p);
     56        return P.p;
     57      }
     58    }
     59}
    260int find_best(red_object* r,int l, int u, int &w, calc_dat* c){
    361
Note: See TracChangeset for help on using the changeset viewer.