Ignore:
Timestamp:
Jul 25, 2019, 1:23:11 PM (5 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
35a153cf7acb82519d52d0b74581e9a193d15765
Parents:
c9824e54c705dcaedb3b991c6bf81f9f974e758d3f94cbdb24129f0002a999ab5fb63a34f0fc933d
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2019-07-25 13:23:11+02:00
git-committer:
GitHub <noreply@github.com>2019-07-25 13:23:11+02:00
Message:
Merge pull request #945 from tthsqe12/let_flint_borrow

let flint borrow large integer coeffs in some cases
File:
1 edited

Legend:

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

    r3f94cb r3d5b277  
    6767}
    6868
     69static void pqLengthApprox(poly p, poly q, int &lp, int &lq, const int min)
     70{
     71  int l = 0;
     72
     73  do
     74  {
     75    if (p == NULL)
     76    {
     77      lp=l;
     78      lq=l+(q!=NULL);
     79      return;
     80    }
     81    if (q == NULL) /* && p!=NULL */
     82    {
     83      lp=l+1;
     84      lq=l;
     85      return;
     86    }
     87    if (l>min) /* && p,q!=NULL */
     88    {
     89      lp=l; lq=l;
     90      return;
     91    }
     92    pIter(p);
     93    pIter(q);
     94    l++;
     95  }
     96  while (1);
     97}
     98
    6999
    70100static poly _p_Mult_q_Bucket(poly p, const int lp,
     
    290320  poly pt;
    291321
    292   pqLength(p, q, lp, lq, MIN_LENGTH_FACTORY);
     322  // MIN_LENGTH_FACTORY must be >= MIN_LENGTH_FACTORY_QQ, MIN_FLINT_QQ, MIN_FLINT_Zp 20
     323  pqLengthApprox(p, q, lp, lq, MIN_LENGTH_FACTORY);
    293324
    294325  if (lp < lq)
     
    309340    if (pure_polys && rField_is_Q(r) && !convSingRFlintR(ctx,r))
    310341    {
    311       lp=pLength(p);
    312       //printf("mul in flint\n");
    313       poly res=Flint_Mult_MP(p,lp,q,lq,ctx,r);
     342      // lq is a lower bound for the length of p and  q
     343      poly res=Flint_Mult_MP(p,lq,q,lq,ctx,r);
    314344      if (!copy)
    315345      {
     
    325355    if (pure_polys && rField_is_Zp(r) && !convSingRFlintR(ctx,r))
    326356    {
    327       lp=pLength(p);
    328       //printf("mul in flint\n");
    329       poly res=Flint_Mult_MP(p,lp,q,lq,ctx,r);
     357      // lq is a lower bound for the length of p and  q
     358      poly res=Flint_Mult_MP(p,lq,q,lq,ctx,r);
    330359      if (!copy)
    331360      {
     
    357386  {
    358387    lp=pLength(p);
    359     assume(lq == pLength(q));
     388    lq=pLength(q);
    360389    return _p_Mult_q_Bucket(p, lp, q, lq, copy, r);
    361390  }
Note: See TracChangeset for help on using the changeset viewer.