Changeset 3ef9c8 in git


Ignore:
Timestamp:
Dec 10, 2011, 12:51:17 AM (12 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
f41d12e69588befe7fc3383e41747d4ac6575de4f78374aba946095faa511cce5808e17088898c1a
Parents:
600d9a415e87303ccbc4a8f4460e9617a66c7f81
git-author:
Martin Lee <martinlee84@web.de>2011-12-10 00:51:17+01:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-12-12 21:04:28+01:00
Message:
chg: changes in factory interface and iparith.cc accordingly to master
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r600d9a r3ef9c8  
    31543154  if ((sw<0)||(sw>2)) fac_sw=1;
    31553155  singclap_factorize_retry=0;
    3156   ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, fac_sw);
     3156  ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, fac_sw, currRing);
    31573157  if (f==NULL)
    31583158    return TRUE;
     
    46824682{
    46834683  singclap_factorize_retry=0;
     4684  intvec *v=NULL;
    46844685  ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing);
    46854686  if (f==NULL) return TRUE;
  • libpolys/polys/clapsing.cc

    r600d9a r3ef9c8  
    952952  return res;
    953953}
    954 ideal singclap_sqrfree ( poly f, const ring r)
     954ideal singclap_sqrfree ( poly f, intvec ** v , int with_exps, const ring r)
    955955{
    956956  p_Test(f,r);
     
    969969  {
    970970    res=idInit(1,1);
     971    if (with_exps!=1)
     972    {
     973      (*v)=new intvec(1);
     974      (**v)[0]=1;
     975    }
    971976    return res;
    972977  }
     
    978983    int e;
    979984    for(i=rVar(r);i>0;i--) if(p_GetExp(f,i,r)!=0) n++;
    980     n++; // with coeff
     985    if (with_exps==0) n++; // with coeff
    981986    res=idInit(si_max(n,1),1);
     987    switch(with_exps)
     988    {
     989      case 0: // with coef & exp.
     990        res->m[0]=p_NSet(n_Copy(pGetCoeff(f),r->cf),r);
     991        // no break
     992      case 2: // with exp.
     993        (*v)=new intvec(si_max(1,n));
     994        (**v)[0]=1;
     995        // no break
     996      case 1: ;
     997      #ifdef TEST
     998      default: ;
     999      #endif
     1000    }
    9821001    res->m[0]=p_NSet(n_Copy(pGetCoeff(f),r->cf),r);
    9831002    if (n==0)
     
    9851004      res->m[0]=p_One(r);
    9861005      // (**v)[0]=1; is already done
    987       return res;
    988     }
    989     for(i=rVar(r);i>0;i--)
    990     {
    991       e=p_GetExp(f,i,r);
    992       if(e!=0)
    993       {
    994         n--;
    995         poly p=p_One(r);
    996         p_SetExp(p,i,1,r);
    997         p_Setm(p,r);
    998         res->m[n]=p;
    999       }
    1000     }
     1006    }
     1007    else
     1008    {
     1009      for(i=rVar(r);i>0;i--)
     1010      {
     1011        e=p_GetExp(f,i,r);
     1012        if(e!=0)
     1013        {
     1014          n--;
     1015          poly p=p_One(r);
     1016          p_SetExp(p,i,1,r);
     1017          p_Setm(p,r);
     1018          res->m[n]=p;
     1019          if (with_exps!=1) (**v)[n]=e;
     1020        }
     1021      }
     1022    }
     1023    p_Delete(&f,r);
    10011024    return res;
    10021025  }
     
    10101033  #endif
    10111034  CFFList L;
     1035  number N=NULL;
     1036  number NN=NULL;
    10121037
    10131038  if (!rField_is_Zp(r) && !rField_is_Zp_a(r)) /* Q, Q(a) */
    10141039  {
    10151040    //if (f!=NULL) // already tested at start of routine
    1016     {
    1017       p_Cleardenom(f, r);
     1041    number n0=n_Copy(pGetCoeff(f),r->cf);
     1042    if (with_exps==0)
     1043      N=n_Copy(n0,r->cf);
     1044    p_Cleardenom(f, r);
     1045    //after here f should not have a denominator!!
     1046    //PrintS("S:");p_Write(f,r);PrintLn();
     1047    NN=n_Div(n0,pGetCoeff(f),r->cf);
     1048    n_Delete(&n0,r->cf);
     1049    if (with_exps==0)
     1050    {
     1051      n_Delete(&N,r->cf);
     1052      N=n_Copy(NN,r->cf);
    10181053    }
    10191054  }
     
    10231058    if (singclap_factorize_retry==0)
    10241059    {
     1060      number n0=n_Copy(pGetCoeff(f),r->cf);
     1061      if (with_exps==0)
     1062        N=n_Copy(n0,r->cf);
    10251063      p_Norm(f,r);
    10261064      p_Cleardenom(f, r);
     1065      NN=n_Div(n0,pGetCoeff(f),r->cf);
     1066      n_Delete(&n0,r->cf);
     1067      if (with_exps==0)
     1068      {
     1069        n_Delete(&N,r->cf);
     1070        N=n_Copy(NN,r->cf);
     1071      }
    10271072    }
    10281073  }
     
    10321077    CanonicalForm F( convSingPFactoryP( f,r ) );
    10331078    L = sqrFree( F );
     1079  }
     1080  else if (rField_is_Extension(r))
     1081  {
     1082    if (rField_is_Q_a (r)) setCharacteristic (0);
     1083    else                   setCharacteristic( rChar(r) );
     1084    if (r->cf->extRing->minideal!=NULL)
     1085    {
     1086      CanonicalForm mipo=convSingPFactoryP(r->cf->extRing->minideal->m[0],
     1087                                           r->cf->extRing);
     1088      Variable a=rootOf(mipo);
     1089      CanonicalForm F( convSingAPFactoryAP( f, a, r ) );
     1090      L= sqrFree (F);
     1091    }
     1092    else
     1093    {
     1094      CanonicalForm F( convSingTrPFactoryP( f,r ) );
     1095      L = sqrFree( F );
     1096    }
    10341097  }
    10351098  #if 0
     
    10591122    CFFListIterator J=L;
    10601123    int j=0;
     1124    if (with_exps!=1)
     1125    {
     1126      if ((with_exps==2)&&(n>1))
     1127      {
     1128        n--;
     1129        J++;
     1130      }
     1131      *v = new intvec( n );
     1132    }
     1133    else if (L.getFirst().factor().inCoeffDomain())
     1134    {
     1135      n--;
     1136      J++;
     1137    }
    10611138    res = idInit( n ,1);
    10621139    for ( ; J.hasItem(); J++, j++ )
    10631140    {
    1064       res->m[j] = convFactoryPSingP( J.getItem().factor(),r );
     1141      if (with_exps!=1) (**v)[j] = J.getItem().exp();
     1142      if (rField_is_Zp(r) || rField_is_Q(r))
     1143        res->m[j] = convFactoryPSingP( J.getItem().factor(),r );
     1144      else if (rField_is_Extension(r))     /* Q(a), Fp(a) */
     1145      {
     1146        if (r->cf->extRing->minideal==NULL)
     1147          res->m[j]=convFactoryPSingTrP( J.getItem().factor(),r );
     1148        else
     1149          res->m[j]=convFactoryAPSingAP( J.getItem().factor(),r );
     1150      }
    10651151    }
    10661152    if (res->m[0]==NULL)
  • libpolys/polys/clapsing.h

    r600d9a r3ef9c8  
    3939ideal singclap_factorize ( poly f, intvec ** v , int with_exps, const ring r);
    4040
    41 ideal singclap_sqrfree ( poly f, const ring r );
     41ideal singclap_sqrfree ( poly f, intvec ** v , int with_exps, const ring r );
    4242
    4343#ifdef HAVE_NTL
Note: See TracChangeset for help on using the changeset viewer.