Changeset 8d8fef in git for libpolys/polys/clapsing.cc


Ignore:
Timestamp:
Jul 29, 2019, 11:36:09 PM (5 years ago)
Author:
Murray Heymann <heymann.murray@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
feed60bef09898f675e0f8605ed0ac0eaa8bed5a
Parents:
da1ec3de158a4f05384b9a83be86fc4c1942ec5fc1b9ababa50e8059dd847da0957f50aea901e6a8
Message:
Merge branch 'machine_learning' of github.com:MHeymann/Sources into machine_learning
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/clapsing.cc

    rda1ec3 r8d8fef  
    2020#include "monomials/ring.h"
    2121#include "simpleideals.h"
     22#include "polys/flintconv.h"
     23#include "polys/flint_mpoly.h"
    2224
    2325
     
    5557    return p_GcdMon(g,f,r);
    5658  }
    57 
     59  #ifdef HAVE_FLINT
     60  #if __FLINT_RELEASE >= 20503
     61  if (rField_is_Zp(r) && (r->cf->ch>500))
     62  {
     63    nmod_mpoly_ctx_t ctx;
     64    if (!convSingRFlintR(ctx,r))
     65    {
     66      // leading coef. 1
     67      return Flint_GCD_MP(f,pLength(f),g,pLength(g),ctx,r);
     68    }
     69  }
     70  else
     71  if (rField_is_Q(r))
     72  {
     73    fmpq_mpoly_ctx_t ctx;
     74    if (!convSingRFlintR(ctx,r))
     75    {
     76      // leading coef. positive, all coeffs in Z
     77      poly res=Flint_GCD_MP(f,pLength(f),g,pLength(g),ctx,r);
     78      res=p_Cleardenom(res,r);
     79      return res;
     80    }
     81  }
     82  #endif
     83  #endif
    5884  Off(SW_RATIONAL);
    5985  if (rField_is_Q(r) || rField_is_Zp(r) || rField_is_Z(r)
     
    6389    CanonicalForm F( convSingPFactoryP( f,r ) ), G( convSingPFactoryP( g, r ) );
    6490    res=convFactoryPSingP( gcd( F, G ) , r);
     91    if ( rField_is_Zp(r))
     92      p_Norm(res,r); // leading coef. 1
     93    else if (rField_is_Q(r) && (!n_GreaterZero(pGetCoeff(res),r->cf)))
     94      res = p_Neg(res,r); // leading coef. positive, all coeffs in Z
    6595  }
    6696  // and over Q(a) / Fp(a)
     
    81111      prune (a);
    82112      if (!b1) Off(SW_USE_QGCD);
     113      if ( rField_is_Zp_a(r)) p_Norm(res,r); // leading coef. 1
    83114    }
    84115    else
     
    559590{
    560591  poly res=NULL;
     592
     593  #ifdef HAVE_FLINT
     594  #if __FLINT_RELEASE >= 20503
     595  /*
     596    If the division is not exact, control will pass to factory where the
     597    polynomials can be divided using the ordering that factory chooses.
     598  */
     599  if (rField_is_Zp(r))
     600  {
     601    nmod_mpoly_ctx_t ctx;
     602    if (!convSingRFlintR(ctx,r))
     603    {
     604      res = Flint_Divide_MP(f,pLength(f),g,pLength(g),ctx,r);
     605      if (res != NULL)
     606        return res;
     607    }
     608  }
     609  else
     610  if (rField_is_Q(r))
     611  {
     612    fmpq_mpoly_ctx_t ctx;
     613    if (!convSingRFlintR(ctx,r))
     614    {
     615      res = Flint_Divide_MP(f,pLength(f),g,pLength(g),ctx,r);
     616      if (res != NULL)
     617        return res;
     618    }
     619  }
     620  #endif
     621  #endif
     622
    561623  On(SW_RATIONAL);
    562624  if (rField_is_Zp(r) || rField_is_Q(r)
Note: See TracChangeset for help on using the changeset viewer.