Changeset e7d1fd in git


Ignore:
Timestamp:
Sep 27, 1999, 3:35:53 PM (25 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
Children:
88ff58c3e09f5825f063912877992d787c2b0525
Parents:
e72e836bdc4f7b2643f6d02eef8fb1bd7e012d0c
Message:
* small changes


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

Legend:

Unmodified
Added
Removed
  • Singular/kbuckets.cc

    re72e836 re7d1fd  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kbuckets.cc,v 1.2 1999-05-26 16:20:17 obachman Exp $ */
     4/* $Id: kbuckets.cc,v 1.3 1999-09-27 13:35:53 obachman Exp $ */
    55
    66#include "mod2.h"
     
    2525{
    2626  unsigned int i = 0;
    27  
     27
    2828  if (l == 0) return 0;
    2929  l--;
     
    3838}
    3939
    40  
     40
    4141
    4242#if defined(PDEBUG) && ! defined(HAVE_PSEUDO_BUCKETS)
     
    5050  if (bucket->buckets_length[i] != pLength(bucket->buckets[i]))
    5151  {
    52     Warn("Bucket %d lengths difference should:%d has:%d in %s:%d\n",
     52    Warn("Bucket %d lengths difference should:%d has:%d in %s:%d",
    5353          i, bucket->buckets_length[i], pLength(bucket->buckets[i]), file, line);
    5454    assume(0);
     
    5656  else if (i > 0 && (int) pLogLength(bucket->buckets_length[i]) > i)
    5757  {
    58     Warn("Bucket %d too long %d in %s:%d\n",
     58    Warn("Bucket %d too long %d in %s:%d",
    5959          i, bucket->buckets_length[i], file, line);
    6060    assume(0);
     
    6262  else if (i==0 && bucket->buckets_length[0] > 1)
    6363  {
    64     Warn("Bucket 0 too long \n");
     64    Warn("Bucket 0 too long");
    6565  }
    6666}
     
    7979        && pComp0(lm, bucket->buckets[i]) != 1)
    8080    {
    81       Warn("Bucket %d larger than lm in %s:%d\n", i, file, line);
     81      Warn("Bucket %d larger than lm in %s:%d", i, file, line);
    8282      assume(0);
    8383    }
    8484  }
    85  
     85
    8686  for (; i<=MAX_BUCKET; i++)
    8787  {
    8888    if (bucket->buckets[i] != NULL || bucket->buckets_length[i] != 0)
    8989    {
    90       Warn("Bucket %d not zero in %s:%d\n", i, file, line);
     90      Warn("Bucket %d not zero in %s:%d", i, file, line);
    9191      assume(0);
    9292    }
     
    126126inline void kBucketAdjustBucketsUsed(kBucket_pt bucket)
    127127{
    128   while ( bucket->buckets_used > 0 && 
     128  while ( bucket->buckets_used > 0 &&
    129129          bucket->buckets[bucket->buckets_used] == NULL)
    130130    (bucket->buckets_used)--;
     
    152152  }
    153153}
    154            
    155                              
     154
     155
    156156static BOOLEAN kBucketIsCleared(kBucket_pt bucket)
    157157{
     
    171171{
    172172  int i;
    173  
     173
    174174  assume(bucket != NULL);
    175175  assume(length <= 0 || length == pLength(lm));
     
    207207  BOOLEAN zero = FALSE;
    208208  assume(bucket->buckets[0] == NULL && bucket->buckets_length[0] == 0);
    209  
     209
    210210  do
    211211  {
     
    217217        int comp = (j == 0 ? 1 :
    218218                    pComp0(bucket->buckets[i], bucket->buckets[j]));
    219        
    220         if (comp > 0) 
     219
     220        if (comp > 0)
    221221        {
    222222          if (j > 0 &&
     
    249249  while (j < 0);
    250250
    251   if (j == 0) 
     251  if (j == 0)
    252252  {
    253253    return;
     
    290290  bucket->buckets_length[1] = 0;
    291291
    292  
     292
    293293  for (i=2; i<=bucket->buckets_used; i++)
    294294  {
     
    347347{
    348348  int i;
    349  
     349
    350350  assume(bucket != NULL);
    351351  assume(length <= 0 || length == pLength(lm));
     
    354354  if (length <= 0) bucket->l = pLength(lm);
    355355  else bucket->l = length;
    356  
     356
    357357  bucket->heap = heap;
    358358  assume(pprocs != NULL);
     
    377377void kBucketClear(kBucket_pt bucket, poly *p, int *length)
    378378{
    379   assume(pLength(bucket->p) == bucket->l); 
     379  assume(pLength(bucket->p) == bucket->l);
    380380  *p = bucket->p;
    381381  *length = bucket->l;
     
    406406  }
    407407}
    408    
     408
    409409#else
    410410
    411 #define kBucketCompactifyIfNecessary(b) 
     411#define kBucketCompactifyIfNecessary(b)
    412412
    413413#endif
     
    421421#ifndef HAVE_PSEUDO_BUCKETS
    422422  int i;
    423  
     423
    424424  for (i=0; i<= bucket->buckets_used; i++)
    425     if (bucket->buckets[i] != NULL) 
     425    if (bucket->buckets[i] != NULL)
    426426      bucket->pprocs->n_Mult_p(n, bucket->buckets[i]);
    427427#else
    428428  bucket->pprocs->n_Mult_p(n, bucket->p);
    429 #endif 
     429#endif
    430430}
    431431
     
    435435/// Does not destroy p and m
    436436/// assume (*l <= 0 || pLength(p) == *l)
    437 void kBucket_Minus_m_Mult_p(kBucket_pt bucket, poly m, poly p, int *l, 
     437void kBucket_Minus_m_Mult_p(kBucket_pt bucket, poly m, poly p, int *l,
    438438                            poly spNoether)
    439439{
     
    441441  int i, l1;
    442442  poly p1 = p;
    443  
    444   if (*l <= 0) 
     443
     444  if (*l <= 0)
    445445  {
    446446    l1 = pLength(p1);
     
    449449  else
    450450    l1 = *l;
    451  
     451
    452452  if (m == NULL || p == NULL) return;
    453  
     453
    454454#ifndef HAVE_PSEUDO_BUCKETS
    455455  kBucketMergeLm(bucket);
     
    461461      (&(bucket->buckets[i]), &(bucket->buckets_length[i]),
    462462       m,
    463        p1, l1, 
     463       p1, l1,
    464464       spNoether,
    465465       bucket->pprocs->p_Mult_m,
     
    473473    {
    474474      bucket->pprocs->p_Add_q(&p1, &l1,
    475                               &(bucket->buckets[i]), 
     475                              &(bucket->buckets[i]),
    476476                              &(bucket->buckets_length[i]),
    477477                              bucket->heap);
     
    488488  bucket->buckets[i] = p1;
    489489  bucket->buckets_length[i]=l1;
    490   if (i >= bucket->buckets_used) 
     490  if (i >= bucket->buckets_used)
    491491    bucket->buckets_used = i;
    492492  else
     
    494494#else // HAVE_PSEUDO_BUCKETS
    495495  bucket->pprocs->p_Minus_m_Mult_q(&(bucket->p), &(bucket->l),
    496                                    m, p, l1, spNoether, 
     496                                   m, p, l1, spNoether,
    497497                                   bucket->pprocs->p_Mult_m,
    498498                                   bucket->heap);
    499 #endif 
     499#endif
    500500  kbTests(bucket);
    501501}
    502502
    503503/////////////////////////////////////////////////////////////////////////////
    504 // 
     504//
    505505// Extract all monomials from bucket with component comp
    506506// Return as a polynomial *p with length *l
    507 // In other words, afterwards 
     507// In other words, afterwards
    508508// Bpoly == Bpoly - (poly consisting of all monomials with component comp)
    509509// and components of monomials of *p are all 0
    510 // 
    511 void kBucketTakeOutComp(kBucket_pt bucket, 
    512                         Exponent_t comp, 
     510//
     511void kBucketTakeOutComp(kBucket_pt bucket,
     512                        Exponent_t comp,
    513513                        poly *r_p, int *l)
    514514{
     
    536536  pTakeOutComp(&(bucket->p), comp, &p, &lp);
    537537  (bucket->l) -= lp;
    538 #endif 
     538#endif
    539539  *r_p = p;
    540540  *l = lp;
    541  
     541
    542542  kbTests(bucket);
    543543}
    544544
    545 void kBucketDecrOrdTakeOutComp(kBucket_pt bucket, 
    546                                Exponent_t comp, Order_t order, 
     545void kBucketDecrOrdTakeOutComp(kBucket_pt bucket,
     546                               Exponent_t comp, Order_t order,
    547547                               poly *r_p, int *l)
    548548{
    549549  poly p = NULL, q;
    550550  int i, lp = 0, lq;
    551  
     551
    552552#ifndef HAVE_PSEUDO_BUCKETS
    553553  kBucketMergeLm(bucket);
     
    568568  pDecrOrdTakeOutComp(&(bucket->p), comp, order, &p, &lp);
    569569  (bucket->l) -= lp;
    570 #endif 
     570#endif
    571571
    572572  *r_p = p;
    573573  *l = lp;
    574574}
    575  
     575
    576576/////////////////////////////////////////////////////////////////////////////
    577577// Reduction of Bpoly with a given poly
     
    580580extern int spCheckCoeff(number *a, number *b);
    581581
    582 number kBucketPolyRed(kBucket_pt bucket, 
    583                       poly p1, int l1, 
     582number kBucketPolyRed(kBucket_pt bucket,
     583                      poly p1, int l1,
    584584                      poly spNoether)
    585585{
    586   assume(p1 != NULL && 
     586  assume(p1 != NULL &&
    587587         pDivisibleBy(p1,  kBucketGetLm(bucket)));
    588588  assume(pLength(p1) == (int) l1);
     
    591591  BOOLEAN reset_vec=FALSE;
    592592  number rn;
    593  
     593
    594594  if(a1==NULL)
    595595  {
     
    615615    pSetCompP(a1, pGetComp(lm));
    616616    reset_vec = TRUE;
    617   }
    618  
     617    pSetComp(lm, pGetComp(p1));
     618    pSetm(lm);
     619  }
     620
    619621  spMonSub(lm,p1);
    620622  l1--;
    621623
    622624  kBucket_Minus_m_Mult_p(bucket, lm, a1, &l1, spNoether);
    623  
     625
    624626  kb_pDelete1(lm, bucket->heap);
    625627  if (reset_vec) spModuleToPoly(a1);
     
    654656  }
    655657#endif
    656  
     658
    657659  kBucketInit(&(strat->bucket), h->p, h->length, &(strat->pprocs),
    658660              h->heap);
    659  
     661
    660662  lm = kBucketGetLm(&(strat->bucket));
    661  
     663
    662664  for(;;)
    663665  {
     
    666668#endif
    667669    j = 0;
    668    
     670
    669671#ifdef KB_HAVE_SHORT_EVECTORS
    670672    unsigned long ev = ~ pGetShortExpVector(lm);
    671673#endif
    672    
     674
    673675    if (strat->ak)
    674676    {
     
    716718    if (strat->T[j].length <= 0)
    717719      strat->T[j].length = pLength(strat->T[j].p);
    718      
    719     // Compactify 
     720
     721    // Compactify
    720722    kBucketCompactifyIfNecessary(&(strat->bucket));
    721723
     
    725727    nDelete(&up);
    726728    lm = kBucketGetLm(&(strat->bucket));
    727      
     729
    728730    if (lm == NULL)
    729731    {
     
    768770#endif
    769771  kTest(strat);
    770  
     772
    771773  if (strat->fromT)
    772774  {
     
    781783
    782784  poly lm = kBucketGetLm(&(strat->bucket));
    783  
     785
    784786  strat->fromT=FALSE;
    785787
     
    790792    unsigned long ev = ~ pGetShortExpVector(lm);
    791793#endif
    792  
     794
    793795    if (strat->ak)
    794796    {
     
    808810        else
    809811          goto Found;
    810 #else       
     812#else
    811813        if (pDivisibleBy2(strat->T[j].p,lm)) goto Found;
    812814        j++;
     
    818820#ifdef KDEBUG
    819821    if (TEST_OPT_DEBUG) PrintLn();
    820 #endif 
     822#endif
    821823    kBucketClear(&(strat->bucket), &(h->p), &(h->length));
    822824    if (TEST_OPT_INTSTRATEGY) pCleardenom(h->p);// also does a pContent
     
    837839    }
    838840
    839      
     841
    840842    /*
    841843     * the polynomial to reduce with (up to the moment) is;
     
    10261028                      hp->heap);
    10271029        }
    1028         number up = kBucketPolyRed(&(strat->bucket), strat->S[j], 
    1029                                    pLength(strat->S[j]), 
     1030        number up = kBucketPolyRed(&(strat->bucket), strat->S[j],
     1031                                   pLength(strat->S[j]),
    10301032                                   strat->kNoether);
    10311033        nDelete(&up);
     
    10591061    length++;
    10601062  }
    1061  
     1063
    10621064
    10631065  Finish:
Note: See TracChangeset for help on using the changeset viewer.