added functor MonomialRepresentation

This commit is contained in:
Michael Hemmer 2008-11-11 14:25:47 +00:00
parent ee45a9c3e5
commit 5de8e376c0
7 changed files with 54 additions and 9 deletions

1
.gitattributes vendored
View File

@ -2955,6 +2955,7 @@ Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_GetInnermostCoefficient.tex
Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_InnermostLeadingCoefficient.tex -text
Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_IsZeroAt.tex -text
Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_IsZeroAtHomogeneous.tex -text
Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_MonomialRepresentation.tex -text
Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_Move.tex -text
Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_Permute.tex -text
Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_Polynomial_subresultants.tex -text

View File

@ -0,0 +1,42 @@
\begin{ccRefConcept}{PolynomialTraits_d::MonomialRepresentation}
\ccDefinition
This \ccc{Functor} outputs the monomial representation of the given polynomial,
that is, it writes all non zero terms of the polynomial as
\ccc{
std::pair<CGAL::Exponent_vector, PolynomialTraits_d::Innermost_coefficient_type>}
into the given output iterator.
\ccRefines
Assignable\\
CopyConstructible\\
DefaultConstructible\\
%\ccTypes
\ccOperations
\ccSetThreeColumns{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}{xxx}{}
\ccCreationVariable{fo}
\ccMethod{template<class OutputIterator>
OutputIterator operator()(PolynomialTraits_d::Polynomial_d p,
OutputIterator it);}
{ Writes the monom representation of $p$ into the given output iterator $it$.
\ccPrecond{ \ccc{std::iterator_traits< OutputIterator >::value_type}
must be constructible from
\ccc{std::pair<CGAL::Exponent_vector,
PolynomialTraits_d::Innermost_coefficient_type>}.}
}
%\ccHasModels
\ccSeeAlso
\ccRefIdfierPage{Polynomial_d}\\
\ccRefIdfierPage{PolynomialTraits_d}\\
\ccRefIdfierPage{PolynomialTraits_d::ConstructPolynomial}\\
\end{ccRefConcept}

View File

@ -22,6 +22,7 @@
\ccRefConceptPage{PolynomialTraits_d::ConstructPolynomial}\\
\ccRefConceptPage{PolynomialTraits_d::GetCoefficient}\\
\ccRefConceptPage{PolynomialTraits_d::GetInnermostCoefficient}\\
\ccRefConceptPage{PolynomialTraits_d::MonomialRepresentation}\\
\ccRefConceptPage{PolynomialTraits_d::ConstructCoefficientConstIteratorRange}\\
\ccRefConceptPage{PolynomialTraits_d::ConstructInnermostCoefficientConstIteratorRange}\\

View File

@ -11,6 +11,7 @@
\input{Polynomial_ref/PolynomialTraits_d_ConstructPolynomial.tex}
\input{Polynomial_ref/PolynomialTraits_d_GetCoefficient.tex}
\input{Polynomial_ref/PolynomialTraits_d_GetInnermostCoefficient.tex}
\input{Polynomial_ref/PolynomialTraits_d_MonomialRepresentation.tex}
\input{Polynomial_ref/PolynomialTraits_d_ConstructCoefficientConstIteratorRange.tex}
\input{Polynomial_ref/PolynomialTraits_d_ConstructInnermostCoefficientConstIteratorRange.tex}

View File

@ -1344,7 +1344,7 @@ void Polynomial<NT>::output_benchmark(std::ostream &os) const {
Innermost_coefficient_type;
typedef std::pair< Exponent_vector, Innermost_coefficient_type >
Exponents_coeff_pair;
typedef typename Polynomial_traits_d< Polynomial<NT> >::Get_monom_representation Gmr;
typedef typename Polynomial_traits_d< Polynomial<NT> >::Monomial_representation Gmr;
std::vector< Exponents_coeff_pair > monom_rep;
Gmr gmr;

View File

@ -688,7 +688,7 @@ public:
typedef std::pair< Exponent_vector, Innermost_coefficient_type >
Exponents_coeff_pair;
typedef std::vector< Exponents_coeff_pair > Monom_rep;
Get_monom_representation gmr;
Monomial_representation gmr;
Construct_polynomial construct;
Monom_rep mon_rep;
gmr( p, std::back_inserter( mon_rep ) );
@ -720,7 +720,7 @@ public:
typedef std::pair< Exponent_vector, Innermost_coefficient_type >
Exponents_coeff_pair;
typedef std::vector< Exponents_coeff_pair > Monom_rep;
Get_monom_representation gmr;
Monomial_representation gmr;
Construct_polynomial construct;
Monom_rep mon_rep;
gmr( p, std::back_inserter( mon_rep ) );
@ -746,7 +746,7 @@ public:
template <typename Input_iterator> Polynomial_d operator()
(const Polynomial_d& p, Input_iterator first, Input_iterator last) const {
Construct_polynomial construct;
Get_monom_representation gmr;
Monomial_representation gmr;
Monom_rep mon_rep;
gmr( p, std::back_inserter( mon_rep ));
std::vector<int> on_place, number_is;
@ -1220,7 +1220,7 @@ struct Construct_innermost_coefficient_const_iterator_range
Polynomial_d
operator()(const Polynomial_d& p, int e, int i = (d-1)) const {
Construct_polynomial construct;
Get_monom_representation gmr;
Monomial_representation gmr;
Monom_rep monom_rep;
gmr(p,std::back_inserter(monom_rep));
for(typename Monom_rep::iterator it = monom_rep.begin();
@ -1237,7 +1237,7 @@ struct Construct_innermost_coefficient_const_iterator_range
Polynomial_d operator()(const Polynomial_d& p, int i = (d-1)) const {
Construct_polynomial construct;
Get_monom_representation gmr;
Monomial_representation gmr;
Monom_rep monom_rep;
gmr(p,std::back_inserter(monom_rep));
for(typename Monom_rep::iterator it = monom_rep.begin();
@ -1461,7 +1461,7 @@ struct Construct_innermost_coefficient_const_iterator_range
// Functors not mentioned in the reference manual
//
struct Get_monom_representation {
struct Monomial_representation {
typedef std::pair< Exponent_vector, Innermost_coefficient_type >
Exponents_coeff_pair;
//typedef std::vector< Exponents_coeff_pair > Monom_rep;
@ -1499,7 +1499,7 @@ struct Construct_innermost_coefficient_const_iterator_range
create_monom_representation
( const Polynomial_d& p, OutputIterator oit, Tag_false ) const {
typedef Polynomial_traits_d< Coefficient_type > PT;
typename PT::Get_monom_representation gmr;
typename PT::Monomial_representation gmr;
for( int exponent = 0; exponent <= p.degree(); ++exponent ) {
Monom_rep monom_rep;
if ( !CGAL::is_zero(p[exponent])){

View File

@ -213,7 +213,7 @@ void test_get_monom_representation(const Polynomial_traits_d&){
typedef std::vector< Monom > Monom_rep;
typename PT::Construct_polynomial construct;
typename PT::Get_monom_representation gmr;
typename PT::Monomial_representation gmr;
{
Polynomial_d zero(0);