Changeset 206e158 in git for kernel/kutil.cc


Ignore:
Timestamp:
May 11, 2007, 12:48:05 PM (17 years ago)
Author:
Oliver Wienand <wienand@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
d15996cd44ce997d3360fac629f4062adb1c4836
Parents:
3fd4df896525da08d34f33e88e6239994fa4d0e6
Message:
structs.h, numbers.*, rmodulo*:
new method nComp
nIntDiv(0, a) = module / a in rmodulo

ringgb.*:
adapted for more generic rings

ring.h:
rField_is_Domain new

k*:
adapted for gbs over Z/m


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

Legend:

Unmodified
Added
Removed
  • kernel/kutil.cc

    r3fd4df r206e158  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kutil.cc,v 1.52 2007-05-10 08:12:41 wienand Exp $ */
     4/* $Id: kutil.cc,v 1.53 2007-05-11 10:48:04 wienand Exp $ */
    55/*
    66* ABSTRACT: kernel: utils for kStd
     
    104104static poly redBba (poly h,int maxIndex,kStrategy strat);
    105105
    106 #ifdef HAVE_RING2TOM
     106#ifdef HAVE_RINGS
    107107#define pDivComp_EQUAL 2
    108108#define pDivComp_LESS 1
     
    130130        if (la < lb)
    131131        {
    132           if (b) return 0;
     132          if (b) return pDivComp_INCOMP;
    133133          if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
    134             return 0;
     134            return pDivComp_INCOMP;
    135135          a = TRUE;
    136136        }
    137137        else
    138138        {
    139           if (a) return 0;
     139          if (a) return pDivComp_INCOMP;
    140140          if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
    141             return 0;
     141            return pDivComp_INCOMP;
    142142          b = TRUE;
    143143        }
    144144      }
    145145    }
    146     if (a) return 1;
    147     if (b) return -1;
     146    if (a) return pDivComp_LESS;
     147    if (b) return pDivComp_GREATER;
    148148    if (!a & !b) return pDivComp_EQUAL;
    149149  }
     
    492492}
    493493
    494 #ifdef HAVE_RING2TOM
    495 //void initLMtest(kStrategy strat)
    496 //{
    497 //  strat->lmtest = (unsigned int *)omAlloc0((strat->sl*strat->sl/2+2)*sizeof(BOOLEAN));
    498 //}
    499 #endif
    500 
    501494/*2
    502495*test whether (p1,p2) or (p2,p1) is in L up position length
     
    10221015}
    10231016
    1024 #ifdef HAVE_RING2TOM
    1025 /* TODO move to numbers.cc
    1026  */
    1027 inline int nComp(NATNUMBER a, NATNUMBER b)
    1028 {
    1029   assume(a != 0 && b != 0);
    1030   while (a % 2 == 0 && b % 2 == 0)
    1031   {
    1032     a = a / 2;
    1033     b = b / 2;
    1034   }
    1035   if (a % 2 == 0)
    1036   {
    1037     return -1;
    1038   }
    1039   else
    1040   {
    1041     if (b % 2 == 1)
    1042     {
    1043       return 0;
    1044     }
    1045     else
    1046     {
    1047       return 1;
    1048     }
    1049   }
    1050 }
    1051 
     1017#ifdef HAVE_RINGS
    10521018/*2
    10531019* put the pair (s[i],p)  into the set B, ecart=ecart(p) (ring case)
     
    10881054  {
    10891055    compare=pDivCompRing(strat->B[j].lcm,Lp.lcm);
    1090     compareCoeff = nComp((long) pGetCoeff(strat->B[j].lcm), (long) pGetCoeff(Lp.lcm));
     1056    compareCoeff = nComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(Lp.lcm));
    10911057    if (compareCoeff == 0 || compare == compareCoeff)
    10921058    {
     
    11111077    {
    11121078      // Add hint for same LM and direction of LC (later) (TODO Oliver)
    1113       if (compareCoeff == 1)
     1079      if (compareCoeff == pDivComp_LESS)
    11141080      {
    11151081        strat->c3++;
     
    11221088      }
    11231089      else
    1124       if (compareCoeff == -1)
     1090      if (compareCoeff == pDivComp_GREATER)
    11251091      {
    11261092        deleteInL(strat->B,&strat->Bl,j,strat);
     
    18081774}
    18091775
    1810 #ifdef HAVE_RING2TOM
     1776#ifdef HAVE_RINGS
    18111777/*2
    18121778*the pairset B of pairs of type (s[i],p) is complete now. It will be updated
     
    19361902  }
    19371903}
    1938 
     1904#endif
     1905
     1906#ifdef HAVE_RING2TOM
    19391907long twoPow(long arg)
    19401908{
     
    19961964  {
    19971965    compare=pDivCompRing(strat->B[j].lcm,Lp.lcm);
    1998     compareCoeff = nComp((long) pGetCoeff(strat->B[j].lcm), (long) pGetCoeff(Lp.lcm));
     1966    compareCoeff = nComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(Lp.lcm));
    19991967    if (compareCoeff == 0 || compare == compareCoeff)
    20001968    {
     
    23432311  idSkipZeroes(G0);
    23442312  return G0;
    2345 }
    2346 
     2313}   
     2314#endif
     2315
     2316#ifdef HAVE_RINGS
    23472317/*2
    23482318*(s[0],h),...,(s[k],h) will be put to the pairset L
     
    24132383void enterExtendedSpoly(poly h,kStrategy strat)
    24142384{
    2415   if (((long) ((h)->coef)) % 2 == 0)
    2416   {
    2417     long a = ((long) ((h)->coef)) / 2;
     2385  number gcd = nGcd((number) 0, pGetCoeff(h), strat->tailRing);
     2386  if ((NATNUMBER) gcd > 1)
     2387  {
     2388    poly p = p_Copy(h->next, strat->tailRing);
     2389/*    long a = ((long) ((h)->coef)) / 2;
    24182390    long b = currRing->ch - 1;
    2419     poly p = p_Copy(h->next, strat->tailRing);
    24202391    while (a % 2 == 0)
    24212392    {
     
    24232394      b--;
    24242395    }
    2425     p = p_Mult_nn(p, (number) twoPow(b), strat->tailRing);
     2396    p = p_Mult_nn(p, (number) twoPow(b), strat->tailRing); */
     2397    p = p_Mult_nn(p, nIntDiv(0, gcd), strat->tailRing);
    24262398
    24272399    if (p != NULL)
     
    26652637  else
    26662638  {
    2667 #ifdef HAVE_RING2TOM
    2668     if (rField_is_Ring_2toM(currRing))
     2639#ifdef HAVE_RINGS
     2640    if (rField_is_Ring(currRing))
    26692641    {
    26702642      if (pLmCmp(set[length],p)== -cmp_int)
     
    51665138  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
    51675139    strat->posInT = posInT1;
    5168 #ifdef HAVE_RING2TOM
     5140#ifdef HAVE_RINGS
    51695141  if (rField_is_Ring(currRing))
    51705142  {
     
    54965468                                  // might be too strong
    54975469#ifdef HAVE_RINGS
    5498                                   (strat->homog && pFDeg == pDeg && rField_is_Ring(currRing)), // TODO Oliver
     5470                                  (strat->homog && pFDeg == pDeg && !(rField_is_Ring(currRing))), // TODO Oliver
    54995471#else
    55005472                                  (strat->homog && pFDeg == pDeg),
Note: See TracChangeset for help on using the changeset viewer.