Changeset 206e158 in git


Ignore:
Timestamp:
May 11, 2007, 12:48:05 PM (16 years ago)
Author:
Oliver Wienand <wienand@…>
Branches:
(u'spielwiese', 'f6c3dc58b0df4bd712574325fe76d0626174ad97')
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
Location:
kernel
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • kernel/kbuckets.cc

    r3fd4df r206e158  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kbuckets.cc,v 1.32 2007-05-10 08:12:40 wienand Exp $ */
     4/* $Id: kbuckets.cc,v 1.33 2007-05-11 10:48:03 wienand Exp $ */
    55
    66#include "mod2.h"
     
    585585      if (i<coef_start)
    586586        bucket->buckets[i] = p_Mult_nn(bucket->buckets[i], n, r);
    587 #ifdef HAVE_RING2TOM
    588         if (r->cring == 1) {
     587#ifdef HAVE_RINGS
     588        if (rField_is_Ring(r) && !(rField_is_Domain(r))) {
    589589          bucket->buckets_length[i] = pLength(bucket->buckets[i]);
    590590          kBucketAdjust(bucket, i);
     
    610610      bucket->buckets[i] = p_Mult_nn(bucket->buckets[i], n, r);
    611611#ifdef HAVE_RINGS
    612       if (rField_is_Ring(currRing)) {
     612      if (rField_is_Ring(currRing) && !(rField_is_Domain(currRing))) {
    613613        bucket->buckets_length[i] = pLength(bucket->buckets[i]);
    614614        kBucketAdjust(bucket, i);
     
    740740    bucket->buckets_length[i] = 0;
    741741#ifdef HAVE_RINGS
    742     if (rField_is_Ring(currRing))
     742    if (rField_is_Ring(currRing) && !(rField_is_Domain(currRing)))
    743743    {
    744744      l1 = pLength(p1);
     
    760760      p1 = r->p_Procs->pp_Mult_mm(p1, m, r, last);
    761761#ifdef HAVE_RINGS
    762       if (rField_is_Ring(currRing))
     762      if (rField_is_Ring(currRing) && !(rField_is_Domain(currRing)))
    763763      {
    764764        l1 = pLength(p1);
  • kernel/kspoly.cc

    r3fd4df r206e158  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kspoly.cc,v 1.10 2007-05-10 08:12:40 wienand Exp $ */
     4/* $Id: kspoly.cc,v 1.11 2007-05-11 10:48:03 wienand Exp $ */
    55/*
    66*  ABSTRACT -  Routines for Spoly creation and reductions
     
    1414#include "p_Procs.h"
    1515#include "gring.h"
    16 #ifdef HAVE_RING2TOM
     16#ifdef HAVE_RINGS
    1717#include "polys.h"
    1818#endif
     
    214214    a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing,last);
    215215#ifdef HAVE_RINGS
    216   if (rField_is_Ring(currRing)) l2 = pLength(a2);
     216  if (rField_is_Ring(currRing) && !(rField_is_Domain(currRing))) l2 = pLength(a2);
    217217#endif
    218218
  • kernel/kstd1.cc

    r3fd4df r206e158  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd1.cc,v 1.19 2007-05-10 08:12:41 wienand Exp $ */
     4/* $Id: kstd1.cc,v 1.20 2007-05-11 10:48:03 wienand Exp $ */
    55/*
    66* ABSTRACT:
     
    10081008    strat->red = redHomog;
    10091009  }
    1010 #ifdef HAVE_RING2TOM
    1011   if (rField_is_Ring_2toM(currRing)) {
     1010#ifdef HAVE_RINGS  //TODO Oliver
     1011  if (rField_is_Ring(currRing)) {
    10121012    strat->red = redRing2toM;
    10131013  }
  • kernel/kstd2.cc

    r3fd4df r206e158  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.43 2007-05-10 08:12:41 wienand Exp $ */
     4/* $Id: kstd2.cc,v 1.44 2007-05-11 10:48:03 wienand Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    310310  return kFindZeroPoly(h->GetLmCurrRing(), currRing, h->tailRing);
    311311}
    312 
    313 #ifdef HAVE_RING2TOM
     312#endif
     313
     314
     315#ifdef HAVE_RINGS
    314316/*2
    315317*  reduction procedure for the ring Z/2^m
     
    338340  {
    339341#ifdef HAVE_VANGB
     342#ifdef HAVE_RING2TOM
    340343    zeroPoly = kFindDivisibleByZeroPoly(h);
    341344    if (zeroPoly != NULL)
     
    362365    else
    363366#endif
     367#endif
    364368    {
    365369      j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
     
    383387    ksReducePoly(h, &(strat->T[j]), NULL, NULL, strat);
    384388#ifdef HAVE_VANGB
     389#ifdef HAVE_RING2TOM
    385390    if (zeroPoly != NULL)
    386391    {
     
    388393      strat->tl--;
    389394    }
     395#endif
    390396#endif
    391397
     
    437443  }
    438444}
    439 #endif
    440445#endif
    441446
     
    10881093#ifdef KDEBUG
    10891094    loop_count++;
    1090 #ifdef HAVE_RING2TOM
     1095#ifdef HAVE_RINGS
    10911096    if (TEST_OPT_DEBUG) PrintS("--- next step ---\n");
    10921097#endif
     
    12141219      //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
    12151220        enterT(strat->P, strat);
    1216 #ifdef HAVE_RING2TOM
     1221#ifdef HAVE_RINGS
    12171222#ifdef HAVE_VANGB
    12181223      int at_R = strat->tl;
    12191224#endif
    1220       if (rField_is_Ring_2toM(currRing))
     1225      if (rField_is_Ring(currRing))
    12211226        superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
    12221227      else
  • 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),
  • kernel/kutil.h

    r3fd4df r206e158  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kutil.h,v 1.22 2007-03-29 11:34:52 Singular Exp $ */
     6/* $Id: kutil.h,v 1.23 2007-05-11 10:48:04 wienand Exp $ */
    77/*
    88* ABSTRACT: kernel: utils for kStd
     
    397397poly redNFTail (poly h,const int sl,kStrategy strat);
    398398int redHoney (LObject* h, kStrategy strat);
     399#ifdef HAVE_RINGS
     400int redRing2toM (LObject* h,kStrategy strat);
     401void enterExtendedSpoly(poly h,kStrategy strat);
     402void superenterpairs (poly h,int k,int ecart,int pos,kStrategy strat, int atR = -1);
     403poly kCreateZeroPoly(long exp[], long cabsind, poly* t_p, ring leadRing, ring tailRing);
     404#endif
    399405#ifdef HAVE_RING2TOM
    400 int redRing2toM (LObject* h,kStrategy strat);
    401406long ind2(long arg);
    402407long ind_fact_2(long arg);
    403408long twoPow(long arg);
    404 void enterExtendedSpoly(poly h,kStrategy strat);
    405 void superenterpairs (poly h,int k,int ecart,int pos,kStrategy strat, int atR = -1);
    406 poly kCreateZeroPoly(long exp[], long cabsind, poly* t_p, ring leadRing, ring tailRing);
    407409ideal createG0();
    408410#endif
     
    548550                 kStrategy strat = NULL);
    549551
    550 #ifdef HAVE_RING2TOM
     552#ifdef HAVE_RING2TOM_OLD
    551553// same for rings
    552554int ksRingReducePoly(LObject* PR,
  • kernel/numbers.cc

    r3fd4df r206e158  
    22*  Computer Algebra System SINGULAR      *
    33*****************************************/
    4 /* $Id: numbers.cc,v 1.8 2007-05-10 08:12:42 wienand Exp $ */
     4/* $Id: numbers.cc,v 1.9 2007-05-11 10:48:04 wienand Exp $ */
    55
    66/*
     
    4848#ifdef HAVE_RINGS
    4949BOOLEAN (*nDivBy)(number a,number b);
     50int     (*nComp)(number a,number b);
    5051#endif
    5152BOOLEAN (*nGreater)(number a,number b);
     
    105106#ifdef HAVE_RINGS
    106107BOOLEAN ndDivBy(number a, number b) { return TRUE; }
     108int ndComp(number a, number b) { return 0; }
    107109#endif
    108110
     
    181183  nCopy  = r->cf->nCopy;
    182184#ifdef HAVE_RINGS
     185  nComp  = r->cf->nComp;
    183186  nDivBy = r->cf->nDivBy;
    184187#endif
     
    262265  n->nLcm  = ndGcd; /* tricky, isn't it ?*/
    263266#ifdef HAVE_RINGS
     267  n->nComp = ndComp;
    264268  n->nDivBy = ndDivBy;
    265269#endif
     
    320324     n->nInvers= nr2mInvers;
    321325     n->nDivBy = nr2mDivBy;
     326     n->nComp = nr2mComp;
    322327     n->nGreater = nr2mGreater;
    323328     n->nEqual = nr2mEqual;
     
    357362     n->nInvers= nrnInvers;
    358363     n->nDivBy = nrnDivBy;
     364     n->nComp = nrnComp;
    359365     n->nGreater = nrnGreater;
    360366     n->nEqual = nrnEqual;
  • kernel/numbers.h

    r3fd4df r206e158  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: numbers.h,v 1.7 2007-05-10 08:12:42 wienand Exp $ */
     6/* $Id: numbers.h,v 1.8 2007-05-11 10:48:04 wienand Exp $ */
    77/*
    88* ABSTRACT: interface to coefficient aritmetics
     
    4747extern int     (*nSize)(number n);
    4848extern int     (*nInt)(number &n);
     49#ifdef HAVE_RINGS
     50extern int     (*nComp)(number a,number b);
     51#endif
    4952// always use in the form    n=nNeg(n) !
    5053extern number  (*nNeg)(number a);
  • kernel/polys.cc

    r3fd4df r206e158  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys.cc,v 1.16 2007-05-10 08:12:42 wienand Exp $ */
     4/* $Id: polys.cc,v 1.17 2007-05-11 10:48:04 wienand Exp $ */
    55
    66/*
     
    110110}
    111111
    112 #ifdef HAVE_RING2TOM
     112#ifdef HAVE_RINGS   //TODO Oliver
    113113#define pDiv_nn(p, n)              p_Div_nn(p, n, currRing)
    114114
  • kernel/polys.h

    r3fd4df r206e158  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys.h,v 1.9 2006-03-28 12:56:06 Singular Exp $ */
     6/* $Id: polys.h,v 1.10 2007-05-11 10:48:05 wienand Exp $ */
    77/*
    88* ABSTRACT - all basic methods to manipulate polynomials of the
     
    251251#define   pIsVector(p)      (pGetComp(p)>0)
    252252
    253 #ifdef HAVE_RING2TOM
     253#ifdef HAVE_RINGS
    254254/*
    255255 * Test stuff for dev OLIVER
  • kernel/ring.h

    r3fd4df r206e158  
    77* ABSTRACT - the interpreter related ring operations
    88*/
    9 /* $Id: ring.h,v 1.19 2007-05-10 08:12:43 wienand Exp $ */
     9/* $Id: ring.h,v 1.20 2007-05-11 10:48:05 wienand Exp $ */
    1010
    1111/* includes */
     
    101101#ifdef HAVE_RINGS
    102102inline BOOLEAN rField_is_Ring(ring r=currRing)
    103 { return (r->ringtype > 0); }
     103{ return (r->ringtype != 0); }
     104
     105inline BOOLEAN rField_is_Domain(ring r=currRing)
     106{ return (r->ringtype < 0); }
    104107#endif
    105108
  • kernel/ringgb.cc

    r3fd4df r206e158  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ringgb.cc,v 1.12 2006-06-12 00:35:13 wienand Exp $ */
     4/* $Id: ringgb.cc,v 1.13 2007-05-11 10:48:05 wienand Exp $ */
    55/*
    66* ABSTRACT: ringgb interface
     
    4949}
    5050
    51 /*
    52  * Find an index i from G, such that
    53  * LT(rside) = x * LT(G[i]) has a solution
    54  * or -1 if rside is not in the
    55  * ideal of the leading coefficients
    56  * of the suitable g from G.
    57  */
    58 int findRing2toMsolver(poly rside, ideal G, ring r) {
    59   if (rside == NULL) return -1;
    60   int i;
    61   int iO2rside = indexOf2(pGetCoeff(rside));
    62   for (i = 0; i < IDELEMS(G); i++) {
    63     if (indexOf2(pGetCoeff(G->m[i])) <= iO2rside && p_LmDivisibleBy(G->m[i], rside, r)) {
    64       return i;
    65     }
    66   }
    67   return -1;
    68 }
    69 
    7051/***************************************************************
    7152 *
     
    119100  PrintS(end);
    120101}
    121 
    122 poly plain_spoly(poly f, poly g) {
    123   number cf = pGetCoeff(f), cg = pGetCoeff(g);
    124   int ct = ksCheckCoeff(&cf, &cg); // gcd and zero divisors
    125   poly fm, gm;
    126   k_GetLeadTerms(f, g, currRing, fm, gm, currRing);
    127   pSetCoeff0(fm, cg);
    128   pSetCoeff0(gm, cf);  // and now, m1 * LT(p1) == m2 * LT(p2)
    129   poly sp = pSub(pMult_mm(f, fm), pMult_mm(g, gm));
    130   pDelete(&fm);
    131   pDelete(&gm);
    132   return(sp);
    133 }
    134 
    135102
    136103poly spolyRing2toM(poly f, poly g, ring r) {
     
    145112  pDelete(&m2);
    146113  return(sp);
    147 }
    148 
    149 poly ringNF(poly f, ideal G, ring r) {
    150   // If f = 0, then normal form is also 0
    151   if (f == NULL) { return NULL; }
    152   poly h = pCopy(f);
    153   int i = findRing2toMsolver(h, G, r);
    154   int c = 1;
    155   while (h != NULL && i >= 0) {
    156     // Print("%d-step NF - h:", c);
    157     // wrp(h);
    158     // PrintS(" ");
    159     // PrintS("G->m[i]:");
    160     // wrp(G->m[i]);
    161     // PrintLn();
    162     h = spolyRing2toM(h, G->m[i], r);
    163     // PrintS("=> h=");
    164     // wrp(h);
    165     // PrintLn();
    166     i = findRing2toMsolver(h, G, r);
    167     c++;
    168   }
    169   return h;
    170114}
    171115
     
    187131      pLmDelete(&g);
    188132    }
     133    c++;
     134  }
     135  return h;
     136}
     137
     138#endif
     139
     140#ifdef HAVE_RINGS
     141
     142/*
     143 * Find an index i from G, such that
     144 * LT(rside) = x * LT(G[i]) has a solution
     145 * or -1 if rside is not in the
     146 * ideal of the leading coefficients
     147 * of the suitable g from G.
     148 */
     149int findRingSolver(poly rside, ideal G, ring r) {
     150  if (rside == NULL) return -1;
     151  int i;
     152//  int iO2rside = indexOf2(pGetCoeff(rside));
     153  for (i = 0; i < IDELEMS(G); i++) {
     154    if // (indexOf2(pGetCoeff(G->m[i])) <= iO2rside &&    / should not be necessary any more
     155       (p_LmDivisibleBy(G->m[i], rside, r)) {
     156      return i;
     157    }
     158  }
     159  return -1;
     160}
     161
     162poly plain_spoly(poly f, poly g) {
     163  number cf = pGetCoeff(f), cg = pGetCoeff(g);
     164  int ct = ksCheckCoeff(&cf, &cg); // gcd and zero divisors
     165  poly fm, gm;
     166  k_GetLeadTerms(f, g, currRing, fm, gm, currRing);
     167  pSetCoeff0(fm, cg);
     168  pSetCoeff0(gm, cf);  // and now, m1 * LT(p1) == m2 * LT(p2)
     169  poly sp = pSub(pMult_mm(f, fm), pMult_mm(g, gm));
     170  pDelete(&fm);
     171  pDelete(&gm);
     172  return(sp);
     173}
     174
     175poly ringNF(poly f, ideal G, ring r) {
     176  // If f = 0, then normal form is also 0
     177  if (f == NULL) { return NULL; }
     178  poly h = pCopy(f);
     179  int i = findRingSolver(h, G, r);
     180  int c = 1;
     181  while (h != NULL && i >= 0) {
     182    Print("%d-step NF - h:", c);
     183    wrp(h);
     184    PrintS(" ");
     185    PrintS("G->m[i]:");
     186    wrp(G->m[i]);
     187    PrintLn();
     188    h = plain_spoly(h, G->m[i]);
     189    PrintS("=> h=");
     190    wrp(h);
     191    PrintLn();
     192    i = findRingSolver(h, G, r);
    189193    c++;
    190194  }
  • kernel/ringgb.h

    r3fd4df r206e158  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ringgb.h,v 1.5 2006-06-12 13:04:26 Singular Exp $ */
     4/* $Id: ringgb.h,v 1.6 2007-05-11 10:48:05 wienand Exp $ */
    55/*
    66* ABSTRACT: ringgb interface
     
    99#define RINGGB_HEADER
    1010#include "mod2.h"
    11 #ifdef HAVE_RING2TOM
     11
     12#ifdef HAVE_RINGS
    1213#include "polys.h"
    1314
    14 poly reduce_poly_fct(poly p, ring r);
    15 poly ringRedNF(poly f, ideal G, ring r);
    1615poly ringNF(poly f, ideal G, ring r);
    1716poly plain_spoly(poly f, poly g);
    1817int testGB(ideal I, ideal GI);
    1918
     19#ifdef HAVE_RING2TOM
     20poly reduce_poly_fct(poly p, ring r);
     21poly ringRedNF(poly f, ideal G, ring r);
     22#endif
     23
    2024#endif
    2125#endif
  • kernel/rmodulo2m.cc

    r3fd4df r206e158  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: rmodulo2m.cc,v 1.8 2007-05-10 08:12:43 wienand Exp $ */
     4/* $Id: rmodulo2m.cc,v 1.9 2007-05-11 10:48:05 wienand Exp $ */
    55/*
    66* ABSTRACT: numbers modulo 2^m
     
    7070    res++;
    7171  }
    72   if ((NATNUMBER) b % 2 == 0)
    73   {
    74     return (number) ((1L << res));// * (NATNUMBER) a);  // (2**res)*a    a ist Einheit
    75   }
    76   else
    77   {
     72//  if ((NATNUMBER) b % 2 == 0)
     73//  {
     74//    return (number) ((1L << res));// * (NATNUMBER) a);  // (2**res)*a    a ist Einheit
     75//  }
     76//  else
     77//  {
    7878    return (number) ((1L << res));// * (NATNUMBER) b);  // (2**res)*b    b ist Einheit
    79   }
     79//  }
    8080}
    8181
     
    163163}
    164164  return ((NATNUMBER) b % 2 == 1);
     165}
     166
     167int nr2mComp(number as, number bs)
     168{
     169  NATNUMBER a = (NATNUMBER) as;
     170  NATNUMBER b = (NATNUMBER) bs;
     171  assume(a != 0 && b != 0);
     172  while (a % 2 == 0 && b % 2 == 0)
     173  {
     174    a = a / 2;
     175    b = b / 2;
     176  }
     177  if (a % 2 == 0)
     178  {
     179    return -1;
     180  }
     181  else
     182  {
     183    if (b % 2 == 1)
     184    {
     185      return 0;
     186    }
     187    else
     188    {
     189      return 1;
     190    }
     191  }
    165192}
    166193
     
    271298  if ((NATNUMBER)a==0)
    272299  {
    273     return (number) 0;
    274   }
    275   else
    276   {
     300    if ((NATNUMBER)b==0)
     301      return (number) 1;
     302    return (number) (nr2mModul / (NATNUMBER) b);
     303  }
     304  else
     305  {
     306    if ((NATNUMBER)b==0)
     307      return (number) 0;
    277308    return (number) ((NATNUMBER) a / (NATNUMBER) b);
    278309  }
  • kernel/rmodulo2m.h

    r3fd4df r206e158  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: rmodulo2m.h,v 1.5 2007-05-10 08:12:43 wienand Exp $ */
     6/* $Id: rmodulo2m.h,v 1.6 2007-05-11 10:48:05 wienand Exp $ */
    77/*
    88* ABSTRACT: numbers modulo 2^m
     
    2525BOOLEAN nr2mIsMOne      (number a);
    2626number  nr2mDiv         (number a, number b);
    27 number   nr2mIntDiv      (number a,number b);
     27number  nr2mIntDiv      (number a,number b);
    2828number  nr2mNeg         (number c);
    2929number  nr2mInvers      (number c);
    3030BOOLEAN nr2mGreater     (number a, number b);
    3131BOOLEAN nr2mDivBy       (number a, number b);
     32int     nr2mComp        (number a, number b);
    3233BOOLEAN nr2mEqual       (number a, number b);
    33 number   nr2mLcm         (number a,number b, ring r);
    34 number   nr2mGcd         (number a,number b,ring r);
    35 nMapFunc nr2mSetMap(ring src, ring dst);
     34number  nr2mLcm         (number a,number b, ring r);
     35number  nr2mGcd         (number a,number b,ring r);
     36nMapFunc nr2mSetMap     (ring src, ring dst);
    3637void    nr2mWrite       (number &a);
    3738char *  nr2mRead        (char *s, number *a);
  • kernel/rmodulon.cc

    r3fd4df r206e158  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: rmodulon.cc,v 1.2 2007-05-10 08:12:43 wienand Exp $ */
     4/* $Id: rmodulon.cc,v 1.3 2007-05-11 10:48:05 wienand Exp $ */
    55/*
    66* ABSTRACT: numbers modulo n
     
    162162}
    163163
     164int nrnComp(number a, number b)
     165{
     166   NATNUMBER bs = XSGCD2((NATNUMBER) b, nrnModul);
     167   NATNUMBER as = XSGCD2((NATNUMBER) a, nrnModul);
     168   if (bs == as) return 0;
     169   if (as % bs == 0) return 1;
     170   return -1;
     171}
     172
    164173BOOLEAN nrnDivBy (number a,number b)
    165174{
     
    267276  if ((NATNUMBER)a==0)
    268277  {
    269     return (number) 0;
    270   }
    271   else
    272   {
     278    if ((NATNUMBER)b==0)
     279      return (number) 1;
     280    return (number) ( nrnModul / (NATNUMBER) b);
     281  }
     282  else
     283  {
     284    if ((NATNUMBER)b==0)
     285      return (number) 0;
    273286    return (number) ((NATNUMBER) a / (NATNUMBER) b);
    274287  }
  • kernel/rmodulon.h

    r3fd4df r206e158  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: rmodulon.h,v 1.2 2007-05-10 08:12:44 wienand Exp $ */
     6/* $Id: rmodulon.h,v 1.3 2007-05-11 10:48:05 wienand Exp $ */
    77/*
    88* ABSTRACT: numbers modulo n
     
    2929BOOLEAN nrnIsMOne      (number a);
    3030number  nrnDiv         (number a, number b);
    31 number   nrnIntDiv      (number a,number b);
     31number  nrnIntDiv      (number a,number b);
    3232number  nrnNeg         (number c);
    3333number  nrnInvers      (number c);
    3434BOOLEAN nrnGreater     (number a, number b);
    3535BOOLEAN nrnDivBy       (number a, number b);
     36int     nrnComp        (number a, number b);
    3637BOOLEAN nrnEqual       (number a, number b);
    37 number   nrnLcm         (number a,number b, ring r);
    38 number   nrnGcd         (number a,number b,ring r);
    39 nMapFunc nrnSetMap(ring src, ring dst);
     38number  nrnLcm         (number a,number b, ring r);
     39number  nrnGcd         (number a,number b,ring r);
     40nMapFunc nrnSetMap     (ring src, ring dst);
    4041void    nrnWrite       (number &a);
    4142char *  nrnRead        (char *s, number *a);
  • kernel/structs.h

    r3fd4df r206e158  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: structs.h,v 1.37 2007-05-10 08:12:44 wienand Exp $ */
     6/* $Id: structs.h,v 1.38 2007-05-11 10:48:05 wienand Exp $ */
    77/*
    88* ABSTRACT
     
    271271   int     (*nSize)(number n);
    272272   int     (*nInt)(number &n);
     273#ifdef HAVE_RINGS
     274   int     (*nComp)(number a,number b);
     275#endif
    273276   number  (*nNeg)(number a);
    274277   number  (*nInvers)(number a);
Note: See TracChangeset for help on using the changeset viewer.