Changeset 3d5596 in git for libpolys


Ignore:
Timestamp:
Jul 11, 2017, 9:59:44 AM (7 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
0ec309ddd6253287d647226c352fff30a3417b99
Parents:
3092f65270fb472dca33d7d41d19f79dbb1cd638
Message:
add: remainder of polynomial division via factoryi(mod,%), also div
Location:
libpolys/polys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/clapsing.cc

    r3092f6 r3d5596  
    575575}
    576576
     577poly singclap_pmod ( poly f, poly g, const ring r )
     578{
     579  poly res=NULL;
     580  On(SW_RATIONAL);
     581  if (rField_is_Zp(r) || rField_is_Q(r))
     582  {
     583    setCharacteristic( rChar(r) );
     584    CanonicalForm F( convSingPFactoryP( f,r ) ), G( convSingPFactoryP( g,r ) );
     585    res = convFactoryPSingP( F % G,r );
     586  }
     587  else if (rField_is_Ring_Z(r))
     588  {
     589    Off(SW_RATIONAL);
     590    setCharacteristic( rChar(r) );
     591    CanonicalForm F( convSingPFactoryP( f,r ) ), G( convSingPFactoryP( g,r ) );
     592    res = convFactoryPSingP( F % G,r );
     593  }
     594  else if (r->cf->extRing!=NULL)
     595  {
     596    if (rField_is_Q_a(r)) setCharacteristic( 0 );
     597    else               setCharacteristic( rChar(r) );
     598    if (r->cf->extRing->qideal!=NULL)
     599    {
     600      CanonicalForm mipo=convSingPFactoryP(r->cf->extRing->qideal->m[0],
     601                                                 r->cf->extRing);
     602      Variable a=rootOf(mipo);
     603      CanonicalForm F( convSingAPFactoryAP( f,a,r ) ),
     604                    G( convSingAPFactoryAP( g,a,r ) );
     605      res= convFactoryAPSingAP(  F % G, r  );
     606      prune (a);
     607    }
     608    else
     609    {
     610      CanonicalForm F( convSingTrPFactoryP( f,r ) ), G( convSingTrPFactoryP( g,r ) );
     611      res= convFactoryPSingTrP(  F % G,r  );
     612    }
     613  }
     614#if 0 // not yet working
     615  else if (rField_is_GF())
     616  {
     617    //Print("GF(%d^%d)\n",nfCharP,nfMinPoly[0]);
     618    setCharacteristic( nfCharP,nfMinPoly[0], currRing->parameter[0][0] );
     619    CanonicalForm F( convSingGFFactoryGF( f ) ), G( convSingGFFactoryGF( g ) );
     620    res = convFactoryGFSingGF( F / G );
     621  }
     622#endif
     623  else
     624    WerrorS( feNotImplemented );
     625  Off(SW_RATIONAL);
     626  return res;
     627}
     628
    577629void singclap_divide_content ( poly f, const ring r )
    578630{
  • libpolys/polys/clapsing.h

    r3092f6 r3d5596  
    3939
    4040poly singclap_pdivide ( poly f, poly g, const ring r );
     41poly singclap_pmod ( poly f, poly g, const ring r );
    4142
    4243void singclap_divide_content ( poly f, const ring r);
Note: See TracChangeset for help on using the changeset viewer.