Ignore:
Timestamp:
Jul 23, 2019, 11:31:27 AM (5 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
7161acac8387482214ebcdd85e77266519f0cad2
Parents:
d906dc5d406b00b056fb825f5c5c8988ebcaceb3628fc3d0ec524cd36ca82c3a6275c0dcf5d73c83
Message:
Merge branch 'spielwiese' into stable
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/operations/p_Mult_q.cc

    rd906dc rd4cec6a  
    2323#include "polys/templates/p_MemAdd.h"
    2424#include "polys/templates/p_MemCopy.h"
     25#include "polys/flintconv.h"
     26#include "polys/flint_mpoly.h"
    2527
    2628#include "p_Mult_q.h"
     
    268270
    269271
     272// Use factory if min(pLength(p), pLength(q)) >= MIN_LENGTH_FACTORY (>MIN_LENGTH_BUCKET)
     273// Not thoroughly tested what is best
     274#define MIN_LENGTH_FACTORY 200
     275#define MIN_LENGTH_FACTORY_QQ 60
     276#define MIN_FLINT_QQ 10
     277#define MIN_FLINT_Zp 20
     278
    270279/// Returns:  p * q,
    271280/// Destroys: if !copy then p, q
    272 /// Assumes: pLength(p) >= 2 pLength(q) >=2
     281/// Assumes: pLength(p) >= 2 pLength(q) >=2, !rIsPluralRing(r)
    273282poly _p_Mult_q(poly p, poly q, const int copy, const ring r)
    274283{
     
    281290  poly pt;
    282291
    283   pqLength(p, q, lp, lq, MIN_LENGTH_BUCKET);
     292  pqLength(p, q, lp, lq, MIN_LENGTH_FACTORY);
    284293
    285294  if (lp < lq)
     
    292301    lq = l;
    293302  }
     303  BOOLEAN pure_polys=(p_GetComp(p,r)==0) && (p_GetComp(q,r)==0);
     304  #ifdef HAVE_FLINT
     305  #if __FLINT_RELEASE >= 20503
     306  if (lq>MIN_FLINT_QQ)
     307  {
     308    fmpq_mpoly_ctx_t ctx;
     309    if (pure_polys && rField_is_Q(r) && !convSingRFlintR(ctx,r))
     310    {
     311      lp=pLength(p);
     312      //printf("mul in flint\n");
     313      poly res=Flint_Mult_MP(p,lp,q,lq,ctx,r);
     314      if (!copy)
     315      {
     316        p_Delete(&p,r);
     317        p_Delete(&q,r);
     318      }
     319      return res;
     320    }
     321  }
     322  if (lq>MIN_FLINT_Zp)
     323  {
     324    nmod_mpoly_ctx_t ctx;
     325    if (pure_polys && rField_is_Zp(r) && !convSingRFlintR(ctx,r))
     326    {
     327      lp=pLength(p);
     328      //printf("mul in flint\n");
     329      poly res=Flint_Mult_MP(p,lp,q,lq,ctx,r);
     330      if (!copy)
     331      {
     332        p_Delete(&p,r);
     333        p_Delete(&q,r);
     334      }
     335      return res;
     336    }
     337  }
     338  #endif
     339  #endif
    294340  if (lq < MIN_LENGTH_BUCKET || TEST_OPT_NOT_BUCKETS)
    295341    return _p_Mult_q_Normal(p, q, copy, r);
    296   else if ((lq >= MIN_LENGTH_FACTORY)
    297   && (r->cf->convSingNFactoryN!=ndConvSingNFactoryN))
     342  else if (pure_polys
     343  && (((lq >= MIN_LENGTH_FACTORY)
     344    && (r->cf->convSingNFactoryN!=ndConvSingNFactoryN))
     345  || ((lq >= MIN_LENGTH_FACTORY_QQ)
     346    && rField_is_Q(r))))
    298347  {
    299348    poly h=singclap_pmult(p,q,r);
     
    307356  else
    308357  {
    309     assume(lp == pLength(p));
     358    lp=pLength(p);
    310359    assume(lq == pLength(q));
    311360    return _p_Mult_q_Bucket(p, lp, q, lq, copy, r);
Note: See TracChangeset for help on using the changeset viewer.