Changeset 4a01eb in git


Ignore:
Timestamp:
Jul 4, 2019, 4:41:57 PM (5 years ago)
Author:
tthsqe12 <tthsqe12@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
a2ed8d68de2b01b51593ba6669b4af9cf437a407
Parents:
c7893eaae5e03161f0de3f3034ab79ed675510fe
Message:
use push terms instead of set coeff
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/flint_mpoly.cc

    rc7893ea r4a01eb  
    3939void convSingPFlintMP(fmpq_mpoly_t res, fmpq_mpoly_ctx_t ctx, poly p, int lp, const ring r)
    4040{
    41   int bits=SI_LOG2(r->bitmask);
    42   fmpq_mpoly_init3(res,lp,bits,ctx);
    43   fmpq_mpoly_resize(res,lp,ctx);
     41  fmpq_mpoly_init2(res, lp, ctx);
    4442  ulong* exp=(ulong*)omAlloc((r->N+1)*sizeof(ulong));
    45   int i=0;
    4643  while(p!=NULL)
    4744  {
     
    5148    #if SIZEOF_LONG==8
    5249    p_GetExpVL(p,(int64*)exp,r);
    53     fmpq_mpoly_set_term_exp_ui(res,i,exp,ctx);
     50    fmpq_mpoly_push_term_fmpq_ui(res, c, exp, ctx);
    5451    #else
    5552    p_GetExpV(p,(int*)exp,r);
    56     fmpq_mpoly_set_term_exp_ui(res,i,&(exp[1]),ctx);
    57     #endif
    58     fmpq_mpoly_set_term_coeff_fmpq(res,i,c,ctx);
     53    fmpq_mpoly_push_term_fmpq_ui(res, c, &(exp[1]), ctx);
     54    #endif
    5955    fmpq_clear(c);
    60     i++;
    6156    pIter(p);
    6257  }
    63   //fmpq_mpoly_print_pretty(res,r->names,ctx);PrintLn();
     58  fmpq_mpoly_reduce(res, ctx); // extra step for QQ ensures res has content canonically factored out
    6459  omFreeSize(exp,(r->N+1)*sizeof(ulong));
    6560}
     
    111106  return pres;
    112107}
     108
    113109BOOLEAN convSingRFlintR(nmod_mpoly_ctx_t ctx, const ring r)
    114110{
     
    158154void convSingPFlintMP(nmod_mpoly_t res, nmod_mpoly_ctx_t ctx, poly p, int lp,const ring r)
    159155{
    160   int bits=SI_LOG2(r->bitmask);
    161   nmod_mpoly_init3(res,lp,bits,ctx);
    162   nmod_mpoly_resize(res,lp,ctx);
     156  nmod_mpoly_init2(res, lp, ctx);
    163157  ulong* exp=(ulong*)omAlloc((r->N+1)*sizeof(ulong));
    164   int i=0;
    165158  while(p!=NULL)
    166159  {
     
    168161    #if SIZEOF_LONG==8
    169162    p_GetExpVL(p,(int64*)exp,r);
    170     nmod_mpoly_set_term_exp_ui(res,i,exp,ctx);
     163    nmod_mpoly_push_term_ui_ui(res, (ulong)n, exp, ctx);
    171164    #else
    172165    p_GetExpV(p,(int*)exp,r);
    173     nmod_mpoly_set_term_exp_ui(res,i,&(exp[1]),ctx);
    174     #endif
    175     nmod_mpoly_set_term_coeff_ui(res,i,(ulong)n,ctx);
    176     i++;
     166    nmod_mpoly_push_term_ui_ui(res, (ulong)n, &(exp[1]), ctx);
     167    #endif
    177168    pIter(p);
    178169  }
    179   //nmod_mpoly_print_pretty(res,r->names,ctx);PrintLn();
    180170  omFreeSize(exp,(r->N+1)*sizeof(ulong));
    181171}
     
    197187  return pres;
    198188}
     189
    199190poly Flint_GCD_MP(poly p,int lp,poly q,int lq,nmod_mpoly_ctx_t ctx,const ring r)
    200191{
Note: See TracChangeset for help on using the changeset viewer.