Skip to content

Commit

Permalink
fix: p_Content for alg.ext.
Browse files Browse the repository at this point in the history
fix: p_Monic
  • Loading branch information
hannes14 authored and mohamed-barakat committed Nov 9, 2011
1 parent 61a0501 commit 90aec7c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions libpolys/polys/monomials/p_polys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1481,19 +1481,21 @@ poly p_PolyDiv(poly &p, poly divisor, BOOLEAN needResult, ring r)
this assumes that we are over a ground field so that division
is well-defined;
modifies p */
void p_Monic(poly &p, ring r)
void p_Monic(poly p, const ring r)
{
if (p == NULL) return;
number n = n_Init(1, r->cf);
if (p->next==NULL) { p_SetCoeff(p,n,r); return; }
poly pp = p;
number lc = p_GetCoeff(p, r);
if (n_IsOne(lc, r->cf)) return;
number lcInverse = n_Invers(lc, r->cf);
number n = n_Init(1, r->cf);
p_SetCoeff(p, n, r); // destroys old leading coefficient!
p = pIter(p);
pIter(p);
while (p != NULL)
{
number n = n_Mult(p_GetCoeff(p, r), lcInverse, r->cf);
n_Normalize(n,r->cf);
p_SetCoeff(p, n, r); // destroys old leading coefficient!
p = pIter(p);
}
Expand Down Expand Up @@ -2071,8 +2073,8 @@ void p_Content(poly ph, const ring r)
hzz=d;
pIter(c_n);
}
pIter(p);
}
pIter(p);
/* hzz contains the 1/lcm of all denominators in c_n_n*/
h=n_Invers(hzz,r->cf->extRing->cf);
n_Delete(&hzz,r->cf->extRing->cf);
Expand Down
2 changes: 1 addition & 1 deletion libpolys/polys/monomials/p_polys.h
Original file line number Diff line number Diff line change
Expand Up @@ -1854,7 +1854,7 @@ poly p_PolyDiv(poly &p, poly divisor, BOOLEAN needResult, ring r);
this assumes that we are over a ground field so that division
is well-defined;
modifies p */
void p_Monic(poly &p, ring r);
void p_Monic(poly p, const ring r);

/* assumes that p and q are univariate polynomials in r,
mentioning the same variable;
Expand Down

0 comments on commit 90aec7c

Please sign in to comment.