Changeset 7ba059 in git


Ignore:
Timestamp:
Jul 24, 2007, 2:29:31 PM (17 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
1dc959316eac2288bfe64889d2e83ce1d387c029
Parents:
2f0941897d4f1406c4c4e8071399248a0e0b6e1c
Message:
*hannes: NF, pSize, normalize etc.


git-svn-id: file:///usr/local/Singular/svn/trunk@10241 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • kernel/kstd1.cc

    r2f0941 r7ba059  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd1.cc,v 1.23 2007-07-23 14:41:33 motsak Exp $ */
     4/* $Id: kstd1.cc,v 1.24 2007-07-24 12:29:30 Singular Exp $ */
    55/*
    66* ABSTRACT:
     
    2929//#include "../Singular/ipid.h"
    3030#include "timer.h"
    31 
    32 #ifdef HAVE_PLURAL
    33 #include "sca.h"
    34 #endif
    3531
    3632//#include "ipprint.h"
     
    21242120#else
    21252121// old version
    2126 
    2127 // NOTE: be carefull with Q in non-commutative case
    2128 // and with F in SCA case!
    21292122ideal kInterRed (ideal F, ideal Q)
    21302123{
    2131 #ifndef NDEBUG
    2132   idTest(F);
    2133   idTest(Q); 
    2134 #endif
    2135 
    21362124  int j;
    21372125  kStrategy strat = new skStrategy;
    21382126
    2139 
    2140   ideal tempF = F;
    2141   const ideal tempQ = Q;
    2142 
    2143 #ifdef HAVE_PLURAL
    2144   if(rIsSCA(currRing))
    2145   {
    2146 
    2147     const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
    2148     const unsigned int m_iLastAltVar  = scaLastAltVar(currRing);
    2149     tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
    2150 
    2151     // this should be done on the upper level!!! :
    2152     //    tempQ = currRing->nc->SCAQuotient();
    2153   }
    2154 #endif
    2155  
    2156 //  assume(!rIsSCA(currRing));
    2157  
    21582127//  if (TEST_OPT_PROT)
    21592128//  {
     
    21642133  strat->kHEdgeFound = ppNoether != NULL;
    21652134  strat->kNoether=pCopy(ppNoether);
    2166   strat->ak = idRankFreeModule(tempF);
     2135  strat->ak = idRankFreeModule(F);
    21672136  initBuchMoraCrit(strat);
    21682137  strat->NotUsedAxis = (BOOLEAN *)omAlloc((pVariables+1)*sizeof(BOOLEAN));
     
    21782147  strat->sevT        = initsevT();
    21792148  if (pOrdSgn == -1)   strat->honey = TRUE;
    2180 
    2181  
    2182   initS(tempF,tempQ,strat);
    2183  
     2149  initS(F,Q,strat);
    21842150  if (TEST_OPT_REDSB)
    21852151    strat->noTailReduction=FALSE;
     
    22202186  }
    22212187  delete(strat);
    2222 
    2223   if( F != tempF )
    2224   {
    2225     id_Delete( &tempF, currRing);
    2226   }
    2227  
    22282188  return shdl;
    22292189}
  • kernel/kstd2.cc

    r2f0941 r7ba059  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.49 2007-07-24 11:20:32 Singular Exp $ */
     4/* $Id: kstd2.cc,v 1.50 2007-07-24 12:29:30 Singular Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    101101#endif
    102102  (*max_ind)=ende;
     103  loop
     104  {
     105    if (j > ende) return -1;
     106#if defined(PDEBUG) || defined(PDIV_DEBUG)
     107    if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
     108                             p, not_sev, currRing))
     109        return j;
     110#else
     111    if ( !(strat->sevS[j] & not_sev) &&
     112         p_LmDivisibleBy(strat->S[j], p, currRing))
     113      return j;
     114#endif
     115    j++;
     116  }
     117}
     118
     119int kFindNextDivisibleByInS(const kStrategy strat, int start,int max_ind, LObject* L)
     120{
     121  unsigned long not_sev = ~L->sev;
     122  poly p = L->GetLmCurrRing();
     123  int j = start;
     124
     125  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
     126#if 1
     127  int ende=max_ind;
     128#else
     129  int ende=strat->sl;
     130#endif
    103131  loop
    104132  {
     
    9951023    if (j>=0)
    9961024    {
     1025      int sl=pSize(strat->S[j]);
     1026      int jj;
     1027      loop
     1028      {
     1029        int sll;
     1030        jj=kFindNextDivisibleByInS(strat,j+1,max_ind,&P);
     1031        if (jj<0) break;
     1032        sll=pSize(strat->S[jj]);
     1033        if (sll<sl)
     1034        {
     1035          j=jj;
     1036          sl=sll;
     1037        }
     1038      }
    9971039      if (!nIsOne(pGetCoeff(strat->S[j])))
    9981040      {
    999          pNorm(strat->S[j]);
    1000          //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
     1041        pNorm(strat->S[j]);
     1042        //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
    10011043      }
    10021044      nNormalize(pGetCoeff(P.p));
     
    16161658      if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
    16171659      {
    1618         strat->enterS(strat->P, pos, strat, strat->tl);
     1660        strat->enterS(strat->P, pos, strat, strat->tl);
    16191661      }
    16201662      else
  • kernel/kutil.h

    r2f0941 r7ba059  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kutil.h,v 1.26 2007-07-24 11:20:32 Singular Exp $ */
     6/* $Id: kutil.h,v 1.27 2007-07-24 12:29:31 Singular Exp $ */
    77/*
    88* ABSTRACT: kernel: utils for kStd
     
    451451int kFindDivisibleByInS(const kStrategy strat, int *max_ind, LObject* L);
    452452
     453int kFindNextDivisibleByInS(const kStrategy strat, int start,int max_ind, LObject* L);
    453454TObject*
    454455kFindDivisibleByInS(kStrategy strat, int pos, LObject* L, TObject *T,
  • kernel/longalg.cc

    r2f0941 r7ba059  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longalg.cc,v 1.28 2007-07-03 14:45:56 Singular Exp $ */
     4/* $Id: longalg.cc,v 1.29 2007-07-24 12:29:31 Singular Exp $ */
    55/*
    66* ABSTRACT:   algebraic numbers
     
    17171717void naNormalize(number &pp)
    17181718{
    1719 
    17201719  //naTest(pp); // input may not be "normal"
    17211720  lnumber p = (lnumber)pp;
     
    17261725  napoly x = p->z;
    17271726  napoly y = p->n;
    1728   if ((y!=NULL) && (naMinimalPoly!=NULL))
    1729   {
    1730     y = napInvers(y, naMinimalPoly);
    1731     x = napMult(x, y);
    1732     if (napGetExp(x,1) >= napGetExp(naMinimalPoly,1))
     1727  if (naMinimalPoly!=NULL)
     1728  {
     1729    if (y!=NULL)
     1730    {
     1731      y = napInvers(y, naMinimalPoly);
     1732      x = napMult(x, y);
     1733      if (napGetExp(x,1) >= napGetExp(naMinimalPoly,1))
     1734        x = napRemainder(x, naMinimalPoly);
     1735      p->z = x;
     1736      p->n = y = NULL;
     1737    }
     1738    /* check for degree of x too high: */
     1739    if ((x!=NULL) && (x!=naMinimalPoly)
     1740    && (napGetExp(x,1)>napGetExp(naMinimalPoly,1)))
     1741    // DO NOT REDUCE naMinimalPoly with itself
     1742    {
    17331743      x = napRemainder(x, naMinimalPoly);
    1734     p->z = x;
    1735     p->n = y = NULL;
    1736   }
    1737   /* check for degree of x too high: */
    1738   if ((x!=NULL) && (naMinimalPoly!=NULL) && (x!=naMinimalPoly)
    1739   && (napGetExp(x,1)>napGetExp(naMinimalPoly,1)))
    1740   // DO NOT REDUCE naMinimalPoly with itself
    1741   {
    1742     x = napRemainder(x, naMinimalPoly);
    1743     p->z = x;
     1744      p->z = x;
     1745    }
    17441746  }
    17451747  /* normalize all coefficients in n and z (if in Q) */
     
    18811883      if (nacIsOne(napGetCoeff(y)))
    18821884      {
    1883         if (napGetExp(y,1)==0)
     1885        if (napIsConstant(y))
    18841886        {
    18851887          napDelete1(&y);
     
    19051907      napDelete(&x);
    19061908      napDelete(&y);
     1909      x=xx;
     1910      y=yy;
     1911      if (napNext(y)==NULL)
     1912      {
     1913        if(!nacGreaterZero(napGetCoeff(y)))
     1914        {
     1915          x=napNeg(x);
     1916          y=napNeg(y);
     1917        }
     1918        if (nacIsOne(napGetCoeff(y)))
     1919        {
     1920          if (napIsConstant(y))
     1921          {
     1922            napDelete1(&y);
     1923            p->n = NULL;
     1924          }
     1925          naTest(pp);
     1926          return;
     1927        }
     1928      }
    19071929    }
    19081930  }
  • kernel/polys.cc

    r2f0941 r7ba059  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys.cc,v 1.25 2007-07-23 14:11:04 motsak Exp $ */
     4/* $Id: polys.cc,v 1.26 2007-07-24 12:29:31 Singular Exp $ */
    55
    66/*
     
    765765      {
    766766        c=nDiv(pGetCoeff(h),k);
    767         if (!nIsOne(c)) nNormalize(c);
     767        // no need to normalize: Z/p, R
     768        // normalize already in nDiv: Q_a, Z/p_a
     769        // remains: Q
     770        if (rField_is_Q() && (!nIsOne(c))) nNormalize(c);
    768771        pSetCoeff(h,c);
    769772        pIter(h);
     
    10381041  return FALSE;
    10391042}
     1043
     1044int pSize(poly p)
     1045{
     1046  int count = 0;
     1047  while ( p != NULL )
     1048  {
     1049    count+= nSize( pGetCoeff( p ) );
     1050    pIter( p );
     1051  }
     1052  return count;
     1053}
     1054
  • kernel/polys.h

    r2f0941 r7ba059  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys.h,v 1.11 2007-06-20 09:39:24 wienand Exp $ */
     6/* $Id: polys.h,v 1.12 2007-07-24 12:29:31 Singular Exp $ */
    77/*
    88* ABSTRACT - all basic methods to manipulate polynomials of the
     
    373373void      p_Normalize(poly p, ring r);
    374374#define   pNormalize(p) p_Normalize(p,currRing)
     375int       pSize( poly p );
     376
    375377
    376378// homogenizes p by multiplying certain powers of the varnum-th variable
Note: See TracChangeset for help on using the changeset viewer.