Changeset 69bc59 in git for kernel/ringgb.cc


Ignore:
Timestamp:
Jun 8, 2006, 11:56:54 PM (17 years ago)
Author:
Oliver Wienand <wienand@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
8e4858985c8a175c0ae6f5422cd1c577e587236d
Parents:
728a2c96465e8ac52df53f624fc9319cc328b4e0
Message:
[oliver]

ringgb.*:
* routines for testing of GB


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

Legend:

Unmodified
Added
Removed
  • kernel/ringgb.cc

    r728a2c r69bc59  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ringgb.cc,v 1.7 2006-06-08 18:00:35 wienand Exp $ */
     4/* $Id: ringgb.cc,v 1.8 2006-06-08 21:56:54 wienand Exp $ */
    55/*
    66* ABSTRACT: ringgb interface
     
    120120}
    121121
     122poly 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  return(pSub(pMult_mm(f, fm), pMult_mm(g, gm)));
     130}
     131
     132
    122133poly spolyRing2toM(poly f, poly g, ring r) {
    123134  poly m1 = NULL;
     
    127138  // printPolyMsg("m2=", m2, "");
    128139  // PrintLn();
    129   return pSub(pp_Mult_mm(f, m1, r), pp_Mult_mm(g, m2, r));
     140  return pSub(p_Mult_mm(f, m1, r), p_Mult_mm(g, m2, r));
    130141}
    131142
     
    143154    // wrp(G->m[i]);
    144155    // PrintLn();
    145     h = spolyRing2toM(h, G->m[i], r);
     156    h = spolyRing2toM(h, pCopy(G->m[i]), r);
    146157    // PrintS("=> h=");
    147158    // wrp(h);
     
    174185  return h;
    175186}
     187
     188int testGB(ideal GI) {
     189  poly f, g, h;
     190  int i = 0;
     191  int j = 0;
     192  for (i = 0; i < IDELEMS(GI) - 1; i++) {
     193    for (j = i + 1; j < IDELEMS(GI); j++) {
     194      f = pCopy(GI->m[i]);
     195      g = pCopy(GI->m[j]);
     196      h = plain_spoly(f, g);
     197      if (ringNF(h, GI, currRing) != NULL) {
     198        wrp(GI->m[i]);
     199        PrintLn();
     200        wrp(GI->m[j]);
     201        PrintLn();
     202        wrp(h);
     203        PrintLn();
     204        wrp(ringNF(h, GI, currRing));
     205        PrintLn();
     206        return(0);
     207      }
     208      pDelete(&h);
     209    }
     210  }
     211  return(1);
     212}
     213
    176214#endif
Note: See TracChangeset for help on using the changeset viewer.