Changeset 7f06cca in git for kernel/kstd2.cc


Ignore:
Timestamp:
Jan 20, 2006, 2:15:07 AM (18 years ago)
Author:
Oliver Wienand <wienand@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
a725daea0d4b710813033cd5906ef1c1f3437cd3
Parents:
3a123804ad0304c10b9c827a9fd2fa92a12fcd36
Message:
kutil.cc:
--> no criterions for coeff rings

kstd2.cc:
--> complete zero reduction
--> no zero reduction during std


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

Legend:

Unmodified
Added
Removed
  • kernel/kstd2.cc

    r3a1238 r7f06cca  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.7 2006-01-16 14:02:51 Singular Exp $ */
     4/* $Id: kstd2.cc,v 1.8 2006-01-20 01:15:07 wienand Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    164164*/
    165165
     166long twoPow(long arg) {
     167  long t = arg;
     168  long result = 1;
     169  while (t > 0) {
     170    result = 2 * result;
     171    t--;
     172  }
     173  return result;
     174}
     175
    166176long factorial(long arg)
    167177{
     
    194204  }
    195205
    196   for (int i = 1; i <= leadRing->N; i++)
    197   {
    198     a = factorial(pGetExp(p, i));
     206  for (int i = 1; i <= leadRing->N; i++) 
     207  {
     208    a = factorial(p_GetExp(p, i, leadRing));
    199209    k = k * a;
    200210    while (a%2 == 0)
     
    213223    for (int i = 1; i <= leadRing->N; i++)
    214224    {
    215       for (long j = 1; j <= pGetExp(p, i); j++)
     225      for (long j = 1; j <= p_GetExp(p, i,leadRing); j++)
    216226      {
    217227        tmp1 = nInit(j);
     
    230240      }
    231241    }
     242    tmp2 = p_ISet((long) pGetCoeff(zeroPoly), leadRing);
     243    for (int i = 1; i <= leadRing->N; i++) {
     244      pSetExp(tmp2, i, p_GetExp(zeroPoly, i, leadRing));
     245    }
     246    p_Setm(tmp2, leadRing);
    232247    zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
    233     tmp2 = pISet(a);
    234     for (int i = 1; i <= leadRing->N; i++)
    235     {
    236       pSetExp(tmp2, i, pGetExp(p, i));
    237     }
    238     pSetm(tmp2);
    239248    pNext(tmp2) = zeroPoly;
    240249    return tmp2;
    241250  }
    242   if (leadRing->ch - k_ind2 <= a_ind2)
    243   {
    244     PrintS("Case not implented yet !!!\n");
    245     PrintS("But it should not mae any difference.\n");
    246     return zeroPoly;
     251  long alpha_k = twoPow(leadRing->ch - k_ind2);
     252  if (alpha_k <= a) {
     253    zeroPoly = p_ISet((a / alpha_k)*alpha_k, tailRing);
     254    for (int i = 1; i <= leadRing->N; i++) {
     255      for (long j = 1; j <= p_GetExp(p, i, leadRing); j++) {
     256        tmp1 = nInit(j);
     257        tmp2 = p_ISet(1, tailRing);
     258        p_SetExp(tmp2, i, 1, tailRing);
     259        p_Setm(tmp2, tailRing);
     260        if (nIsZero(tmp1)) {
     261          zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
     262        }
     263        else {
     264          tmp3 = p_ISet((long) tmp1, tailRing);
     265          zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp2, tmp3, tailRing), tailRing);
     266        }
     267      }
     268    }
     269    tmp2 = p_ISet((long) pGetCoeff(zeroPoly), leadRing);
     270    for (int i = 1; i <= leadRing->N; i++) {
     271      pSetExp(tmp2, i, p_GetExp(zeroPoly, i, leadRing));
     272    }
     273    p_Setm(tmp2, leadRing);
     274    zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
     275    pNext(tmp2) = zeroPoly;
     276    return tmp2;
    247277  }
    248278  return NULL;
     
    284314  loop
    285315  {
    286     zeroPoly = kFindDivisibleByZeroPoly(h);
     316    zeroPoly = NULL;// kFindDivisibleByZeroPoly(h);
    287317    if (zeroPoly != NULL)
    288318    {
Note: See TracChangeset for help on using the changeset viewer.