Changeset 07f20e1 in git for Singular/clapsing.cc


Ignore:
Timestamp:
Jun 14, 1999, 6:25:42 PM (24 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
05bcd531ee2a91c26af99c19808959dac564df67
Parents:
74fe50d0de12691ddaa37a4a8527e5e220253ab8
Message:
fixed dectection of constants


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

Legend:

Unmodified
Added
Removed
  • Singular/clapsing.cc

    r74fe50d r07f20e1  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapsing.cc,v 1.50 1999-04-17 14:58:38 obachman Exp $
     5// $Id: clapsing.cc,v 1.51 1999-06-14 16:25:42 Singular Exp $
    66/*
    77* ABSTRACT: interface between Singular and factory
     
    204204  else         return pCopy(f); // g==0 => gcd=f (but do a pCleardenom)
    205205  if (f==NULL) return pCopy(g); // f==0 => gcd=g (but do a pCleardenom)
    206  
     206
    207207  // for now there is only the possibility to handle polynomials over
    208208  // Q and Fp ...
     
    618618}
    619619
     620static int primepower(int c)
     621{
     622  int p=1;
     623  int cc=c;
     624  while(cc!= rInternalChar(currRing)) { cc*=c; p++; }
     625  return p;
     626}
     627
    620628ideal singclap_factorize ( poly f, intvec ** v , int with_exps)
    621629{
     
    641649  number NN=NULL;
    642650
    643   if (( (nGetChar() == 0) || (nGetChar() > 1) )
    644   && (currRing->parameter==NULL))
     651  if (rField_is_Q() || rField_is_Zp())
    645652  {
    646653    setCharacteristic( nGetChar() );
     
    676683    }
    677684  }
     685  else if (rField_is_GF())
     686  {
     687    int c=rChar(currRing);
     688    setCharacteristic( c, primepower(c) );
     689    CanonicalForm F( convSingGFClapGF( f ) );
     690    if (F.isUnivariate())
     691    {
     692      L = factorize( F );
     693    }
     694    else
     695    {
     696      goto notImpl;
     697    }
     698  }
    678699  // and over Q(a) / Fp(a)
    679   else if (( nGetChar()==1 ) /* Q(a) */
    680   || (nGetChar() <-1))       /* Fp(a) */
     700  else if (rField_is_Extension())
    681701  {
    682702    if (nGetChar()==1) setCharacteristic( 0 );
     
    688708      Variable a=rootOf(mipo);
    689709      CanonicalForm F( convSingAPClapAP( f,a ) );
     710      L.insert(F);
    690711      if (F.isUnivariate())
    691712      {
     
    694715      else
    695716      {
     717        WarnS("complete factorization only for univariate polynomials");
    696718        CanonicalForm G( convSingTrPClapP( f ) );
    697         L = factorize( G );
     719        if (nGetChar()==1) /* Q(a) */
     720        {
     721          L = factorize( G );
     722        }
     723        else
     724        {
     725#ifdef HAVE_LIBFAC_P
     726          L = Factorize( G );
     727#else
     728          goto notImpl;
     729#endif
     730        }
    698731      }
    699732    }
     
    740773    {
    741774      if (with_exps!=1) (**v)[j] = J.getItem().exp();
    742       if ((nGetChar()==0)||(nGetChar()>1))           /* Q, Fp */
     775      if (rField_is_Zp() || rField_is_Q())           /* Q, Fp */
    743776        res->m[j] = convClapPSingP( J.getItem().factor() );
    744       else if ((nGetChar()==1)||(nGetChar()<-1))     /* Q(a), Fp(a) */
     777      else if (rField_is_GF())
     778        res->m[j] = convClapGFSingGF( J.getItem().factor() );
     779      else if (rField_is_Extension())     /* Q(a), Fp(a) */
    745780      {
    746781        if (currRing->minpoly==NULL)
     
    763798      for(;i>=0;i--)
    764799      {
    765         if (pIsConstant(res->m[i]))
     800        if ((res->m[i]!=NULL) && (pNext(res->m[i])==NULL) && (pIsConstant(res->m[i])))
    766801        {
    767802          pDelete(&(res->m[i]));
Note: See TracChangeset for help on using the changeset viewer.