diff --git a/.gitattributes b/.gitattributes index a63eb876836..e5b62f8038d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2499,7 +2499,7 @@ Modular_arithmetic/doc_tex/Modular_arithmetic/PkgDescription.tex -text Modular_arithmetic/doc_tex/Modular_arithmetic/main.tex -text Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits.tex -text Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits_ModularImage.tex -text -Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits_ModularImageInverse.tex -text +Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits_ModularImageRepresentative.tex -text Modular_arithmetic/doc_tex/Modular_arithmetic_ref/Modular_traits.tex -text Modular_arithmetic/doc_tex/Modular_arithmetic_ref/Modularizable.tex -text Modular_arithmetic/doc_tex/Modular_arithmetic_ref/Residue.tex -text diff --git a/Algebraic_foundations/test/Algebraic_foundations/Chinese_remainder_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Chinese_remainder_traits.cpp index e047c892aab..d117287efd5 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Chinese_remainder_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Chinese_remainder_traits.cpp @@ -79,7 +79,7 @@ void test_CR_for(const NT& f){ typedef CGAL::Modular_traits MT; typedef typename CGAL::Modular_traits::Residue_type MNT; typename MT::Modular_image modular_image; - typename MT::Modular_image_inv modular_image_inv; + typename MT::Modular_image_representative modular_image_representative; typedef CGAL::Chinese_remainder_traits CRT; @@ -98,7 +98,7 @@ void test_CR_for(const NT& f){ // init chinese remainder q = current_prime = CGAL::CGALi::primes[prime_index]; CGAL::Residue::set_current_prime(current_prime); - g_old = modular_image_inv(modular_image(f)); + g_old = modular_image_representative(modular_image(f)); pq= p = q; @@ -118,7 +118,7 @@ void test_CR_for(const NT& f){ CGAL::Residue::set_current_prime(current_prime); p = current_prime; - chinese_remainder(q,g_old,p,modular_image_inv(modular_image(f)),pq,g); + chinese_remainder(q,g_old,p,modular_image_representative(modular_image(f)),pq,g); try{ test = g != g_old; diff --git a/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits.tex b/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits.tex index b16ab4ff19f..9c7dbdba697 100644 --- a/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits.tex +++ b/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits.tex @@ -35,8 +35,8 @@ In case a functor is not provided, it is set to \ccc{CGAL::Null_functor}. \ccNestedType{Modular_image} {A model of \ccc{ModularTraits::ModularImage} } \ccGlue -\ccNestedType{Modular_image_inverse} -{A model of \ccc{ModularTraits::ModularImageInverse} } +\ccNestedType{Modular_image_representative} +{A model of \ccc{ModularTraits::ModularImageRepresentative} } \ccHasModels \ccRefIdfierPage{CGAL::Modular_traits}\\ diff --git a/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits_ModularImageInverse.tex b/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits_ModularImageInverse.tex deleted file mode 100644 index 45d99963bef..00000000000 --- a/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits_ModularImageInverse.tex +++ /dev/null @@ -1,26 +0,0 @@ -\begin{ccRefFunctionObjectConcept}{ModularTraits::ModularImageInverse} - -\ccDefinition - -This \ccc{AdaptableUnaryFunction} implements a $right inverse$ of the -homomorphism $\varphi$, which is implemented by \ccc{ModularTraits::ModularImage}. - -\ccTypes -\ccTypedef{typedef ModularTraits::Type result_type;}{} -\ccTypedef{typedef ModularTraits::Residue_type argument_type;}{} - -\ccCreationVariable{fo} - -\ccMethod{ -result_type -operator()(const argument_type &x);}{ -computes $\varphi^{-1}(x)$. -} - -\ccRefines -\ccc{AdaptableUnaryFunction} - -\ccSeeAlso -\ccRefConceptPage{ModularTraits} - -\end{ccRefFunctionObjectConcept} \ No newline at end of file diff --git a/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits_ModularImageRepresentative.tex b/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits_ModularImageRepresentative.tex new file mode 100644 index 00000000000..de0b91486c7 --- /dev/null +++ b/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/ModularTraits_ModularImageRepresentative.tex @@ -0,0 +1,25 @@ +\begin{ccRefFunctionObjectConcept}{ModularTraits::ModularImageRepresentative} + +\ccDefinition + +This \ccc{AdaptableUnaryFunction} returns a representative in the original type of a given modular image. More precisely, it implements the $right inverse$ of a proper restriction of the homomorphism $\varphi$, which is implemented by \ccc{ModularTraits::ModularImage}. + +\ccTypes +\ccTypedef{typedef ModularTraits::Type result_type;}{} +\ccTypedef{typedef ModularTraits::Residue_type argument_type;}{} + +\ccCreationVariable{fo} + +\ccMethod{ +result_type +operator()(const argument_type &x);}{ +computes $\varphi^{-1}(x)$. +} + +\ccRefines +\ccc{AdaptableUnaryFunction} + +\ccSeeAlso +\ccRefConceptPage{ModularTraits} + +\end{ccRefFunctionObjectConcept} \ No newline at end of file diff --git a/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/intro.tex b/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/intro.tex index e6805e6c0d7..b2e5932fbad 100644 --- a/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/intro.tex +++ b/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/intro.tex @@ -5,7 +5,7 @@ \ccRefConceptPage{Modularizable}\\ \ccRefConceptPage{ModularTraits}\\ \ccRefConceptPage{ModularTraits::ModularImage}\\ -\ccRefConceptPage{ModularTraits::ModularImageInverse}\\ +\ccRefConceptPage{ModularTraits::ModularImageRepresentative}\\ \subsection*{Types} diff --git a/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/main.tex b/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/main.tex index 54556c9c114..de9e1fbe095 100644 --- a/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/main.tex +++ b/Modular_arithmetic/doc_tex/Modular_arithmetic_ref/main.tex @@ -7,6 +7,6 @@ \input{Modular_arithmetic_ref/Modularizable} \input{Modular_arithmetic_ref/ModularTraits} \input{Modular_arithmetic_ref/ModularTraits_ModularImage} -\input{Modular_arithmetic_ref/ModularTraits_ModularImageInverse} +\input{Modular_arithmetic_ref/ModularTraits_ModularImageRepresentative} \input{Modular_arithmetic_ref/Modular_traits} diff --git a/Modular_arithmetic/include/CGAL/Modular_traits.h b/Modular_arithmetic/include/CGAL/Modular_traits.h index caf61c2bd1c..290fc60ec3e 100644 --- a/Modular_arithmetic/include/CGAL/Modular_traits.h +++ b/Modular_arithmetic/include/CGAL/Modular_traits.h @@ -42,7 +42,7 @@ public: typedef ::CGAL::Tag_false Is_modularizable; typedef ::CGAL::Null_functor Residue_type; typedef ::CGAL::Null_functor Modular_image; - typedef ::CGAL::Null_functor Modular_image_inv; + typedef ::CGAL::Null_functor Modular_image_representative; }; template @@ -74,7 +74,7 @@ public: return Residue_type(i); } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& x){ return x.get_value(); } @@ -98,7 +98,7 @@ public: return Residue_type(i); } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& x){ return NT(x.get_value()); } diff --git a/Modular_arithmetic/test/Modular_arithmetic/Modular_traits.cpp b/Modular_arithmetic/test/Modular_arithmetic/Modular_traits.cpp index cd025a302e3..16c5622e306 100644 --- a/Modular_arithmetic/test/Modular_arithmetic/Modular_traits.cpp +++ b/Modular_arithmetic/test/Modular_arithmetic/Modular_traits.cpp @@ -46,14 +46,14 @@ void test_modular_traits(){ typedef CGAL::Modular_traits MT; typedef typename MT::Residue_type Residue_type; typedef typename MT::Modular_image Modular_image; - typedef typename MT::Modular_image_inv Modular_image_inv; + typedef typename MT::Modular_image_representative Modular_image_representative; typedef typename MT::Is_modularizable Is_modularizable; typedef typename MT::NT NT; assert( !(::boost::is_same::value)); assert( - !(::boost::is_same::value)); + !(::boost::is_same::value)); assert( (::boost::is_same::value)); assert( @@ -69,8 +69,8 @@ void test_modular_traits(){ assert(modular_image(TESTT(22)) == Residue_type(1)); assert(modular_image(TESTT(777777722)) == Residue_type(1)); - Modular_image_inv modular_image_inv; - assert(modular_image_inv(modular_image(TESTT(20))) + Modular_image_representative modular_image_representative; + assert(modular_image_representative(modular_image(TESTT(20))) == TESTT(-1)); } diff --git a/Number_types/include/CGAL/CORE_BigInt.h b/Number_types/include/CGAL/CORE_BigInt.h index 09c625872cf..c20056aa154 100644 --- a/Number_types/include/CGAL/CORE_BigInt.h +++ b/Number_types/include/CGAL/CORE_BigInt.h @@ -155,7 +155,7 @@ class Modular_traits< ::CORE::BigInt > { return Residue_type(mi); } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& x){ return NT(x.get_value()); } diff --git a/Number_types/include/CGAL/CORE_BigRat.h b/Number_types/include/CGAL/CORE_BigRat.h index 6cea75761e1..b513c62944d 100644 --- a/Number_types/include/CGAL/CORE_BigRat.h +++ b/Number_types/include/CGAL/CORE_BigRat.h @@ -175,7 +175,7 @@ public: return num/den; } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& x){ return NT(x.get_value()); } diff --git a/Number_types/include/CGAL/Gmpq.h b/Number_types/include/CGAL/Gmpq.h index d6509a67373..c47aef2dfe0 100644 --- a/Number_types/include/CGAL/Gmpq.h +++ b/Number_types/include/CGAL/Gmpq.h @@ -153,7 +153,7 @@ public: return num_m / den_m; } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& x){ return NT(x.get_value()); } diff --git a/Number_types/include/CGAL/Gmpz.h b/Number_types/include/CGAL/Gmpz.h index c0990eb10d6..fad74c74a2e 100644 --- a/Number_types/include/CGAL/Gmpz.h +++ b/Number_types/include/CGAL/Gmpz.h @@ -207,7 +207,7 @@ class Modular_traits< Gmpz > { return CGAL::Residue(int(mpz_get_si(tmp_1.mpz()))); } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& x){ return NT(x.get_value()); } diff --git a/Number_types/include/CGAL/Lazy_exact_nt.h b/Number_types/include/CGAL/Lazy_exact_nt.h index b1e4174a582..b1b9c6e9eea 100644 --- a/Number_types/include/CGAL/Lazy_exact_nt.h +++ b/Number_types/include/CGAL/Lazy_exact_nt.h @@ -1362,7 +1362,7 @@ public: typedef ::CGAL::Tag_false Is_modularizable; typedef ::CGAL::Null_functor Residue_type; typedef ::CGAL::Null_functor Modular_image; - typedef ::CGAL::Null_functor Modular_image_inv; + typedef ::CGAL::Null_functor Modular_image_representative; }; template< typename ET > @@ -1379,10 +1379,10 @@ public: return modular_image(a.exact()); } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& x){ - typename MT_ET::Modular_image_inv modular_image_inv; - return NT(modular_image_inv(x)); + typename MT_ET::Modular_image_representative modular_image_representative; + return NT(modular_image_representative(x)); } }; }; diff --git a/Number_types/include/CGAL/Quotient.h b/Number_types/include/CGAL/Quotient.h index be6d9a3946a..225c8a8fc30 100644 --- a/Number_types/include/CGAL/Quotient.h +++ b/Number_types/include/CGAL/Quotient.h @@ -880,7 +880,7 @@ struct Quotient_modular_traits_base{ typedef ::CGAL::Tag_false Is_modularizable; typedef ::CGAL::Null_functor Residue_type; typedef ::CGAL::Null_functor Modular_image; - typedef ::CGAL::Null_functor Modular_image_inv; + typedef ::CGAL::Null_functor Modular_image_representative; }; template @@ -899,7 +899,7 @@ public: return num / den; } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& x){ return NT(x.get_value()); } diff --git a/Number_types/include/CGAL/Sqrt_extension/Modular_traits.h b/Number_types/include/CGAL/Sqrt_extension/Modular_traits.h index 5b916560b9e..556928f4808 100644 --- a/Number_types/include/CGAL/Sqrt_extension/Modular_traits.h +++ b/Number_types/include/CGAL/Sqrt_extension/Modular_traits.h @@ -59,10 +59,10 @@ public: } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& a){ - typename MT_ROOT::Modular_image_inv mod_image_inv_root; - typename MT_COEFF::Modular_image_inv mod_image_inv_coeff; + typename MT_ROOT::Modular_image_representative mod_image_inv_root; + typename MT_COEFF::Modular_image_representative mod_image_inv_coeff; if(a.is_extended()){ return NT( diff --git a/Number_types/include/CGAL/leda_integer.h b/Number_types/include/CGAL/leda_integer.h index 3eee3fa2169..b4fc0a77609 100644 --- a/Number_types/include/CGAL/leda_integer.h +++ b/Number_types/include/CGAL/leda_integer.h @@ -222,7 +222,7 @@ class Modular_traits< ::leda::integer > { return Residue_type ((a%NT(MOD::get_current_prime())).to_long()); } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& x){ return NT(x.get_value()); } diff --git a/Number_types/include/CGAL/leda_rational.h b/Number_types/include/CGAL/leda_rational.h index 3e96ce0113d..23fc7c18e4e 100644 --- a/Number_types/include/CGAL/leda_rational.h +++ b/Number_types/include/CGAL/leda_rational.h @@ -220,7 +220,7 @@ public: return num/den; } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& x){ return NT(x.get_value()); } diff --git a/Number_types/include/CGAL/mpq_class.h b/Number_types/include/CGAL/mpq_class.h index 1854e7360ff..06c999a65cc 100644 --- a/Number_types/include/CGAL/mpq_class.h +++ b/Number_types/include/CGAL/mpq_class.h @@ -302,7 +302,7 @@ public: return num_m/den_m; } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& x){ return NT(x.get_value()); } diff --git a/Number_types/include/CGAL/mpz_class.h b/Number_types/include/CGAL/mpz_class.h index ac8b0763e03..a64d4c3dbe8 100644 --- a/Number_types/include/CGAL/mpz_class.h +++ b/Number_types/include/CGAL/mpz_class.h @@ -311,7 +311,7 @@ public: return CGAL::Residue(int(mpz_get_si(tmp.get_mpz_t()))); } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& x){ return NT(x.get_value()); } diff --git a/Polynomial/include/CGAL/Polynomial/Modular_traits.h b/Polynomial/include/CGAL/Polynomial/Modular_traits.h index 21f5b3754c4..d4cad599f9b 100644 --- a/Polynomial/include/CGAL/Polynomial/Modular_traits.h +++ b/Polynomial/include/CGAL/Polynomial/Modular_traits.h @@ -54,12 +54,12 @@ public: } }; - struct Modular_image_inv{ + struct Modular_image_representative{ NT operator()(const Residue_type& p) const { std::vector V; - typename Mtr::Modular_image_inv modular_image_inv; + typename Mtr::Modular_image_representative modular_image_representative; for(int i=0; i<=p.degree();i++) - V.push_back(modular_image_inv(p[i])); + V.push_back(modular_image_representative(p[i])); return NT(V.begin(),V.end()); } }; diff --git a/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h b/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h index 8dd7d237951..9aefe258d6e 100644 --- a/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h +++ b/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_algorithm_M.h @@ -201,7 +201,7 @@ Polynomial modular_gcd_utcf_algorithm_M( // try chinese remainder // std::cout <<" chinese remainder round :" << n << std::endl; - typename CGAL::Modular_traits::Modular_image_inv inv_map; + typename CGAL::Modular_traits::Modular_image_representative inv_map; if(n == 1){ // init chinese remainder q = CGAL::Residue::get_current_prime(); // implicit ! diff --git a/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_dfai.h b/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_dfai.h index e3ddafc3a47..56695017539 100644 --- a/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_dfai.h +++ b/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_dfai.h @@ -257,7 +257,7 @@ Polynomial modular_gcd_utcf_dfai( // -------------------------------------- // try chinese remainder - typename CGAL::Modular_traits::Modular_image_inv inv_map; + typename CGAL::Modular_traits::Modular_image_representative inv_map; if(n == 1){ // init chinese remainder q = CGAL::Residue::get_current_prime(); // implicit ! diff --git a/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_pure_wang.h b/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_pure_wang.h index 210bf7e9948..b8a24febca5 100644 --- a/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_pure_wang.h +++ b/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_pure_wang.h @@ -298,7 +298,7 @@ Polynomial modular_gcd_utcf_pure_wang( // -------------------------------------- // try chinese remainder - typename CGAL::Modular_traits::Modular_image_inv inv_map; + typename CGAL::Modular_traits::Modular_image_representative inv_map; if(n == 1){ // init chinese remainder and wang diff --git a/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_with_wang.h b/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_with_wang.h index a0b1aabd686..991451506ee 100644 --- a/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_with_wang.h +++ b/Polynomial/include/CGAL/Polynomial/modular_gcd_utcf_with_wang.h @@ -261,7 +261,7 @@ Polynomial modular_gcd_utcf_with_wang( n++; // increase number of lucky primes } - typename CGAL::Modular_traits::Modular_image_inv inv_map; + typename CGAL::Modular_traits::Modular_image_representative inv_map; // ----------------------------- Chinese Remainder --------------------- diff --git a/Polynomial/include/CGAL/Polynomial/resultant.h b/Polynomial/include/CGAL/Polynomial/resultant.h index 279edca1d3a..1de03fb23d3 100644 --- a/Polynomial/include/CGAL/Polynomial/resultant.h +++ b/Polynomial/include/CGAL/Polynomial/resultant.h @@ -252,7 +252,7 @@ Coeff resultant_modularize( typedef typename CGAL::Modular_traits::Residue_type MScalar; typename CRT::Chinese_remainder chinese_remainder; - typename CGAL::Modular_traits::Modular_image_inv inv_map; + typename CGAL::Modular_traits::Modular_image_representative inv_map; typename PT::Degree_vector degree_vector;