Ignore:
Timestamp:
Feb 27, 2018, 5:37:19 PM (6 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
dab4204fd4f4fe227449dacf9c07d0f7f036bdd8
Parents:
617c8e724541d5f5c39e8ee6708e0e2d8905d332
Message:
opt: p_Content
File:
1 edited

Legend:

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

    r617c8e7 rf489c7b  
    624624      case ringorder_am:
    625625        b1=si_min(b1,r->N);
    626         /* no break, continue as ringorder_a*/
     626        /* no break, continue as ringorder_a*/
    627627      case ringorder_a:
    628628        for (k=b0 /*r->block0[i]*/;k<=b1 /*r->block1[i]*/;k++)
     
    22392239{
    22402240  if (ph==NULL) return;
     2241  const coeffs cf=r->cf;
    22412242  if (pNext(ph)==NULL)
    22422243  {
    2243     p_SetCoeff(ph,n_Init(1,r->cf),r);
    2244   }
    2245   if (r->cf->cfSubringGcd==ndGcd) /* trivial gcd*/ return;
     2244    p_SetCoeff(ph,n_Init(1,cf),r);
     2245  }
     2246  if (cf->cfSubringGcd==ndGcd) /* trivial gcd*/ return;
    22462247  number h=p_InitContent(ph,r); /* first guess of a gcd of all coeffs */
    2247   poly p=ph;
     2248  poly p;
     2249  if(n_IsOne(h,cf))
     2250  {
     2251    goto content_finish;
     2252  }
     2253  p=ph;
    22482254  // take the SubringGcd of all coeffs
    22492255  while (p!=NULL)
    22502256  {
    2251     n_Normalize(pGetCoeff(p),r->cf);
    2252     number d=n_SubringGcd(h,pGetCoeff(p),r->cf);
    2253     n_Delete(&h,r->cf);
     2257    n_Normalize(pGetCoeff(p),cf);
     2258    number d=n_SubringGcd(h,pGetCoeff(p),cf);
     2259    n_Delete(&h,cf);
    22542260    h = d;
    2255     if(n_IsOne(h,r->cf))
    2256     {
    2257       break;
     2261    if(n_IsOne(h,cf))
     2262    {
     2263      goto content_finish;
    22582264    }
    22592265    pIter(p);
    22602266  }
    2261   // if foundi<>1, divide by it
    2262   if(!n_IsOne(h,r->cf))
    2263   {
    2264     p = ph;
    2265     while (p!=NULL)
    2266     {
    2267       number d = n_ExactDiv(pGetCoeff(p),h,r->cf);
    2268       p_SetCoeff(p,d,r);
    2269       pIter(p);
    2270     }
    2271   }
     2267  // if found<>1, divide by it
     2268  p = ph;
     2269  while (p!=NULL)
     2270  {
     2271    number d = n_ExactDiv(pGetCoeff(p),h,cf);
     2272    p_SetCoeff(p,d,r);
     2273    pIter(p);
     2274  }
     2275content_finish:
    22722276  n_Delete(&h,r->cf);
    22732277  // and last: check leading sign:
Note: See TracChangeset for help on using the changeset viewer.