Changeset 58ea04 in git


Ignore:
Timestamp:
Mar 22, 2011, 11:40:25 AM (12 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
a4081e52fffd1c1c6450f2811d458e9ebc4e2823
Parents:
494884581702ad06eefdf632a5e1abb42bd90f4d
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-03-22 11:40:25+01:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:04:10+01:00
Message:
fixed: kbuckets.cc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/kbuckets.cc

    r494884 r58ea04  
    44/* $Id$ */
    55
    6 #include <kernel/mod2.h>
    7 #include <kernel/structs.h>
     6//#include <kernel/mod2.h>
    87#include <omalloc/omalloc.h>
    9 #include <kernel/p_polys.h>
    10 #include <kernel/febase.h>
    11 #include <kernel/pShallowCopyDelete.h>
    12 #include <kernel/numbers.h>
    13 #include <kernel/ring.h>
    14 #include <kernel/p_Procs.h>
    15 #include <kernel/kutil.h>
    16 #include <kernel/kbuckets.h>
     8#include <polys/monomials/p_polys.h>
     9//#include <kernel/febase.h>
     10//#include <kernel/pShallowCopyDelete.h>
     11#include <coeffs/coeffs.h>
     12#include <polys/monomials/ring.h>
     13//#include <kernel/p_Procs.h>
     14//#include <kernel/kutil.h>
     15#include <polys/kbuckets.h>
    1716
    1817#ifdef HAVE_COEF_BUCKETS
     
    3029    }                                                                  \
    3130  } while(0)                                                           \
    32     if (rField_is_Ring(currRing)) B->buckets_length[i] = pLength(B->buckets[i]);
     31    if (rField_is_Ring(B->bucket_ring)) B->buckets_length[i] = pLength(B->buckets[i]);
    3332#else
    3433#define MULTIPLY_BUCKET(B,I) do                                        \
     
    594593           performed when "(i<coef_start)" is true?
    595594           For the time being, I leave it as it is. */
    596         if (rField_is_Ring(r) && !(rField_is_Domain(r))) {
     595        if (rField_is_Ring(r) && !(rField_is_Domain(r)))
     596        {
    597597          bucket->buckets_length[i] = pLength(bucket->buckets[i]);
    598598          kBucketAdjust(bucket, i);
     
    611611      bucket->buckets[i] = p_Mult_nn(bucket->buckets[i], n, r);
    612612#ifdef HAVE_RINGS
    613       if (rField_is_Ring(currRing) && !(rField_is_Domain(currRing))) {
     613      if (rField_is_Ring(r) && !(rField_is_Domain(r)))
     614      {
    614615        bucket->buckets_length[i] = pLength(bucket->buckets[i]);
    615616        kBucketAdjust(bucket, i);
     
    738739    bucket->buckets_length[i] = 0;
    739740#ifdef HAVE_RINGS
    740     if (rField_is_Ring(currRing) && !(rField_is_Domain(currRing)))
     741    if (rField_is_Ring(r) && !(rField_is_Domain(r)))
    741742    {
    742743      l1 = pLength(p1);
     
    748749  else
    749750  {
    750     pSetCoeff0(m, nNeg(pGetCoeff(m)));
     751    pSetCoeff0(m, n_Neg(pGetCoeff(m),r->cf));
    751752    if (spNoether != NULL)
    752753    {
     
    758759      p1 = r->p_Procs->pp_Mult_mm(p1, m, r, last);
    759760#ifdef HAVE_RINGS
    760       if (rField_is_Ring(currRing) && !(rField_is_Domain(currRing)))
     761      if (rField_is_Ring(r) && !(rField_is_Domain(r)))
    761762      {
    762763        l1 = pLength(p1);
     
    765766#endif
    766767    }
    767     pSetCoeff0(m, nNeg(pGetCoeff(m)));
     768    pSetCoeff0(m, n_Neg(pGetCoeff(m),r->cf));
    768769  }
    769770
     
    820821  i = pLogLength(l1);
    821822  #ifdef USE_COEF_BUCKETS
    822   number n=n_Init(1,r);
     823  number n=n_Init(1,r->cf);
    823824  #endif
    824825  if (i <= bucket->buckets_used && bucket->buckets[i] != NULL)
     
    10621063                      poly spNoether)
    10631064{
    1064   assume((!rIsPluralRing(bucket->bucket_ring))||p_LmEqual(p1,kBucketGetLm(bucket), bucket->bucket_ring));
     1065  ring r=bucket->bucket_ring;
     1066  assume((!rIsPluralRing(r))||p_LmEqual(p1,kBucketGetLm(bucket), r));
    10651067  assume(p1 != NULL &&
    1066          p_DivisibleBy(p1,  kBucketGetLm(bucket), bucket->bucket_ring));
     1068         p_DivisibleBy(p1,  kBucketGetLm(bucket), r));
    10671069  assume(pLength(p1) == (int) l1);
    10681070
     
    10761078  if(a1==NULL)
    10771079  {
    1078     p_LmDelete(&lm, bucket->bucket_ring);
    1079     return nInit(1);
    1080   }
    1081 
    1082   if (! nIsOne(pGetCoeff(p1)))
     1080    p_LmDelete(&lm, r);
     1081    return n_Init(1,r->cf);
     1082  }
     1083
     1084  if (! n_IsOne(pGetCoeff(p1),r->cf))
    10831085  {
    10841086    number an = pGetCoeff(p1), bn = pGetCoeff(lm);
     
    10911093
    10921094    /* setup factor for p1 which cancels leading terms */
    1093     p_SetCoeff(lm, bn, bucket->bucket_ring);
     1095    p_SetCoeff(lm, bn, r);
    10941096    if ((ct == 0) || (ct == 2))
    10951097    {
     
    11001102
    11011103      /* correct factor for cancelation by changing sign if an=-1 */
    1102       if (rField_is_Ring())
    1103         lm = p_Mult_nn(lm, an, bucket->bucket_ring);
     1104      if (rField_is_Ring(r))
     1105        lm = p_Mult_nn(lm, an, r);
    11041106      else
    11051107        kBucket_Mult_n(bucket, an);
     
    11091111  else
    11101112  {
    1111     rn = nInit(1);
    1112   }
    1113 
    1114   if (p_GetComp(p1, bucket->bucket_ring) != p_GetComp(lm, bucket->bucket_ring))
    1115   {
    1116     p_SetCompP(a1, p_GetComp(lm, bucket->bucket_ring), bucket->bucket_ring);
     1113    rn = n_Init(1,r->cf);
     1114  }
     1115
     1116  if (p_GetComp(p1, r) != p_GetComp(lm, r))
     1117  {
     1118    p_SetCompP(a1, p_GetComp(lm, r), r);
    11171119    reset_vec = TRUE;
    1118     p_SetComp(lm, p_GetComp(p1, bucket->bucket_ring), bucket->bucket_ring);
    1119     p_Setm(lm, bucket->bucket_ring);
    1120   }
    1121 
    1122   p_ExpVectorSub(lm, p1, bucket->bucket_ring);
     1120    p_SetComp(lm, p_GetComp(p1, r), r);
     1121    p_Setm(lm, r);
     1122  }
     1123
     1124  p_ExpVectorSub(lm, p1, r);
    11231125  l1--;
    11241126
     
    11301132  if(l1==1) {
    11311133
    1132     //if (rField_is_Q(bucket->bucket_ring)) {
     1134    //if (rField_is_Q(r)) {
    11331135      //avoid this for function fields, as gcds are expensive at the moment
    11341136
    11351137
    1136       coef=p_GetCoeff(a1,bucket->bucket_ring);
    1137       lm=p_Mult_nn(lm, coef, bucket->bucket_ring);
    1138       p_SetCoeff0(a1, n_Init(1,bucket->bucket_ring), bucket->bucket_ring);
     1138      coef=p_GetCoeff(a1,r);
     1139      lm=p_Mult_nn(lm, coef, r);
     1140      p_SetCoeff0(a1, n_Init(1,r), r);
    11391141      backuped=TRUE;
    11401142      //WARNING: not thread_safe
     
    11471149
    11481150  if (backuped)
    1149     p_SetCoeff0(a1,coef,bucket->bucket_ring);
    1150   p_LmDelete(&lm, bucket->bucket_ring);
    1151   if (reset_vec) p_SetCompP(a1, 0, bucket->bucket_ring);
     1151    p_SetCoeff0(a1,coef,r);
     1152  p_LmDelete(&lm, r);
     1153  if (reset_vec) p_SetCompP(a1, 0, r);
    11521154  kbTest(bucket);
    11531155  return rn;
     
    11591161  if (r->parameter==NULL)
    11601162  {
    1161     return (r->cf->nSize(n)==1);
     1163    return (r->cf->cfSize(n,r->cf)==1);
    11621164  }
    11631165  //if (r->parameter!=NULL)
    1164   return ((n_IsOne(n,r)) || (n_IsMOne(n,r)));
     1166  return (n_IsOne(n,r->cf) || n_IsMOne(n,r->cf));
    11651167}
    11661168
Note: See TracChangeset for help on using the changeset viewer.