Changeset daa4e5 in git


Ignore:
Timestamp:
Nov 21, 2012, 5:43:11 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
da9d522d025bd8d8edf9686d84441705b53f89bd
Parents:
68fedf3295a64608c08e75ff1fba1dc2a5c9ef32
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-11-21 17:43:11+01:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:48+02:00
Message:
Using s/k-buckets in TraverseTail and SchreyerSyzygyNF

TODO: refine!
File:
1 edited

Legend:

Unmodified
Added
Removed
  • dyn_modules/syzextra/syzextra.cc

    r68fedf rdaa4e5  
    3232#include <polys/simpleideals.h>
    3333
     34#include <polys/kbuckets.h> // for kBucket*
     35#include <polys/nc/summator.h> // for CPolynomialSummator
     36#include <polys/operations/p_Mult_q.h> // for MIN_LENGTH_BUCKET
     37
    3438#include <kernel/kstd1.h>
    3539#include <kernel/polys.h>
     
    682686
    683687  poly aa = leadmonom(a, R); assume( aa != NULL); // :(
     688
     689 
    684690  poly t = TraverseTail(aa, r);
    685691
     
    903909
    904910  assume( c >= 0 && c < IDELEMS(T) );
    905 
     911  kBucket_pt bucket = kBucketCreate(r); kbTest(bucket);
     912
     913//  kBucketInit(bucket, NULL, 0); // not needed!?
     914     
    906915  poly p = leadmonom(syz_lead, r); // :( 
    907   poly spoly = pp_Mult_qq(p, T->m[c], r);
     916//  poly spoly = pp_Mult_qq(p, T->m[c], r); 
     917  kBucket_Plus_mm_Mult_pp(bucket, p, T->m[c], pLength(T->m[c])); // TODO: store length of tails separately!?
     918  kbTest(bucket); 
    908919  p_Delete(&p, r);
    909 
    910920
    911921  c = p_GetComp(syz_2, r) - 1;
     
    913923
    914924  p = leadmonom(syz_2, r); // :(
    915   spoly = p_Add_q(spoly, pp_Mult_qq(p, T->m[c], r), r);
     925//  spoly = p_Add_q(spoly, pp_Mult_qq(p, T->m[c], r), r);
     926  kBucket_Plus_mm_Mult_pp(bucket, p, T->m[c], pLength(T->m[c]));
     927  kbTest(bucket);
    916928  p_Delete(&p, r);
    917929
    918   poly tail = syz_2; // TODO: use bucket!?
    919 
    920   while (spoly != NULL)
    921   {
    922     poly t = m_div.FindReducer(spoly, NULL, m_checker);
    923 
    924     p_LmDelete(&spoly, r);
     930  // TODO: use bucket!?
     931  const bool bUsePolynomial = TEST_OPT_NOT_BUCKETS; //  || (pLength(spoly) < MIN_LENGTH_BUCKET);
     932  CPolynomialSummator tail(r, bUsePolynomial);
     933  tail.AddAndDelete(syz_2, 1); 
     934
     935 
     936  kbTest(bucket);
     937  for( poly spoly = kBucketExtractLm(bucket); spoly != NULL; p_LmDelete(&spoly, r), spoly = kBucketExtractLm(bucket))
     938  {   
     939    kbTest(bucket);
     940    poly t = m_div.FindReducer(spoly, NULL, m_checker);   
    925941
    926942    if( t != NULL )
     
    931947      assume( c >= 0 && c < IDELEMS(T) );
    932948
    933       spoly = p_Add_q(spoly, pp_Mult_qq(p, T->m[c], r), r);
     949      kBucket_Plus_mm_Mult_pp(bucket, p, T->m[c], pLength(T->m[c])); 
     950//      spoly = p_Add_q(spoly, pp_Mult_qq(p, T->m[c], r), r);
    934951
    935952      p_Delete(&p, r);
    936953
    937       tail = p_Add_q(tail, t, r);
    938     }   
    939   }
    940 
     954      tail.AddAndDelete(t, 1); 
     955    } // otherwise discard that leading term altogether!
     956    kbTest(bucket);
     957  }
     958
     959  // now bucket must be empty!
     960  kbTest(bucket);
     961  assume( kBucketClear(bucket) == NULL );
     962  kBucketDestroy(&bucket); // TODO: reuse the bucket!!!
     963     
    941964  return tail;
    942965}
     
    970993  assume( T != NULL );
    971994
    972   poly s = NULL;
    973995
    974996  if( (!__TAILREDSYZ__) || m_lcm.Check(multiplier) )
     997  {
     998    const bool bUsePolynomial = TEST_OPT_NOT_BUCKETS; //  || (pLength(tail) < MIN_LENGTH_BUCKET);
     999    CPolynomialSummator sum(r, bUsePolynomial);
     1000//    poly s = NULL;
    9751001    for(poly p = tail; p != NULL; p = pNext(p))   // iterate over the tail
    976       s = p_Add_q(s, ReduceTerm(multiplier, p, NULL), r); 
    977 
    978   return s;
     1002      sum += ReduceTerm(multiplier, p, NULL);
     1003    return sum;
     1004  }
     1005
     1006  return NULL;
     1007
    9791008}
    9801009
Note: See TracChangeset for help on using the changeset viewer.