Changeset f92547 in git for kernel/kspoly.cc


Ignore:
Timestamp:
Mar 20, 2006, 9:33:57 PM (17 years ago)
Author:
Oliver Wienand <wienand@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
9a7b03d261325d1fc155f5625fe1867b6ef6432c
Parents:
f7cbb7696d6c24ac0b31ebc09c768d0a3df1a7a9
Message:
*oliver

kspoly.cc:
--> kscheckcoef
      * modified for zero divisors
--> ksCreateShortSPoly
      * create correct short s poly for rings
      * in case of rings, also calculate coeff

kstd2.cc:
--> bba
      * use different enterpairs method in case of rings
      * small changes (replaced p_ISet by p_NSet)

kutil.cc, kutil.h:
--> new enterpairs derivate, also downstreams are
     new derivates of functions
--> function to create extended s poly for rings
--> nComp fct, will be nGreater later, maybe
--> stub for chainCritRing

polys.cc:
--> chainCrit correct for rings, but not optimized

numbers.cc, rmodulo2m.cc, rmodulo2m.h:
--> gcd, ncd for zero divisor (att, not really a gcd or ncd)
--> IntDiv (att, just takes a machine div, allows to divide by zero div)
--> Greater (att, compares zero divisor exponent)


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

Legend:

Unmodified
Added
Removed
  • kernel/kspoly.cc

    rf7cbb7 rf92547  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kspoly.cc,v 1.3 2006-01-13 18:10:04 wienand Exp $ */
     4/* $Id: kspoly.cc,v 1.4 2006-03-20 20:33:56 wienand Exp $ */
    55/*
    66*  ABSTRACT -  Routines for Spoly creation and reductions
     
    1414#include "p_Procs.h"
    1515#include "gring.h"
     16#ifdef HAVE_RING2TOM
     17#include "polys.h"
     18#endif
    1619
    1720#ifdef KDEBUG
     
    312315    bn = nIntDiv(bn, cn);
    313316  }
    314 #ifdef HAVE_RING2TOM
    315   if (currRing->cring == 1) {
    316     while (((long) an)%2 == 0 && ((long) bn)%2 == 0) {
    317       an = (number) (((long) an) / 2);
    318       bn = (number) (((long) bn) / 2);
    319     }
    320   }
    321 #endif
    322317  nDelete(&cn);
    323318  if (nIsOne(an))
     
    339334* remarks:
    340335*   1. the coefficient is 0 (nNew)
     336*   1. a) in the case of coefficient ring, the coefficient is calculated
    341337*   2. pNext is undefined
    342338*/
     
    352348  BOOLEAN equal;
    353349
     350#ifdef HAVE_RING2TOM
     351  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
     352  int ct = ksCheckCoeff(&lc1, &lc2); // gcd and zero divisors
     353  if (currRing->cring == 1)
     354  {
     355    if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
     356    if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
     357    while (a1 != NULL && nIsZero(t2))
     358    {
     359      pIter(a1);
     360      if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
     361    }
     362    while (a2 != NULL && nIsZero(t1))
     363    {
     364      pIter(a2);
     365      if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
     366    }
     367  }
     368#endif
     369
    354370  if (a1==NULL)
    355371  {
     
    379395      }
    380396      p_Setm(m2, currRing);
    381       nNew(&(pGetCoeff(m2)));
     397#ifdef HAVE_RING2TOM
     398      if (currRing->cring == 1)
     399          pSetCoeff(m2, t1);
     400      else
     401#endif
     402        nNew(&(pGetCoeff(m2)));
    382403      return m2;
    383404    }
     
    410431    }
    411432    p_Setm(m1, currRing);
    412     nNew(&(pGetCoeff(m1)));
     433#ifdef HAVE_RING2TOM
     434    if (currRing->cring == 1)
     435        pSetCoeff(m1, t2);
     436    else
     437#endif
     438      nNew(&(pGetCoeff(m1)));
    413439    return m1;
    414440  }
     
    467493      }
    468494    }
    469     t1 = nMult(pGetCoeff(a2),pGetCoeff(p1));
    470     t2 = nMult(pGetCoeff(a1),pGetCoeff(p2));
    471     equal = nEqual(t1,t2);
    472     nDelete(&t2);
    473     nDelete(&t1);
     495#ifdef HAVE_RING2TOM
     496    if (currRing->cring == 1)
     497    {
     498      t1 = nAdd(t1, t2);
     499      equal = nIsZero(t1);
     500      nDelete(&t2);
     501    }
     502    else
     503#endif
     504    {
     505      t1 = nMult(pGetCoeff(a2),pGetCoeff(p1));
     506      t2 = nMult(pGetCoeff(a1),pGetCoeff(p2));
     507      equal = nEqual(t1,t2);
     508      nDelete(&t2);
     509      nDelete(&t1);
     510    }
    474511    if (!equal)
    475512    {
    476513      p_LmFree(m2,currRing);
    477       nNew(&(pGetCoeff(m1)));
     514#ifdef HAVE_RING2TOM
     515      if (currRing->cring == 1)
     516          pSetCoeff(m1, t1);
     517      else
     518#endif
     519        nNew(&(pGetCoeff(m1)));
    478520      return m1;
    479521    }
    480522    pIter(a1);
    481523    pIter(a2);
     524#ifdef HAVE_RING2TOM
     525    if (currRing->cring == 1)
     526    {
     527      nDelete(&t1);
     528      if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
     529      if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
     530      while (a1 != NULL && nIsZero(t2))
     531      {
     532        pIter(a1);
     533        if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
     534      }
     535      while (a2 != NULL && nIsZero(t1))
     536      {
     537        pIter(a2);
     538        if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
     539      }
     540    }
     541#endif
    482542    if (a2==NULL)
    483543    {
Note: See TracChangeset for help on using the changeset viewer.