mirror of https://github.com/CGAL/cgal
Added functor Sturm_habicht_sequence_with_cofactors in Polynomial_traits
This commit is contained in:
parent
acbb15c13f
commit
239c86d7ca
|
|
@ -97,6 +97,15 @@ template <typename OutputIterator, typename NT > inline
|
|||
template<typename OutputIterator, typename NT> OutputIterator
|
||||
sturm_habicht_sequence(CGAL::Polynomial<NT> P, OutputIterator out);
|
||||
|
||||
template<typename OutputIterator1,
|
||||
typename OutputIterator2,
|
||||
typename OutputIterator3,
|
||||
typename NT> OutputIterator1
|
||||
sturm_habicht_sequence_with_cofactors(CGAL::Polynomial<NT> P,
|
||||
OutputIterator1 out_stha,
|
||||
OutputIterator2 out_f,
|
||||
OutputIterator3 out_fx);
|
||||
|
||||
|
||||
} // namespace CGALi
|
||||
|
||||
|
|
|
|||
|
|
@ -1381,8 +1381,28 @@ public:
|
|||
out);
|
||||
}
|
||||
};
|
||||
|
||||
// Sturm-Habicht sequence with cofactors
|
||||
struct Sturm_habicht_sequence_with_cofactors {
|
||||
template<typename OutputIterator1,
|
||||
typename OutputIterator2,
|
||||
typename OutputIterator3>
|
||||
OutputIterator1 operator()(
|
||||
const Polynomial_d& p,
|
||||
OutputIterator1 out_stha,
|
||||
OutputIterator2 out_f,
|
||||
OutputIterator3 out_fx,
|
||||
int i = (d-1) ) const {
|
||||
if(i == (d-1) )
|
||||
return CGAL::CGALi::sturm_habicht_sequence_with_cofactors
|
||||
(p,out_stha,out_f,out_fx);
|
||||
else
|
||||
return CGAL::CGALi::sturm_habicht_sequence_with_cofactors
|
||||
(Move()(p,i),out_stha,out_f,out_fx);
|
||||
}
|
||||
};
|
||||
|
||||
// Sturm-Habicht sequence
|
||||
// Principal Sturm-Habicht sequence
|
||||
struct Principal_sturm_habicht_sequence {
|
||||
|
||||
template<typename OutputIterator>
|
||||
|
|
|
|||
|
|
@ -207,6 +207,23 @@ template<typename ArithmeticKernel> void test_routine() {
|
|||
assert(stha[i]==co_f[i]*f + co_fx[i]*fx);
|
||||
}
|
||||
|
||||
stha.clear();
|
||||
co_f.clear();
|
||||
co_fx.clear();
|
||||
typename CGAL::Polynomial_traits_d<PNT_1>
|
||||
::Sturm_habicht_sequence_with_cofactors()(f,
|
||||
std::back_inserter(stha),
|
||||
std::back_inserter(co_f),
|
||||
std::back_inserter(co_fx)
|
||||
);
|
||||
|
||||
n = static_cast<int>(stha.size());
|
||||
assert(n == static_cast<int>(stha_check.size()));
|
||||
for(int i = 0; i < n; i++) {
|
||||
assert(stha[i]==stha_check[i]);
|
||||
assert(stha[i]==co_f[i]*f + co_fx[i]*fx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{ // Cofactors, defective case
|
||||
|
|
|
|||
Loading…
Reference in New Issue