Changeset 04b7a73 in git for libpolys


Ignore:
Timestamp:
Nov 10, 2017, 2:41:08 PM (6 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
Children:
d893deb4561cf6de5791862e034cf2cc2b9721ba
Parents:
e372c73286071e8cf1bacd857dc4a9e3355bb7df
Message:
opt: p_Add_q, p_Mult_q, p_Mult_nn, pp_Mult_nn
Location:
libpolys/polys
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/monomials/p_polys.h

    re372c73 r04b7a73  
    891891{
    892892  assume( (p != q) || (p == NULL && q == NULL) );
     893  if (q==NULL) return p;
     894  if (p==NULL) return q;
    893895  int shorter;
    894896  return r->p_Procs->p_Add_q(p, q, shorter, r);
     
    899901{
    900902  assume( (p != q) || (p == NULL && q == NULL) );
     903  if (q==NULL) return p;
     904  if (p==NULL) { lp=lq; return q; }
    901905  int shorter;
    902906  poly res = r->p_Procs->p_Add_q(p, q, shorter, r);
     
    908912static inline poly p_Mult_nn(poly p, number n, const ring r)
    909913{
     914  if (p==NULL) return NULL;
    910915  if (n_IsOne(n, r->cf))
    911916    return p;
     
    914919    r->p_Procs->p_Delete(&p, r); // NOTE: without p_Delete - memory leak!
    915920    return NULL;
    916   } else
     921  }
     922  else
    917923    return r->p_Procs->p_Mult_nn(p, n, r);
    918924}
     
    922928                        const ring tailRing)
    923929{
     930  assume(p!=NULL);
    924931#ifndef PDEBUG
    925932  if (lmRing == tailRing)
     
    936943static inline poly pp_Mult_nn(poly p, number n, const ring r)
    937944{
     945  if (p==NULL) return NULL;
    938946  if (n_IsOne(n, r->cf))
    939947    return p_Copy(p, r);
     
    974982static inline poly pp_Mult_mm(poly p, poly m, const ring r)
    975983{
     984  if (p==NULL) return NULL;
    976985  if (p_LmIsConstant(m, r))
    977986    return __pp_Mult_nn(p, pGetCoeff(m), r);
     
    983992static inline poly p_Mult_mm(poly p, poly m, const ring r)
    984993{
     994  if (p==NULL) return NULL;
    985995  if (p_LmIsConstant(m, r))
    986996    return __p_Mult_nn(p, pGetCoeff(m), r);
  • libpolys/polys/templates/p_Add_q__T.cc

    re372c73 r04b7a73  
    2323  int l = pLength(p) + pLength(q);
    2424#endif
     25  assume(p!=NULL && q!=NULL);
    2526
    26   // test for trivial cases
    2727  Shorter = 0;
    28   if (q == NULL) return p;
    29   if (p == NULL) return q;
    3028
    3129  number t, n1, n2;
  • libpolys/polys/templates/p_Mult_mm__T.cc

    re372c73 r04b7a73  
    2020  p_Test(p, ri);
    2121  p_LmTest(m, ri);
    22   if (p == NULL) return NULL;
    2322  pAssume(m != NULL);
     23  assume(p!=NULL);
    2424  poly q = p;
    2525  number ln = pGetCoeff(m);
  • libpolys/polys/templates/p_Mult_nn__T.cc

    re372c73 r04b7a73  
    2525  poly old = NULL;
    2626#endif
    27   while (p != NULL)
     27  do
    2828  {
    2929#ifndef HAVE_ZERODIVISORS
     
    5555    }
    5656#endif
    57   }
     57  } while (p!=NULL);
    5858  p_Test(q, r);
    5959  return q;
Note: See TracChangeset for help on using the changeset viewer.