ipower.h and hgdelta_update.h included, since these functions are now placed in its own files.

This commit is contained in:
Sebastian Limbach 2007-02-28 16:11:28 +00:00
parent 1d2f40a956
commit f2e210cf28
1 changed files with 12 additions and 9 deletions

View File

@ -22,8 +22,11 @@
#include <CGAL/basic.h>
#include <CGAL/Polynomial.h>
#ifndef CGAL_PRS_RESULTANT_H
#define CGAL_PRS_RESULTANT_H
#include <CGAL/Polynomial/ipower.h>
#include <CGAL/Polynomial/hgdelta_update.h>
#ifndef CGAL_POLYNOMIAL_PRS_RESULTANT_H
#define CGAL_POLYNOMIAL_PRS_RESULTANT_H
CGAL_BEGIN_NAMESPACE
@ -43,7 +46,7 @@ NT prs_resultant_ufd(Polynomial<NT> A, Polynomial<NT> B) {
}
NT a = A.content(), b = B.content();
NT g(1), h(1), t = ipower(a, B.degree()) * ipower(b, A.degree());
NT g(1), h(1), t = INTERN_POLYNOMIAL::ipower(a, B.degree()) * INTERN_POLYNOMIAL::ipower(b, A.degree());
Polynomial<NT> Q, R; NT d;
int delta;
@ -54,9 +57,9 @@ NT prs_resultant_ufd(Polynomial<NT> A, Polynomial<NT> B) {
delta = A.degree() - B.degree();
CGAL_expensive_assertion(
typename CGAL::Algebraic_structure_traits<NT>::Is_exact == CGAL_Tag_false
|| d == ipower(B.lcoeff(), delta + 1) );
|| d == INTERN_POLYNOMIAL::ipower(B.lcoeff(), delta + 1) );
A = B;
B = R / (g * ipower(h, delta));
B = R / (g * INTERN_POLYNOMIAL::ipower(h, delta));
g = A.lcoeff();
// h = h^(1-delta) * g^delta
INTERN_POLYNOMIAL::hgdelta_update(h, g, delta);
@ -91,11 +94,11 @@ NT prs_resultant_field(Polynomial<NT> A, Polynomial<NT> B) {
while (B.degree() > 0) {
signflip ^= (A.degree() & B.degree() & 1);
Polynomial<NT>::euclidean_division(A, B, Q, R);
res *= ipower(B.lcoeff(), A.degree() - R.degree());
res *= INTERN_POLYNOMIAL::ipower(B.lcoeff(), A.degree() - R.degree());
A = B;
B = R;
}
res = ipower(B.lcoeff(), A.degree()) * (signflip ? -res : res);
res = INTERN_POLYNOMIAL::ipower(B.lcoeff(), A.degree()) * (signflip ? -res : res);
typename Algebraic_structure_traits<NT>::Simplify simplify;
simplify(res);
return res;
@ -140,7 +143,7 @@ NT prs_resultant_decompose(Polynomial<NT> A, Polynomial<NT> B){
B.simplify_coefficients();
INTPOLY A0 = integralize_polynomial(A, a);
INTPOLY B0 = integralize_polynomial(B, b);
DENOM c = ipower(a, B.degree()) * ipower(b, A.degree());
DENOM c = INTERN_POLYNOMIAL::ipower(a, B.degree()) * INTERN_POLYNOMIAL::ipower(b, A.degree());
typedef typename Algebraic_structure_traits<RES>::Algebraic_category Algebraic_category;
RES res0 = INTERN_PRS_RESULTANT::prs_resultant_(A0, B0, Algebraic_category());
typename Fraction_traits<NT>::Compose comp_frac;
@ -188,6 +191,6 @@ NT prs_resultant(Polynomial<NT> A, Polynomial<NT> B) {
CGAL_END_NAMESPACE
#endif // CGAL_PRS_RESULTANT_H
#endif // CGAL_POLYNOMIAL_PRS_RESULTANT_H
// EOF