mirror of https://github.com/CGAL/cgal
* Fiddling with \hasModels and \refines.
* Number_types package
This commit is contained in:
parent
d35457df3b
commit
63c34025b2
|
|
@ -1524,6 +1524,7 @@ Developers_manual/doc_tex/Developers_manual/fig/reference_counting.gif -text svn
|
|||
Developers_manual/doc_tex/Developers_manual/fig/reference_counting.pdf -text svneol=unset#application/pdf
|
||||
Developers_manual/doc_tex/Developers_manual/fig/use_real.gif -text svneol=unset#image/gif
|
||||
Developers_manual/doc_tex/Developers_manual/fig/use_real.pdf -text svneol=unset#application/pdf
|
||||
Documentation/General.txt -text
|
||||
Documentation/Installation.txt -text
|
||||
Documentation/Introduction.txt -text
|
||||
Documentation/Preliminaries.txt -text
|
||||
|
|
@ -3024,6 +3025,41 @@ Nef_S2/doc_tex/Nef_S2_ref/fig/shalfloopB.gif -text svneol=unset#image/gif
|
|||
Nef_S2/doc_tex/Nef_S2_ref/fig/shalfloopB.pdf -text svneol=unset#application/pdf
|
||||
Nef_S2/include/CGAL/IO/Nef_polyhedron_iostream_S2.h -text
|
||||
Nef_S2/src/CGALQt3/Nef_S2.qtmoc.cmake -text
|
||||
Number_types/doc/Number_types/CGAL/CORE_BigFloat.h -text
|
||||
Number_types/doc/Number_types/CGAL/CORE_BigInt.h -text
|
||||
Number_types/doc/Number_types/CGAL/CORE_BigRat.h -text
|
||||
Number_types/doc/Number_types/CGAL/CORE_Expr.h -text
|
||||
Number_types/doc/Number_types/CGAL/FPU.h -text
|
||||
Number_types/doc/Number_types/CGAL/Gmpq.h -text
|
||||
Number_types/doc/Number_types/CGAL/Gmpz.h -text
|
||||
Number_types/doc/Number_types/CGAL/Gmpzf.h -text
|
||||
Number_types/doc/Number_types/CGAL/Interval_nt.h -text
|
||||
Number_types/doc/Number_types/CGAL/Lazy_exact_nt.h -text
|
||||
Number_types/doc/Number_types/CGAL/MP_Float.h -text
|
||||
Number_types/doc/Number_types/CGAL/Number_type_checker.h -text
|
||||
Number_types/doc/Number_types/CGAL/Quotient.h -text
|
||||
Number_types/doc/Number_types/CGAL/Rational_traits.h -text
|
||||
Number_types/doc/Number_types/CGAL/Root_of_2.h -text
|
||||
Number_types/doc/Number_types/CGAL/Root_of_traits.h -text
|
||||
Number_types/doc/Number_types/CGAL/Sqrt_extension.h -text
|
||||
Number_types/doc/Number_types/CGAL/double.h -text
|
||||
Number_types/doc/Number_types/CGAL/float.h -text
|
||||
Number_types/doc/Number_types/CGAL/gmpxx.h -text
|
||||
Number_types/doc/Number_types/CGAL/int.h -text
|
||||
Number_types/doc/Number_types/CGAL/leda_bigfloat.h -text
|
||||
Number_types/doc/Number_types/CGAL/leda_integer.h -text
|
||||
Number_types/doc/Number_types/CGAL/leda_rational.h -text
|
||||
Number_types/doc/Number_types/CGAL/leda_real.h -text
|
||||
Number_types/doc/Number_types/CGAL/long_double.h -text
|
||||
Number_types/doc/Number_types/CGAL/long_long.h -text
|
||||
Number_types/doc/Number_types/CGAL/simplest_rational_in_interval.h -text
|
||||
Number_types/doc/Number_types/CGAL/to_rational.h -text
|
||||
Number_types/doc/Number_types/CGAL/utils.h -text
|
||||
Number_types/doc/Number_types/CGAL/utils_classes.h -text
|
||||
Number_types/doc/Number_types/Concepts/RootOf_2.h -text
|
||||
Number_types/doc/Number_types/NumberTypeSupport.txt -text
|
||||
Number_types/doc/Number_types/PkgDescription.txt -text
|
||||
Number_types/doc/Number_types/fig/illustration.png -text svneol=unset#image/png
|
||||
Number_types/doc_tex/NumberTypeSupport/illustration.png -text
|
||||
Number_types/doc_tex/NumberTypeSupport_ref/CORE_BigFloat.tex -text
|
||||
Number_types/doc_tex/NumberTypeSupport_ref/Gmpfi.tex -text
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ corresponds to integral domains in the algebraic sense, the
|
|||
distinction results from the fact that some implementations of
|
||||
integral domains lack the (algebraically always well defined) integral
|
||||
division.
|
||||
Note that `Field` refines `IntegralDomain`. This is because
|
||||
Note that ::Field refines ::IntegralDomain. This is because
|
||||
most ring-theoretic notions like greatest common divisors become trivial for
|
||||
`Field`s. Hence we see `Field` as a refinement of
|
||||
`IntegralDomain` and not as a
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableBinaryFunction` computes the integral quotient of division
|
||||
/// with remainder.
|
||||
/// \refines `AdaptableBinaryFunction`
|
||||
/// \refines ::AdaptableBinaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
/// \sa `AlgebraicStructureTraits::Mod`
|
||||
/// \sa `AlgebraicStructureTraits::DivMod`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -191,7 +191,7 @@
|
|||
///
|
||||
/// </TABLE>
|
||||
///
|
||||
/// \refines `AdaptableFunctor`
|
||||
/// \refines ::AdaptableFunctor
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
/// \sa `AlgebraicStructureTraits::Mod`
|
||||
/// \sa `AlgebraicStructureTraits::Div`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
/// This functor is required to provide two operators. The first operator takes two
|
||||
/// arguments and returns true if the first argument divides the second argument.
|
||||
/// The second operator returns \f$c\f$ via the additional third argument.
|
||||
/// \refines `AdaptableBinaryFunction`
|
||||
/// \refines ::AdaptableBinaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
/// \sa `AlgebraicStructureTraits::IntegralDivision`
|
||||
class AlgebraicStructureTraits::Divides {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
/// \f$gcd(0,0)\f$ is defined as \f$0\f$, since \f$0\f$ is the greatest element with respect
|
||||
/// to the partial order of divisibility. This is because an element \f$a \in R\f$ is said to divide \f$b \in R\f$, iff \f$ \exists r \in R\f$ such that \f$a cdot r = b\f$.
|
||||
/// Thus, \f$0\f$ is divided by every element of the Ring, in particular by itself.
|
||||
/// \refines `AdaptableBinaryFunction`
|
||||
/// \refines ::AdaptableBinaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
class AlgebraicStructureTraits::Gcd {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
/// exists (i.e. if \f$x\f$ is divisible by \f$y\f$). Otherwise the effect of invoking
|
||||
/// this operation is undefined. Since the ring represented is an integral domain,
|
||||
/// \f$z\f$ is uniquely defined if it exists.
|
||||
/// \refines `AdaptableBinaryFunction`
|
||||
/// \refines ::AdaptableBinaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
/// \sa `AlgebraicStructureTraits::Divides`
|
||||
class AlgebraicStructureTraits::IntegralDivision {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableUnaryFunction` providing the inverse element with
|
||||
/// respect to multiplication of a `Field`.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
class AlgebraicStructureTraits::Inverse {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableUnaryFunction`,
|
||||
/// returns true in case the argument is the one of the ring.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
class AlgebraicStructureTraits::IsOne {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
/// \f$y\f$ is uniquely defined up to multiplication by units.
|
||||
///
|
||||
///
|
||||
/// \refines `AdaptableBinaryFunction`
|
||||
/// \refines ::AdaptableBinaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
class AlgebraicStructureTraits::IsSquare {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableUnaryFunction`, returns true in case the argument is the zero element of the ring.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
/// \sa `RealEmbeddableTraits::IsZero`
|
||||
class AlgebraicStructureTraits::IsZero {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableBinaryFunction` providing the k-th root.
|
||||
/// \refines `AdaptableBinaryFunction`
|
||||
/// \refines ::AdaptableBinaryFunction
|
||||
/// \sa `FieldWithRootOf`
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
class AlgebraicStructureTraits::KthRoot {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableBinaryFunction` computes the remainder of division with remainder.
|
||||
/// \refines `AdaptableBinaryFunction`
|
||||
/// \refines ::AdaptableBinaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
/// \sa `AlgebraicStructureTraits::Div`
|
||||
/// \sa `AlgebraicStructureTraits::DivMod`
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableFunctor` computes a real root of a square-free univariate
|
||||
/// polynomial.
|
||||
/// \refines `AdaptableFunctor`
|
||||
/// \refines ::AdaptableFunctor
|
||||
/// \sa `FieldWithRootOf`
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
class AlgebraicStructureTraits::RootOf {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// This `AdaptableUnaryFunction` may simplify a given object.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
class AlgebraicStructureTraits::Simplify {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableUnaryFunction` providing the square root.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
class AlgebraicStructureTraits::Sqrt {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableUnaryFunction`, computing the square of the argument.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
class AlgebraicStructureTraits::Square {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
/// hence the unit-part of a non-zero integer is its sign. For a `Field`, every
|
||||
/// non-zero element is a unit and is its own unit part, its unit normal
|
||||
/// associate being one. The unit part of zero is, by convention, one.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
class AlgebraicStructureTraits::UnitPart {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
/// \sa `CGAL::Field_with_sqrt_tag`
|
||||
/// \sa `CGAL::Field_with_kth_root_tag`
|
||||
/// \sa `CGAL::Field_with_root_of_tag`
|
||||
/// \hasModel `CGAL::Algebraic_structure_traits`
|
||||
/// \hasModel CGAL::Algebraic_structure_traits
|
||||
class AlgebraicStructureTraits {
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
///
|
||||
///
|
||||
///
|
||||
/// \refines `UniqueFactorizationDomain`
|
||||
/// \refines ::UniqueFactorizationDomain
|
||||
/// \sa `IntegralDomainWithoutDivision`
|
||||
/// \sa `IntegralDomain`
|
||||
/// \sa `UniqueFactorizationDomain`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -15,9 +15,9 @@
|
|||
/// Moreover, `CGAL::Algebraic_structure_traits` is a model of
|
||||
/// `AlgebraicStructureTraits` providing:
|
||||
/// - `CGAL::Algebraic_structure_traits::Algebraic_type` derived from `Field_tag`
|
||||
/// - `CGAL::Algebraic_structure_traits
|
||||
/// - `CGAL::Algebraic_structure_traits`
|
||||
///
|
||||
/// \refines `IntegralDomain`
|
||||
/// \refines ::IntegralDomain
|
||||
/// \sa `IntegralDomainWithoutDivision`
|
||||
/// \sa `IntegralDomain`
|
||||
/// \sa `UniqueFactorizationDomain`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
/// `Field` and `RealEmbeddable`.
|
||||
/// A model of `FieldNumberType` can be used as a template parameter
|
||||
/// for Cartesian kernels.
|
||||
/// \refines `Field`
|
||||
/// \refines `RealEmbeddable`
|
||||
/// \refines ::Field
|
||||
/// \refines ::RealEmbeddable
|
||||
class FieldNumberType {
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
/// - `CGAL::Algebraic_structure_traits::Algebraic_type` derived from `Field_with_kth_root_tag`
|
||||
/// - `CGAL::Algebraic_structure_traits::Kth_root`
|
||||
///
|
||||
/// \refines `FieldWithSqrt`
|
||||
/// \refines ::FieldWithSqrt
|
||||
/// \sa `IntegralDomainWithoutDivision`
|
||||
/// \sa `IntegralDomain`
|
||||
/// \sa `UniqueFactorizationDomain`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
/// - `CGAL::Algebraic_structure_traits::Algebraic_type` derived from `Field_with_kth_root_tag`
|
||||
/// - `CGAL::Algebraic_structure_traits::Root_of`
|
||||
///
|
||||
/// \refines `FieldWithKthRoot`
|
||||
/// \refines ::FieldWithKthRoot
|
||||
/// \sa `IntegralDomainWithoutDivision`
|
||||
/// \sa `IntegralDomain`
|
||||
/// \sa `UniqueFactorizationDomain`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
/// - `CGAL::Algebraic_structure_traits::Algebraic_type` derived from `Field_with_sqrt_tag`
|
||||
/// - `CGAL::Algebraic_structure_traits::Sqrt`
|
||||
///
|
||||
/// \refines `Field`
|
||||
/// \refines ::Field
|
||||
/// \sa `IntegralDomainWithoutDivision`
|
||||
/// \sa `IntegralDomain`
|
||||
/// \sa `UniqueFactorizationDomain`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
/// This can be considered as a relaxed version of `AlgebraicStructureTraits::Gcd`,
|
||||
/// this is needed because it is not guaranteed that `FractionTraits::Denominator_type` is a model of
|
||||
/// `UniqueFactorizationDomain`.
|
||||
/// \refines `AdaptableBinaryFunction`
|
||||
/// \refines ::AdaptableBinaryFunction
|
||||
/// \sa `Fraction`
|
||||
/// \sa `FractionTraits`
|
||||
/// \sa `FractionTraits::Decompose`
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableBinaryFunction`, returns the fraction of its arguments.
|
||||
/// \refines `AdaptableBinaryFunction`
|
||||
/// \refines ::AdaptableBinaryFunction
|
||||
/// \sa `Fraction`
|
||||
/// \sa `FractionTraits`
|
||||
/// \sa `FractionTraits::Decompose`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
///
|
||||
/// In case `Type` is not a `Fraction` all functors are `Null_functor`.
|
||||
///
|
||||
/// \hasModel `CGAL::Fraction_traits`
|
||||
/// \hasModel CGAL::Fraction_traits
|
||||
///
|
||||
/// \sa `FractionTraits::Decompose`
|
||||
/// \sa `FractionTraits::Compose`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
/// is `Tag_true`.
|
||||
///
|
||||
///
|
||||
/// \refines `ExplicitInteroperable`
|
||||
/// \refines ::ExplicitInteroperable
|
||||
/// \sa `CGAL::Coercion_traits<A,B>`
|
||||
/// \sa `ExplicitInteroperable`
|
||||
/// \sa `AlgebraicStructureTraits`
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `IntegralDomain` refines `IntegralDomainWithoutDivision` by
|
||||
/// ::IntegralDomain refines ::IntegralDomainWithoutDivision by
|
||||
/// providing an integral division.
|
||||
/// <B>Note:</B> The concept does not require the operator / for this operation.
|
||||
/// We intend to reserve the operator syntax for use with a `Field`.
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
/// - `CGAL::Algebraic_structure_traits::Integral_division`
|
||||
/// - `CGAL::Algebraic_structure_traits::Divides`
|
||||
///
|
||||
/// \refines `IntegralDomainWithoutDivision`
|
||||
/// \refines ::IntegralDomainWithoutDivision
|
||||
/// \sa `IntegralDomainWithoutDivision`
|
||||
/// \sa `IntegralDomain`
|
||||
/// \sa `UniqueFactorizationDomain`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -27,11 +27,11 @@
|
|||
/// - `CGAL::Algebraic_structure_traits::Simplify`
|
||||
/// - `CGAL::Algebraic_structure_traits::Unit_part`
|
||||
///
|
||||
/// \refines `Assignable`
|
||||
/// \refines `CopyConstructible`
|
||||
/// \refines `DefaultConstructible`
|
||||
/// \refines `EqualityComparable`
|
||||
/// \refines `FromIntConstructible`
|
||||
/// \refines ::Assignable
|
||||
/// \refines ::CopyConstructible
|
||||
/// \refines ::DefaultConstructible
|
||||
/// \refines ::EqualityComparable
|
||||
/// \refines ::FromIntConstructible
|
||||
///
|
||||
/// \sa `IntegralDomainWithoutDivision`
|
||||
/// \sa `IntegralDomain`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -27,8 +27,8 @@
|
|||
/// is a sub-ring of the real numbers and hence has characteristic zero.
|
||||
///
|
||||
///
|
||||
/// \refines `Equality Comparable`
|
||||
/// \refines `LessThanComparable`
|
||||
/// \refines ::EqualityComparable
|
||||
/// \refines ::LessThanComparable
|
||||
/// \sa `RealEmbeddableTraits`
|
||||
class RealEmbeddable {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableUnaryFunction` computes the absolute value of a number.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `RealEmbeddableTraits`
|
||||
class RealEmbeddableTraits::Abs {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableBinaryFunction` compares two real embeddable numbers.
|
||||
/// \refines `AdaptableBinaryFunction`
|
||||
/// \refines ::AdaptableBinaryFunction
|
||||
/// \sa `RealEmbeddableTraits`
|
||||
class RealEmbeddableTraits::Compare {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableUnaryFunction`, returns true in case the argument is negative.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `RealEmbeddableTraits`
|
||||
class RealEmbeddableTraits::IsNegative {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableUnaryFunction`, returns true in case the argument is positive.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `RealEmbeddableTraits`
|
||||
class RealEmbeddableTraits::IsPositive {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// `AdaptableUnaryFunction`, returns true in case the argument is 0.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `RealEmbeddableTraits`
|
||||
/// \sa `AlgebraicStructureTraits::IsZero`
|
||||
class RealEmbeddableTraits::IsZero {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// This `AdaptableUnaryFunction` computes the sign of a real embeddable number.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `RealEmbeddableTraits`
|
||||
class RealEmbeddableTraits::Sgn {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
/// embeddable number.
|
||||
/// Remark: In order to control the quality of approximation one has to resort
|
||||
/// to methods that are specific to NT. There are no general guarantees whatsoever.
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `RealEmbeddableTraits`
|
||||
class RealEmbeddableTraits::ToDouble {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
/// number \f$x\f$ a double interval containing \f$x\f$.
|
||||
/// This interval is represented by `std::pair<double,double>`.
|
||||
///
|
||||
/// \refines `AdaptableUnaryFunction`
|
||||
/// \refines ::AdaptableUnaryFunction
|
||||
/// \sa `RealEmbeddableTraits`
|
||||
class RealEmbeddableTraits::ToInterval {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
/// In case the associated type is `RealEmbeddable` all functors are provided.
|
||||
/// In case a functor is not provided, it is set to `CGAL::Null_functor`.
|
||||
///
|
||||
/// \hasModel `CGAL::Real_embeddable_traits`
|
||||
/// \hasModel CGAL::Real_embeddable_traits
|
||||
class RealEmbeddableTraits {
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
/// `IntegralDomainWithoutDivision` and `RealEmbeddable`.
|
||||
/// A model of `RingNumberType` can be used as a template parameter
|
||||
/// for Homogeneous kernels.
|
||||
/// \refines `IntegralDomainWithoutDivision`
|
||||
/// \refines `RealEmbeddable`
|
||||
/// \refines ::IntegralDomainWithoutDivision
|
||||
/// \refines ::RealEmbeddable
|
||||
class RingNumberType {
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// \addtogroup PkgAlgebraicFoundations Algebraic Foundations
|
||||
/// @{
|
||||
/// \addtogroup concepts Concepts
|
||||
/// \addtogroup PkgAlgebraicFoundationsConcepts Concepts
|
||||
/// @{
|
||||
|
||||
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
/// - `CGAL::Algebraic_structure_traits::Algebraic_type`
|
||||
/// derived from `Unique_factorization_domain_tag`
|
||||
/// - `CGAL::Algebraic_structure_traits::Gcd`
|
||||
/// \refines `IntegralDomain`
|
||||
/// \refines ::IntegralDomain
|
||||
/// \sa `IntegralDomainWithoutDivision`
|
||||
/// \sa `IntegralDomain`
|
||||
/// \sa `UniqueFactorizationDomain`
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
/// The main CGAL namespace. All \cgal templates, classes and function
|
||||
/// reside here or in a subnamespace.
|
||||
namespace CGAL {
|
||||
/// The implementation namespace of \cgal. Here be dragons.
|
||||
namespace detail {
|
||||
}
|
||||
}
|
||||
|
||||
class Assignable {};
|
||||
class DefaultConstructible {};
|
||||
class CopyConstructible {};
|
||||
class EqualityComparable {};
|
||||
class LessThanComparable {};
|
||||
class AdaptableFunctor {};
|
||||
class AdaptableUnaryFunction {};
|
||||
class AdaptableBinaryFunction {};
|
||||
|
|
@ -124,7 +124,7 @@ and passing the begin/end iterator of the vector to the convex hull
|
|||
function, we use helper classes that turn file pointers into
|
||||
iterators.
|
||||
|
||||
\ccIncludeExampleCode{Convex_hull_2/iostream_convex_hull_2.cpp}
|
||||
\cgalexample{Convex_hull_2/iostream_convex_hull_2.cpp}
|
||||
|
||||
In the example code you see input and output stream iterators
|
||||
templated with the point type. A `std::istream_iterator<Point_2>`
|
||||
|
|
|
|||
|
|
@ -36,10 +36,12 @@ MULTILINE_CPP_IS_BRIEF = NO
|
|||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES += sc{1}="<span style=\"font-variant: small-caps;\">\1</span>"
|
||||
ALIASES = sc{1}="<span style=\"font-variant: small-caps;\">\1</span>"
|
||||
ALIASES += cgal="*CGAL*"
|
||||
ALIASES += stl="*STL*"
|
||||
ALIASES += leda="*LEDA*"
|
||||
ALIASES += gcc="*GCC*"
|
||||
ALIASES += cpp="*C++*"
|
||||
ALIASES += CC="*C++*"
|
||||
ALIASES += cgalexample{1}="<br><b>File</b> \1 \include \1"
|
||||
ALIASES += cgalbib{1}="<dl class=\"section\"><dt>BibTeX:</dt><dd>\cite \1</dd></dl>"
|
||||
|
|
@ -106,12 +108,13 @@ SHOW_FILES = YES
|
|||
SHOW_NAMESPACES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
LAYOUT_FILE =
|
||||
CITE_BIB_FILES = cgal_manual.bib
|
||||
CITE_BIB_FILES = cgal_manual.bib \
|
||||
geom.bib
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
QUIET = YES
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
|
|
@ -123,6 +126,8 @@ WARN_LOGFILE =
|
|||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ../../Algebraic_foundations/doc/Algebraic_foundations \
|
||||
../../Number_types/doc/Number_types \
|
||||
.. \
|
||||
.
|
||||
# ../../AABB_tree/doc/AABB_tree \
|
||||
# ../../Algebraic_kernel_d/doc/Algebraic_kernel_d \
|
||||
|
|
@ -180,7 +185,6 @@ INPUT = ../../Algebraic_foundations/doc/Algebraic_foundations \
|
|||
# ../../Nef_2/doc/Nef_2 \
|
||||
# ../../Nef_3/doc/Nef_3 \
|
||||
# ../../Nef_S2/doc/Nef_S2 \
|
||||
# ../../Number_types/doc/Number_types \
|
||||
# ../../Optimisation_basic/doc/Optimisation_basic \
|
||||
# ../../Optimisation_doc/doc/Optimisation_doc \
|
||||
# ../../Partition_2/doc/Partition_2 \
|
||||
|
|
@ -217,7 +221,6 @@ INPUT = ../../Algebraic_foundations/doc/Algebraic_foundations \
|
|||
# ../../Union_find/doc/Union_find \
|
||||
# ../../Voronoi_diagram_2/doc/Voronoi_diagram_2 \
|
||||
# ../../Width_3/doc/Width_3 \
|
||||
.
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = *.h \
|
||||
*.txt
|
||||
|
|
@ -226,10 +229,13 @@ EXCLUDE =
|
|||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH = ../../Algebraic_foundations/examples/Algebraic_foundations
|
||||
EXAMPLE_PATH = ../../Algebraic_foundations/examples/Algebraic_foundations \
|
||||
../../Number_types/examples/Number_types \
|
||||
../../Convex_hull_2/examples/Convex_hull_2
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = YES
|
||||
IMAGE_PATH = ../../Algebraic_foundations/doc/Algebraic_foundations/fig
|
||||
IMAGE_PATH = ../../Algebraic_foundations/doc/Algebraic_foundations/fig \
|
||||
../../Number_types/doc/Number_types/fig
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,31 @@
|
|||
/// The CORE namespace contains number types of the \ref corent "CORE library"
|
||||
/// adapted to \cgal concepts.
|
||||
namespace CORE {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// The class `CORE::BigFloat` is a variable precision floating-point type.
|
||||
/// Rounding mode and precision (i.e. mantissa length) of
|
||||
/// `CORE::BigFloat` can be set.
|
||||
/// Since it also carries the error of a computed value.
|
||||
///
|
||||
///
|
||||
/// This number type is provided by the <span class="textsc">Core</span> library \cite klpy-clp-99.
|
||||
/// \cgal defines the necessary functions so that this class complies to the
|
||||
/// requirements on number types.
|
||||
///
|
||||
/// \models ::FieldWithKthRoot
|
||||
/// \models ::RealEmbeddable
|
||||
/// \models ::FromDoubleConstructible
|
||||
class BigFloat {
|
||||
public:
|
||||
|
||||
}; /* class CORE::BigFloat */
|
||||
/// @}
|
||||
} // namespace CORE
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
namespace CORE {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// The class `CORE::BigInt` provides exact computation in \f$Z\f$.
|
||||
/// Operations and comparisons between objects of this type are guaranteed
|
||||
/// to be exact.
|
||||
/// This number type is provided by the <span class="textsc">Core</span> library \cite klpy-clp-99.
|
||||
/// \cgal defines the necessary functions so that this class complies to the
|
||||
/// requirements on number types.
|
||||
///
|
||||
/// \models ::EuclideanRing
|
||||
/// \models ::RealEmbeddable
|
||||
class BigInt {
|
||||
public:
|
||||
|
||||
}; /* class CORE::BigInt */
|
||||
/// @}
|
||||
} // namespace CORE
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
namespace CORE {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// The class `CORE::BigRat` provides exact computation in \f$R\f$.
|
||||
/// Operations and comparisons between objects of this type are guaranteed to be exact.
|
||||
/// This number type is provided by the <span class="textsc">Core</span> library \cite klpy-clp-99.
|
||||
/// \cgal defines the necessary functions so that this class complies to the
|
||||
/// requirements on number types.
|
||||
///
|
||||
/// \models ::Field
|
||||
/// \models ::RealEmbeddable
|
||||
/// \models ::Fraction
|
||||
/// \models ::FromDoubleConstructible
|
||||
class BigRat {
|
||||
public:
|
||||
|
||||
}; /* class BigRat */
|
||||
/// @}
|
||||
} // namespace CORE
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
namespace CORE {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// The class `CORE::Expr` provides exact computation over the subset of real
|
||||
/// numbers that contains integers, and which is closed by the operations
|
||||
/// \f$+,-, × ,/, \sqrt{} \f$ and \f$kth_root\f$. Operations and comparisons
|
||||
/// between objects of this type are guaranteed to be exact.
|
||||
/// This number type is provided by the
|
||||
/// <span class="textsc">Core</span> library \cite klpy-clp-99.
|
||||
/// \cgal defines the necessary functions so that this class complies to the
|
||||
/// requirements on number types.
|
||||
///
|
||||
/// \models ::FieldWithRootOf
|
||||
/// \models ::RealEmbeddable
|
||||
/// \models ::FromDoubleConstructible
|
||||
class Expr {
|
||||
public:
|
||||
|
||||
}; /* class CORE::Expr */
|
||||
/// @}
|
||||
} // namespace CORE
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
/// Floating-point arithmetic, as specified by the IEEE-754 standard, allows to use
|
||||
/// so-called directed rounding for the following arithmetic operations: addition,
|
||||
/// subtraction, multiplication, division and square root. The default behavior is
|
||||
/// that the result of such an arithmetic operation is the closest floating-point
|
||||
/// number to the exact real result of the operation (rounding to the nearest).
|
||||
/// The other rounding modes are: round towards plus infinity, round towards minus
|
||||
/// infinity, and round towards zero.
|
||||
///
|
||||
/// Interval arithmetic uses such directed rounding modes to offer guaranteed
|
||||
/// enclosures for the evaluation of real functions, such as with \cgal's
|
||||
/// `Interval_nt` class.
|
||||
///
|
||||
/// In order to efficiently evaluate sequences of interval arithmetic operations,
|
||||
/// such as a geometric predicate computing for example a determinant, it is
|
||||
/// advised to reduce the number of rounding mode changes, which otherwise are
|
||||
/// performed for each arithmetic operation. \cgal exploits the fact that it is
|
||||
/// possible to compute a sequence of interval arithmetic operations by doing only
|
||||
/// one rounding mode change around the whole function evaluation in order to
|
||||
/// benefit from this optimization.
|
||||
///
|
||||
/// The class `Protect_FPU_rounding` allows to easily benefit from this.
|
||||
/// Its constructor saves the current rounding mode in the object, and then sets
|
||||
/// the current rounding mode to the value provided as argument to the constructor.
|
||||
/// The destructor sets the rounding mode back to the saved value.
|
||||
/// This allows to protect a block of code determined by a C++ scope, and have
|
||||
/// the destructor take care of restoring the value automatically.
|
||||
///
|
||||
/// The related class `Set_ieee_double_precision` allows to similarly protect
|
||||
/// a block of code from excess precision on some machines (x86 typically with
|
||||
/// the traditional FPU, not the more recent SSE2). Note that
|
||||
/// `Protect_FPU_rounding_mode`, when changing rounding modes, also sets the precision
|
||||
/// to the correct 46 bit precision, hence providing a similar effect to
|
||||
/// `Set_ieee_double_precision`. This notably affects the `Residue` class.
|
||||
///
|
||||
/// Note for Visual C++ 64-bit users: due to a compiler bug, the stack unwinding
|
||||
/// process happenning when an exception is thrown does not correctly execute the
|
||||
/// rounding mode restoration when the `Protect_FPU_rounding` object is
|
||||
/// destroyed. Therefore, for this configuration, some explicit code has to be
|
||||
/// added.
|
||||
///
|
||||
/// Parameters
|
||||
/// --------------
|
||||
///
|
||||
/// The template parameter `Protected` is a Boolean parameter, which defaults
|
||||
/// to `true`. It follows the same parameter of the `Interval_nt` class.
|
||||
/// When it is `false`, the constructor and the destructor of the class do
|
||||
/// nothing (this is meant to be used in a context where you know that the rounding
|
||||
/// mode change has been taken care of at a higher level in the call stack.
|
||||
/// What follows describes the behavior when the parameter has its default value,
|
||||
/// `true`.
|
||||
///
|
||||
/// \sa `CGAL::Set_ieee_double_precision`
|
||||
template< bool Protected = true >
|
||||
class Protect_FPU_rounding {
|
||||
public:
|
||||
/*!
|
||||
The current rounding mode is saved in the object, and rounding mode is set to `r` which can be any of `CGAL_FE_TONEAREST`, `CGAL_FE_TOWARDZERO`, `CGAL_FE_UPWARD` (the default) and `CGAL_FE_DOWNWARD`.
|
||||
*/
|
||||
Protect_FPU_rounding(FPU_CW_t r = CGAL_FE_UPWARD);
|
||||
|
||||
/// The rounding mode is restored to the saved value.
|
||||
~Protect_FPU_rounding();
|
||||
|
||||
}; /* class Protect_FPU_rounding */
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// The IEEE754 standard specifies that the precision of double precision
|
||||
/// floating-point numbers should be 53 bits, with 11 bits for the exponent range.
|
||||
///
|
||||
/// Some processors violate this rule by providing excess precision during some
|
||||
/// computations (when values are in registers). This is the case of the x86
|
||||
/// Intel processor and compatible processors (note that the SSE2 more recent
|
||||
/// alternative FPU is fortunately not affected by this issue). The effect of such
|
||||
/// excess precision can be a problem for some computations, since it can produce
|
||||
/// so-called double rounding effects, where actually <I>less</I> precision is
|
||||
/// actually provided! It can also be the root of non-deterministic computations
|
||||
/// depending on compiler optimizations or not (since this affects how long
|
||||
/// variables are kept in registers), for example numerical floating-point
|
||||
/// values get computed with slightly different results. Finally, it affects code
|
||||
/// that carefully makes use of cancellation properties, like `Residue`.
|
||||
///
|
||||
/// The class `Set_ieee_double_precision` provides a mechanism to set
|
||||
/// the correct 53 bits precision for a block of code. It does so by having
|
||||
/// a default constructor that sets a particular mode on the FPU which corrects
|
||||
/// the problem, and have its destructor reset the mode to its previous state.
|
||||
///
|
||||
/// Note that nothing can be done for the excess range of the exponent, which
|
||||
/// affects underflow and overflow cases, fortunately less frequent.
|
||||
///
|
||||
/// Note also that in the process of setting the correct precision, the rounding
|
||||
/// mode is also set to the nearest.
|
||||
///
|
||||
/// Moreover, some compilers provide a flag that performs this setting at the
|
||||
/// time of program startup. For example, GCC provides the option <TT>-mpc64</TT>
|
||||
/// since release 4.3 which does exactly this. Other compilers may have similar
|
||||
/// options.
|
||||
///
|
||||
/// Similarly, some third-party libraries may do the same thing as part of their
|
||||
/// startup process, and this is notably the case of LEDA (at least some versions
|
||||
/// of it). \cgal does not enforce this at startup as it would impact
|
||||
/// computations with long double performed by other codes in the same program.
|
||||
///
|
||||
/// Note that this property is notably required for proper functionning of the
|
||||
/// `Residue` class that performs modular arithmetic using efficient
|
||||
/// floating-point operations.
|
||||
///
|
||||
/// Note concerning Visual C++ 64-bit: due to a compiler bug, the stack unwinding
|
||||
/// process happenning when an exception is thrown does not correctly execute the
|
||||
/// restoring operation when the `Set_ieee_double_precision` object is
|
||||
/// destroyed. Therefore, for this configuration, some explicit code has to be
|
||||
/// added if you care about the state being restored.
|
||||
///
|
||||
/// If the platform is not affected by the excess precision problem, this class
|
||||
/// becomes an empty class doing nothing.
|
||||
///
|
||||
/// \sa `CGAL::Protect_FPU_rounding<Protected>`
|
||||
/// \sa `CGAL::Residue`
|
||||
class Set_ieee_double_precision {
|
||||
public:
|
||||
/// Sets the precision of operations on double to 53bits. Note that
|
||||
/// the rounding mode is set to the nearest in the same process.
|
||||
Set_ieee_double_precision();
|
||||
|
||||
/// The precision and rounding modes are reset to the values they held
|
||||
/// before the constructor was called.
|
||||
~Set_ieee_double_precision();
|
||||
|
||||
}; /* class Set_ieee_double_precision */
|
||||
|
||||
/// \relates Set_ieee_double_precision
|
||||
///
|
||||
/// Sets the precision of operations on double to 53bits. Note that
|
||||
/// the rounding mode is set to the nearest in the same process.
|
||||
///
|
||||
/// Essentially does the same thing as the default constructor of
|
||||
/// `Set_ieee_double_precision` except that it does not perform the
|
||||
/// save and restore of the previous state.
|
||||
void force_ieee_double_precision();
|
||||
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// An object of the class `Gmpq` is an arbitrary precision rational
|
||||
/// number based on the <span class="textsc">Gnu</span> Multiple Precision Arithmetic Library.
|
||||
///
|
||||
/// \models ::Field
|
||||
/// \models ::RealEmbeddable
|
||||
/// \models ::Fraction
|
||||
///
|
||||
/// Implementation
|
||||
/// --------------
|
||||
/// `Gmpq`s are reference counted.
|
||||
///
|
||||
class Gmpq {
|
||||
public:
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates an uninitialized `Gmpq` `q`.
|
||||
*/
|
||||
Gmpq();
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpq` initialized with `i`.
|
||||
*/
|
||||
Gmpq(int i);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpq` initialized with `n`.
|
||||
*/
|
||||
Gmpq(Gmpz n);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpq` initialized with `f`.
|
||||
*/
|
||||
Gmpq(Gmpfr f);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpq` initialized with `n/d`.
|
||||
*/
|
||||
Gmpq(int n, int d);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpq` initialized with `n/d`.
|
||||
*/
|
||||
Gmpq(signed long n, unsigned long d);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpq` initialized with `n/d`.
|
||||
*/
|
||||
Gmpq(unsigned long n, unsigned long d);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpq` initialized with `n/d`.
|
||||
*/
|
||||
Gmpq(Gmpz n, Gmpz d);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpq` initialized with `d`.
|
||||
*/
|
||||
Gmpq(double d);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpq` initialized with `str`, which can be an integer like "41" or a fraction like "41/152". White space is allowed in the string, and ignored.
|
||||
*/
|
||||
Gmpq(const std::string& str);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpq` initialized with `str` in base `base`, which is an integer between 2 and 62. White space in the string is ignored.
|
||||
*/
|
||||
Gmpq(const std::string& str, int base);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// There are two access functions, namely to the
|
||||
/// numerator and the denominator of a rational.
|
||||
/// Note that these values are not uniquely defined.
|
||||
/// It is guaranteed that `q.numerator()` and
|
||||
/// `q.denominator()` return values `nt_num` and
|
||||
/// `nt_den` such that `q = nt_num/nt_den`, only
|
||||
/// if `q.numerator()` and `q.denominator()` are called
|
||||
/// consecutively wrt. `q`, i.e. `q` is not involved in
|
||||
/// any other operation between these calls.
|
||||
/// @{
|
||||
/*!
|
||||
returns the numerator of `q`.
|
||||
*/
|
||||
Gmpz numerator() const;
|
||||
|
||||
/*!
|
||||
returns the denominator of `q`.
|
||||
*/
|
||||
Gmpz denominator() const;
|
||||
/// @}
|
||||
|
||||
}; /* class Gmpq */
|
||||
|
||||
/// \relates Gmpq
|
||||
/// writes `q` to the ostream `out`, in the form \f$n/d\f$.
|
||||
std::ostream& operator<<(std::ostream& out, const Gmpq& q);
|
||||
|
||||
/// \relates Gmpq
|
||||
/// reads a number from `in`, then converts it to a `Gmpq`. The number may be an integer, a rational number in the form \f$n/d\f$, or a floating-point number.
|
||||
std::istream& operator>>(std::istream& in, Gmpq& q);
|
||||
|
||||
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// An object of the class `Gmpz` is an arbitrary precision integer
|
||||
/// based on the <span class="textsc">Gnu</span> Multiple Precision Arithmetic Library.
|
||||
///
|
||||
/// \models ::EuclideanRing
|
||||
/// \models ::RealEmbeddable
|
||||
///
|
||||
/// Implementation
|
||||
/// --------------
|
||||
/// `Gmpz`s are reference counted.
|
||||
///
|
||||
/// }; /* class Gmpz */
|
||||
class Gmpz {
|
||||
public:
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates an uninitialized multiple precision integer `z`.
|
||||
*/
|
||||
Gmpz();
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a multiple-precision integer initialized with `i`.
|
||||
*/
|
||||
Gmpz(int i);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a multiple-precision integer initialized with the integral part of `d`.
|
||||
*/
|
||||
Gmpz(double d);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
prefix increment.
|
||||
*/
|
||||
Gmpz & operator++();
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
postfix increment.
|
||||
*/
|
||||
Gmpz operator++(int);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
prefix decrement.
|
||||
*/
|
||||
Gmpz & operator--();
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
postfix decrement.
|
||||
*/
|
||||
Gmpz operator--(int);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
rightshift by i, where \f$i>=0\f$.
|
||||
*/
|
||||
Gmpz & operator>>=(const long& i);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
leftshift by i, where \f$i>=0\f$.
|
||||
*/
|
||||
Gmpz & operator<<=(const long& i);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
bitwise AND.
|
||||
*/
|
||||
Gmpz & operator&=(const Gmpz& b);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
bitwise IOR.
|
||||
*/
|
||||
Gmpz & operator|=(const Gmpz& b);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
bitwise XOR.
|
||||
*/
|
||||
Gmpz & operator^=(const Gmpz& b);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
Returns the sign of `z`.
|
||||
*/
|
||||
Sign sign() const;
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
Returns the bit-size (that is, the number of bits needed to represent the mantissa) of `z`.
|
||||
*/
|
||||
size_t bit_size() const;
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
Returns the size in limbs of `z`. A limb is the type used by <span class="textsc">Gmp</span> to represent the integer (usually `long`).
|
||||
*/
|
||||
size_t size() const;
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
Returns the approximate number of decimal digits needed to represent `z`. Approximate means either a correct result, either the correct result plus one.
|
||||
*/
|
||||
size_t approximate_decimal_length() const;
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
Returns a double approximation of `z`. The integer is truncated if needed. If the exponent of the conversion is too big, the result is system dependent (returning infinity where it is supported).
|
||||
*/
|
||||
double to_double() const;
|
||||
/// @}
|
||||
|
||||
}; /* class Gmpz */
|
||||
|
||||
///
|
||||
/// \relates Gmpz
|
||||
/// rightshift by \f$i\f$.
|
||||
Gmpz operator>>(const Gmpz& a, unsigned long i);
|
||||
///
|
||||
/// \relates Gmpz
|
||||
/// leftshift by \f$i\f$.
|
||||
Gmpz operator<<(const Gmpz& a, unsigned long i);
|
||||
|
||||
///
|
||||
/// \relates Gmpz
|
||||
/// writes `z` to the ostream `out`.
|
||||
std::ostream& operator<<(std::ostream& out, const Gmpz& z);
|
||||
|
||||
///
|
||||
/// \relates Gmpz
|
||||
/// reads an integer from `in`, then converts it to a `Gmpz`.
|
||||
std::istream& operator>>(std::istream& in, Gmpz& z);
|
||||
|
||||
///
|
||||
/// \relates Gmpz
|
||||
/// bitwise AND.
|
||||
Gmpz operator&(const Gmpz& a, const Gmpz& b);
|
||||
///
|
||||
/// \relates Gmpz
|
||||
/// bitwise IOR.
|
||||
Gmpz operator|(const Gmpz& a, const Gmpz& b);
|
||||
///
|
||||
/// \relates Gmpz
|
||||
/// bitwise XOR.
|
||||
Gmpz operator^(const Gmpz& a, const Gmpz& b);
|
||||
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// This is an multiple-precision floating-point type; it can represent
|
||||
/// numbers of the form \f$m*2^e\f$, where \f$m\f$ is an arbitrary precision integer
|
||||
/// based on the <span class="textsc">Gnu</span> Multiple Precision Arithmetic Library, and \f$e\f$
|
||||
/// is of type `long`. This type can be considered exact, even if the
|
||||
/// exponent is not a multiple-precision number. This number type offers
|
||||
/// functionality very similar to `MP_Float` but is generally faster.
|
||||
///
|
||||
/// \models ::EuclideanRing
|
||||
/// \models ::RealEmbeddable
|
||||
///
|
||||
/// Implementation
|
||||
/// --------------
|
||||
/// The significand \f$m\f$ of a `Gmpzf` is a `Gmpz` and is reference
|
||||
/// counted. The exponent \f$e\f$ of a `Gmpzf` is a <TT>long</TT>.
|
||||
///
|
||||
class Gmpzf {
|
||||
public:
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpzf` initialized with \f$0\f$.
|
||||
*/
|
||||
Gmpzf();
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpzf` initialized with `i`.
|
||||
*/
|
||||
Gmpzf(int i);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpzf` initialized with `l`.
|
||||
*/
|
||||
Gmpzf(long int l);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpzf` initialized with `i`.
|
||||
*/
|
||||
Gmpzf(const Gmpz& i);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpzf` initialized with `f`.
|
||||
*/
|
||||
Gmpzf(const Gmpfr& f);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
creates a `Gmpzf` initialized with `d`.
|
||||
*/
|
||||
Gmpzf(double d);
|
||||
/// @}
|
||||
|
||||
}; /* class Gmpzf */
|
||||
|
||||
///
|
||||
/// \relates Gmpzf
|
||||
/// writes a double approximation of `f` to the ostream `out`.
|
||||
std::ostream& operator<<(std::ostream& out, const Gmpzf& f);
|
||||
|
||||
///
|
||||
/// \relates Gmpzf
|
||||
/// writes an exact representation of `f` to the ostream `out`.
|
||||
std::ostream& print (std::ostream& out, const Gmpzf& f);
|
||||
|
||||
///
|
||||
/// \relates Gmpzf
|
||||
/// reads a `double` from `in`, then converts it to a `Gmpzf`.
|
||||
std::istream& operator>>(std::istream& in, Gmpzf& f);
|
||||
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,352 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// This section describes briefly what interval arithmetic is, its implementation
|
||||
/// in \cgal, and its possible use by geometric programs.
|
||||
/// The main reason for having interval arithmetic in \cgal is its integration
|
||||
/// into the filtered robust and fast predicates scheme, but we also provide a
|
||||
/// number type so that you can use it separately if you find any use for it,
|
||||
/// such as interval analysis, or to represent data with tolerance...
|
||||
///
|
||||
/// The purpose of interval arithmetic is to provide an efficient way to bound
|
||||
/// the roundoff errors made by floating point computations.
|
||||
/// You can choose the behavior of your program depending on these errors.
|
||||
/// You can find more theoretical information on this topic in
|
||||
/// \cite cgal:bbp-iayed-01.
|
||||
///
|
||||
/// Interval arithmetic is a large concept and we will only consider here a
|
||||
/// simple arithmetic based on intervals whose bounds are <I>double</I>s.
|
||||
/// So each variable is an interval representing any value inside the interval.
|
||||
/// All arithmetic operations (+, -, \f$*\f$, \f$/\f$, \f$ \sqrt{} \f$, `square()`,
|
||||
/// `min()`, `max()` and `abs()`) on intervals preserve the inclusion.
|
||||
/// This property can be expressed by the following formula (\f$x\f$ and \f$y\f$ are
|
||||
/// real, \f$X\f$ and \f$Y\f$ are intervals, \f$\mathcal{OP}\f$ is an arithmetic operation):
|
||||
///
|
||||
/// \f[
|
||||
///
|
||||
/// \forall x \in X, \forall y \in Y, (x \mathcal{OP} y)
|
||||
/// \in (X \mathcal{OP} Y)
|
||||
///
|
||||
/// \f]
|
||||
///
|
||||
/// For example, if the final result of a sequence of arithmetic operations is
|
||||
/// an interval that does not contain zero, then you can safely determine its sign.
|
||||
///
|
||||
/// Parameters
|
||||
/// --------------
|
||||
///
|
||||
/// The template parameter `Protected` is a Boolean parameter, which defaults
|
||||
/// to `true`. It provides a way to select faster computations by avoiding
|
||||
/// rounding mode switches, at the expense of more care to be taken by the user
|
||||
/// (see below). The default value, `true`, is the safe way, and takes care of
|
||||
/// proper rounding mode changes. When specifying `false`, the user has to
|
||||
/// take care about setting the rounding mode towards plus infinity before
|
||||
/// doing any computations with the interval class. He can do so using the
|
||||
/// `Protect_FPU_rounding` class for example.
|
||||
///
|
||||
/// Implementation
|
||||
/// --------------
|
||||
///
|
||||
/// The operations on `Interval_nt` with the default parameter
|
||||
/// `true`, are automatically protected against rounding modes, and
|
||||
/// are thus slower than those on `Interval_nt_advanced`, but
|
||||
/// easier to use. Users that need performance are encouraged to use
|
||||
/// `Interval_nt_advanced` instead.
|
||||
///
|
||||
/// Changing the rounding mode affects all floating point
|
||||
/// computations, and might cause problems with parts of your code,
|
||||
/// or external libraries (even \cgal), that expect the rounding mode
|
||||
/// to be the default (round to the nearest).
|
||||
///
|
||||
/// We provide two interfaces to change the rounding mode. The first
|
||||
/// one is to use a protector object whose default constructor and
|
||||
/// destructor will take care of changing the rounding mode. The
|
||||
/// protector is implemented using `Protect_FPU_rounding`.
|
||||
///
|
||||
/// The second one is the following detailed set of functions and
|
||||
/// macros described in \ref roundingfuncs
|
||||
///
|
||||
/// Example
|
||||
/// -------
|
||||
/// Protecting an area of code that uses operations on the class
|
||||
/// `Interval_nt_advanced` can be done in the following way:
|
||||
///
|
||||
/// \code{.cpp}
|
||||
/// {
|
||||
/// Interval_nt_advanced::Protector P;
|
||||
/// ... // The code to be protected.
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
/// The basic idea is to use the directed rounding modes specified by the
|
||||
/// <I>IEEE 754</I> standard, which are implemented by almost all processors
|
||||
/// nowadays.
|
||||
///
|
||||
/// It states that you have the possibility, concerning the basic floating point
|
||||
/// operations (\f$+,-,*,/,\sqrt{}\f$) to specify the rounding mode of each operation
|
||||
/// instead of using the default, which is set to 'round to the nearest'.
|
||||
/// This feature allows us to compute easily on intervals. For example, to
|
||||
/// add the two intervals [a.i;a.s] and [b.i;b.s], compute \f$c.i=a.i+b.i\f$ rounded
|
||||
/// towards minus infinity, and \f$c.s=a.s+b.s\f$ rounded towards plus infinity, and
|
||||
/// the result is the interval [c.i;c.s]. This method can be extended easily to
|
||||
/// the other operations.
|
||||
///
|
||||
/// The problem is that we have to change the rounding mode very often, and the
|
||||
/// functions of the C library doing this operation are slow and not portable.
|
||||
/// That's why assembly versions are used as often as possible.
|
||||
/// Another trick is to store the opposite of the lower bound, instead of the
|
||||
/// lower bound itself, which allows us to never change the rounding mode inside
|
||||
/// simple operations. Therefore, all basic operations, which are in the class
|
||||
/// `Interval_nt_advanced` assume that the rounding mode is set to
|
||||
/// 'round to infinity', and everything works with this correctly set.
|
||||
///
|
||||
/// So, if the user needs the speed of `Interval_nt_advanced`, he
|
||||
/// must take care of setting the rounding mode to 'round to
|
||||
/// infinity' before each block of operations on this number type.
|
||||
/// And if other operations might be affected by this, he must take
|
||||
/// care to reset it to 'round to the nearest' before they are
|
||||
/// executed.
|
||||
///
|
||||
/// \note
|
||||
/// - On Intel platforms (with any operating system and compiler),
|
||||
/// due to a misfeature of the floating point unit, which does
|
||||
/// not handle exactly IEEE compliant operations on doubles, we
|
||||
/// are forced to use a workaround which slows down the code,
|
||||
/// but is only useful when the intervals can overflow or
|
||||
/// underflow. If you know that the intervals will never
|
||||
/// overflow nor underflow for your code, then you can disable
|
||||
/// this workaround with the flag
|
||||
/// `::CGAL_IA_NO_X86_OVER_UNDER_FLOW_PROTECT`. Other
|
||||
/// platforms are not affected by this flag.
|
||||
/// - When optimizing, compilers usually propagate the value of variables when
|
||||
/// they know it's a constant. This can break the interval routines because
|
||||
/// the compiler then does some floating point operations on these constants
|
||||
/// with the default rounding mode, which is wrong. This kind of problem
|
||||
/// is avoided by stopping constant propagation in the interval routines.
|
||||
/// However, this solution slows down the code and is rarely useful, so you
|
||||
/// can disable it by setting the flag `::CGAL_IA_DONT_STOP_CONSTANT_PROPAGATION`.
|
||||
///
|
||||
/// \models ::FieldWithSqrt
|
||||
/// \models ::RealEmbeddable
|
||||
template< class Protected >
|
||||
class Interval_nt {
|
||||
public:
|
||||
|
||||
/// \name Types
|
||||
/// @{
|
||||
/*!
|
||||
The type of the bounds of the interval.
|
||||
*/
|
||||
typedef double value_type;
|
||||
/// @}
|
||||
|
||||
/// \name Types
|
||||
/// @{
|
||||
/*!
|
||||
The type of the exceptions raised when uncertain comparisons are performed.
|
||||
*/
|
||||
typedef Uncertain_conversion_exception unsafe_comparison;
|
||||
/// @}
|
||||
|
||||
/// \name Types
|
||||
/// @{
|
||||
/*!
|
||||
A type whose default constructor and destructor allow
|
||||
to protect a block of code from FPU rounding modes necessary for the
|
||||
computations with `Interval_nt<false>`. It does nothing for
|
||||
`Interval_nt<true>`. It is implemented as `Protect_FPU_rounding<!Protected>`.
|
||||
*/
|
||||
typedef Hidden_type Protector;
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the interval [`i`;`i`].
|
||||
*/
|
||||
Interval_nt(int i);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the interval [`d`;`d`].
|
||||
*/
|
||||
Interval_nt(double d);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the interval [`i`;`s`].
|
||||
*/
|
||||
Interval_nt(double i, double s);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the interval [`p.first`;`p.second`].
|
||||
*/
|
||||
Interval_nt(std::pair<double, double> p);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// All functions required by a class to be considered as a \cgal number type
|
||||
/// (see \ref Numbertype ) are present, as well as the utility functions,
|
||||
/// sometimes with a particular semantic which is described below. There are also
|
||||
/// a few additional functions.
|
||||
///
|
||||
/// @{
|
||||
/*!
|
||||
returns [\f$- \infty \f$;\f$+ \infty \f$] when the denominator contains 0.
|
||||
*/
|
||||
Interval_nt operator/(Interval_nt J);
|
||||
|
||||
/*!
|
||||
returns the lower bound of the interval.
|
||||
*/
|
||||
double inf();
|
||||
|
||||
/*!
|
||||
returns the upper bound of the interval.
|
||||
*/
|
||||
double sup();
|
||||
|
||||
/*!
|
||||
returns whether both bounds are equal.
|
||||
*/
|
||||
bool is_point();
|
||||
|
||||
/*!
|
||||
returns whether both intervals have the same bounds.
|
||||
*/
|
||||
bool is_same(Interval_nt J);
|
||||
|
||||
/*!
|
||||
returns whether both intervals have a non empty intersection.
|
||||
*/
|
||||
bool do_overlap(Interval_nt J);
|
||||
/// @}
|
||||
|
||||
/// \name Comparison
|
||||
/// The comparison operators (\f$<\f$, \f$>\f$, \f$<=\f$, \f$>=\f$, \f$==\f$, \f$!=\f$, `sign()`
|
||||
/// and `compare()`) have the following semantic: it is the intuitive
|
||||
/// one when for all couples of values in both intervals, the comparison
|
||||
/// is identical (case of non-overlapping intervals). This can be expressed
|
||||
/// by the following formula (\f$x\f$ and \f$y\f$ are real, \f$X\f$ and \f$Y\f$ are
|
||||
/// intervals, \f$\mathcal{OP}\f$ is a comparison operator):
|
||||
///
|
||||
/// \f[
|
||||
///
|
||||
/// ( \forall x \in X, \forall y \in Y, (x \mathcal{OP} y) = true)
|
||||
/// \Rightarrow (X \mathcal{OP} Y) = true
|
||||
///
|
||||
/// \f]
|
||||
///
|
||||
/// and
|
||||
///
|
||||
/// \f[
|
||||
///
|
||||
/// ( \forall x \in X, \forall y \in Y, (x \mathcal{OP} y) = false)
|
||||
/// \Rightarrow (X \mathcal{OP} Y) =false
|
||||
///
|
||||
/// \f]
|
||||
|
||||
/// Otherwise, the comparison is not safe, and we specify this by returning
|
||||
/// a type encoding this uncertainty, namely using `Uncertain<bool>`
|
||||
/// or `Uncertain<Sign>`, which
|
||||
/// can be probed for uncertainty explicitly, and which has a conversion to
|
||||
/// the normal type (e.g. `bool`) which throws an exception when the
|
||||
/// conversion is not certain. Note that each failed conversion increments
|
||||
/// a profiling counter (see `CGAL_PROFILE`), and then throws the exception of
|
||||
/// type `unsafe_comparison`.
|
||||
|
||||
///
|
||||
Uncertain<bool> operator<(Interval_nt i, Interval_nt j);
|
||||
|
||||
///
|
||||
Uncertain<bool> operator>(Interval_nt i, Interval_nt j);
|
||||
|
||||
///
|
||||
Uncertain<bool> operator<=(Interval_nt i, Interval_nt j);
|
||||
|
||||
///
|
||||
Uncertain<bool> operator>=(Interval_nt i, Interval_nt j);
|
||||
|
||||
///
|
||||
Uncertain<bool> operator==(Interval_nt i, Interval_nt j);
|
||||
|
||||
///
|
||||
Uncertain<bool> operator!=(Interval_nt i, Interval_nt j);
|
||||
|
||||
///
|
||||
Uncertain<Comparison_result>
|
||||
compare(Interval_nt i, Interval_nt j);
|
||||
|
||||
///
|
||||
Uncertain<Sign> sign(Interval_nt i);
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
}; /* class Interval_nt */
|
||||
|
||||
/// \relates Interval_nt
|
||||
/// returns [0;\f$ \sqrt{upper_bound(I)} \f$] when only the lower bound is negative (expectable case with roundoff errors), and is unspecified when the upper bound also is negative (unexpected case).
|
||||
Interval_nt sqrt(Interval_nt I);
|
||||
|
||||
/// \relates Interval_nt
|
||||
/// returns the middle of the interval, as a double approximation of the interval.
|
||||
double to_double(Interval_nt I);
|
||||
|
||||
/*!
|
||||
This typedef (at namespace \cgal scope) exists for backward compatibility, as well as removing the need to remember the Boolean value for the template parameter.
|
||||
\relates Interval_nt
|
||||
*/
|
||||
typedef Interval_nt<false> Interval_nt_advanced;
|
||||
|
||||
/// \addtogroup roundingfuncs Rounding Control
|
||||
/// @{
|
||||
|
||||
/// \relates Interval_nt
|
||||
/// The type used by the following functions to deal with rounding modes. This is usually an `int`.
|
||||
typedef int FPU_CW_t;
|
||||
|
||||
/// sets the rounding mode to `R`.
|
||||
/// \relates Interval_nt
|
||||
void FPU_set_cw (FPU_CW_t R);
|
||||
|
||||
/// returns the current rounding mode.
|
||||
/// \relates Interval_nt
|
||||
FPU_CW_t FPU_get_cw (void);
|
||||
|
||||
/// sets the rounding mode to `R` and returns the old one.
|
||||
/// \relates Interval_nt
|
||||
FPU_CW_t FPU_get_and_set_cw (FPU_CW_t R);
|
||||
|
||||
/// \relates Interval_nt
|
||||
#define CGAL_FE_TONEAREST
|
||||
|
||||
/// \relates Interval_nt
|
||||
#define CGAL_FE_TOWARDZERO
|
||||
|
||||
/// \relates Interval_nt
|
||||
#define CGAL_FE_UPWARD
|
||||
|
||||
/// \relates Interval_nt
|
||||
#define CGAL_FE_DOWNWARD
|
||||
|
||||
/// @}
|
||||
|
||||
#define CGAL_IA_NO_X86_OVER_UNDER_FLOW_PROTECT
|
||||
#define CGAL_IA_DONT_STOP_CONSTANT_PROPAGATION
|
||||
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
/// An object of the class `Lazy_exact_nt<NT>` is able to represent any
|
||||
/// real embeddable number which `NT` is able to represent.
|
||||
/// The idea is that `Lazy_exact_nt<NT>` works exactly like `NT`, except
|
||||
/// that it is expected to be faster because it tries to only compute an
|
||||
/// approximation of the value, and only refers to `NT` when needed.
|
||||
/// The goal is to speed up exact computations done by any exact but slow
|
||||
/// number type `NT`.
|
||||
///
|
||||
/// `NT` must be a model of concept `RealEmbeddable`.
|
||||
/// `NT` must be at least model of concept `IntegralDomainWithoutDivision`.
|
||||
///
|
||||
/// Note that some filtering mechanism is available at the predicate level
|
||||
/// using `Filtered_predicate` and `Filtered_kernel`.
|
||||
///
|
||||
/// \models ::IntegralDomainWithoutDivision same as `NT`
|
||||
/// \models ::RealEmbeddable
|
||||
/// \models ::Fraction if `NT` is a ::Fraction
|
||||
///
|
||||
/// Example
|
||||
/// --------------
|
||||
///
|
||||
/// \code{.cpp}
|
||||
/// #include <CGAL/Cartesian.h>
|
||||
/// #include <CGAL/MP_Float.h>
|
||||
/// #include <CGAL/Lazy_exact_nt.h>
|
||||
/// #include <CGAL/Quotient.h>
|
||||
///
|
||||
/// typedef CGAL::Lazy_exact_nt<CGAL::Quotient<CGAL::MP_Float> > NT;
|
||||
/// typedef CGAL::Cartesian<NT> K;
|
||||
/// \endcode
|
||||
///
|
||||
template< class NT >
|
||||
class Lazy_exact_nt {
|
||||
public:
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces an uninitialized variable `m`.
|
||||
*/
|
||||
Lazy_exact_nt();
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the integral value `i`.
|
||||
*/
|
||||
Lazy_exact_nt(int i);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the floating point value `d` (works only if `NT` has a constructor from a double too).
|
||||
*/
|
||||
Lazy_exact_nt(double d);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the value `n`.
|
||||
*/
|
||||
Lazy_exact_nt(NT n);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the value `n`. `NT1` needs to be convertible to `NT` (and this conversion will only be done if necessary).
|
||||
*/
|
||||
template <class NT1> Lazy_exact_nt(Lazy_exact_nt<NT1> n);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
returns the corresponding NT value.
|
||||
*/
|
||||
NT exact();
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
returns an interval containing the exact value.
|
||||
*/
|
||||
Interval_nt<true> approx();
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
returns an interval containing the exact value.
|
||||
*/
|
||||
Interval_nt<false> interval();
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
specifies the relative precision that `to_double()` has to fulfill. The default value is \f$10^-5\f$. \pre d>0 and d<1.
|
||||
*/
|
||||
static void set_relative_precision_of_to_double(double d);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
returns the relative precision that `to_double()` currently fulfills.
|
||||
*/
|
||||
static double get_relative_precision_of_to_double();
|
||||
/// @}
|
||||
|
||||
}; /* class Lazy_exact_nt */
|
||||
|
||||
/// \relates Lazy_exact_nt
|
||||
/// writes `m` to ostream `out` in an interval format.
|
||||
std::ostream& operator<<(std::ostream& out,
|
||||
const Lazy_exact_nt<NT>& m);
|
||||
|
||||
/// \relates Lazy_exact_nt
|
||||
/// reads a `NT` from `in`, then converts it to a `Lazy_exact_nt<NT>`.
|
||||
std::istream& operator>>(std::istream& in, Lazy_exact_nt<NT>& m);
|
||||
|
||||
}; /* class Lazy_exact_nt */
|
||||
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
/// An object of the class `MP_Float` is able to represent a floating point
|
||||
/// value with arbitrary precision. This number type has the property that
|
||||
/// additions, subtractions and multiplications are computed exactly, as well as
|
||||
/// the construction from `float`, `double` and `long double`.
|
||||
/// Division and square root are not enabled by default since \cgal release 3.2,
|
||||
/// since they are computed approximately. We suggest that you use
|
||||
/// rationals like `Quotient<MP_Float>` when you need exact divisions.
|
||||
/// Note on the implementation : although the mantissa length is basically only
|
||||
/// limited by the available memory, the exponent is currently represented by a
|
||||
/// (integral valued) `double`, which can overflow in some circumstances. We
|
||||
/// plan to also have a multiprecision exponent to fix this issue.
|
||||
///
|
||||
/// \models ::EuclideanRing
|
||||
/// \models ::RealEmbeddable
|
||||
///
|
||||
/// Implementation
|
||||
/// --------------
|
||||
/// The implementation of `MP_Float` is simple but provides a quadratic
|
||||
/// complexity for multiplications. This can be a problem for large operands.
|
||||
/// For faster implementations of the same functionality with large integral
|
||||
/// values, you may want to consider using `GMP` or `LEDA` instead.
|
||||
///
|
||||
class MP_Float {
|
||||
public:
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces an uninitialized variable `m`.
|
||||
*/
|
||||
MP_Float();
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
copy constructor.
|
||||
*/
|
||||
MP_Float(const MP_Float &);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the integral value i.
|
||||
*/
|
||||
MP_Float(int i);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the floating point value d (exact conversion).
|
||||
*/
|
||||
MP_Float(float d);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the floating point value d (exact conversion).
|
||||
*/
|
||||
MP_Float(double d);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the floating point value d (exact conversion).
|
||||
*/
|
||||
MP_Float(long double d);
|
||||
/// @}
|
||||
|
||||
}; /* class MP_Float */
|
||||
|
||||
/// \relates MP_Float
|
||||
/// writes a double approximation of `m` to the ostream `out`.
|
||||
std::ostream& operator<<(std::ostream& out, const MP_Float& m);
|
||||
|
||||
/// \relates MP_Float
|
||||
/// reads a `double` from `in`, then converts it to an `MP_Float`.
|
||||
std::istream& operator>>(std::istream& in, MP_Float& m);
|
||||
|
||||
/// \relates MP_Float
|
||||
/// computes an approximation of the division by converting the operands to `double`, performing the division on `double`, and converting back to `MP_Float`.
|
||||
MP_Float approximate_division(const MP_Float &a, const MP_Float &b);
|
||||
|
||||
/// \relates MP_Float
|
||||
/// computes an approximation of the square root by converting the operand to `double`, performing the square root on `double`, and converting back to `MP_Float`.
|
||||
MP_Float approximate_sqrt(const MP_Float &a);
|
||||
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
/// `Number_type_checker` is a number type whose instances store two numbers
|
||||
/// of types `NT1` and `NT2`. It forwards all arithmetic operations to
|
||||
/// them, and calls the binary predicate `Comparator` to check the equality of
|
||||
/// the instances after each modification, as well as for each comparison.
|
||||
/// This is a debugging tool which is useful when dealing with number types.
|
||||
/// Parameters
|
||||
/// --------------
|
||||
///
|
||||
/// `NT1` must be a model of some algebraic structure concept.
|
||||
/// `NT2` must be a model of the same algebraic structure concept.
|
||||
/// `NT1` and `NT2` must be `FromDoubleConstructible`.
|
||||
/// `Comparator` has to be a model of a binary predicate taking `NT1`
|
||||
/// as first argument, and `NT2` as second. The `Comparator` parameter
|
||||
/// has a default value which is a functor calling `operator==` between
|
||||
/// the two arguments.
|
||||
///
|
||||
/// \models ::RealEmbeddable
|
||||
template< class NT1, class NT2, class Comparator >
|
||||
class Number_type_checker {
|
||||
public:
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces an uninitialized variable `c`.
|
||||
*/
|
||||
Number_type_checker();
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the integral value i.
|
||||
*/
|
||||
Number_type_checker(int i);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the floating point value d.
|
||||
*/
|
||||
Number_type_checker(double d);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces a variable storing the pair `n1, n2`.
|
||||
*/
|
||||
Number_type_checker(const NT1 &n1, const NT2 &n2);
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
returns a const reference to the object of type `NT1`.
|
||||
*/
|
||||
const NT1 & n1() const;
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
returns a const reference to the object of type `NT2`.
|
||||
*/
|
||||
const NT2 & n2() const;
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
returns a reference to the object of type `NT1`.
|
||||
*/
|
||||
NT1 & n1();
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
returns a reference to the object of type `NT2`.
|
||||
*/
|
||||
NT2 & n2();
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
calls the `Comparator` binary predicate on the two stored objects and returns its result.
|
||||
*/
|
||||
bool is_valid() const;
|
||||
/// @}
|
||||
|
||||
}; /* class Number_type_checker */
|
||||
|
||||
/// \relates Number_type_checker
|
||||
/// writes `c.n1()` to the ostream `out`.
|
||||
std::ostream& operator<<(std::ostream& out, const Number_type_checker& c);
|
||||
|
||||
/// \relates Number_type_checker
|
||||
/// reads an `NT1` from `in`, then converts it to an `NT2`, so a conversion from `NT1` to `NT2` is required here.
|
||||
std::istream& operator>>(std::istream& in, Number_type_checker& c);
|
||||
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
/// An object of the class `Quotient` is an element of the
|
||||
/// field of quotients of the integral domain type `NT`.
|
||||
/// If `NT` behaves like an integer, `Quotient`
|
||||
/// behaves like a rational number.
|
||||
///
|
||||
/// \leda's class `rational` (see Section \ref ledant )
|
||||
/// has been the basis for `Quotient`.
|
||||
/// A `Quotient` `q` is represented as a pair of
|
||||
/// `NT`s, representing numerator and denominator.
|
||||
///
|
||||
/// - `NT` must be at least model of concept `IntegralDomainWithoutDivision`.
|
||||
/// - `NT` must be a model of concept `RealEmbeddable`.
|
||||
///
|
||||
/// \models ::Field
|
||||
/// \models ::RealEmbeddable
|
||||
/// \models ::Fraction
|
||||
template< class NT >
|
||||
class Quotient {
|
||||
public:
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces an uninitialized variable `q`.
|
||||
*/
|
||||
Quotient();
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the quotient `t/1`. NT needs to have a constructor from T.
|
||||
*/
|
||||
template <class T> Quotient(const T& t);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the quotient `NT(t.numerator())/NT(t.denominator())`. NT needs to have a constructor from T.
|
||||
*/
|
||||
template <class T> Quotient(const Quotient<T>& t);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
introduces the quotient `n/d`. \pre \f$d \neq 0\f$.
|
||||
*/
|
||||
Quotient(const NT& n, const NT& d);
|
||||
/// @}
|
||||
|
||||
|
||||
/// \name Operations
|
||||
/// There are two access functions, namely to the
|
||||
/// numerator and the denominator of a quotient.
|
||||
/// Note that these values are not uniquely defined.
|
||||
/// It is guaranteed that `q.numerator()` and
|
||||
/// `q.denominator()` return values `nt_num` and
|
||||
/// `nt_den` such that `q = nt_num/nt_den`, only
|
||||
/// if `q.numerator()` and `q.denominator()` are called
|
||||
/// consecutively wrt `q`, i.e. `q` is not involved in
|
||||
/// any other operation between these calls.
|
||||
///
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
returns a numerator of `q`.
|
||||
*/
|
||||
NT numerator() const;
|
||||
|
||||
/*!
|
||||
returns a denominator of `q`.
|
||||
*/
|
||||
NT denominator() const;
|
||||
|
||||
/// @}
|
||||
|
||||
}; /* class Quotient */
|
||||
|
||||
/// The stream operations are available as well.
|
||||
/// They assume that corresponding stream operators for type `NT` exist.
|
||||
/// \relates Quotient
|
||||
/// writes `q` to ostream `out` in format ``<TT>n/d</TT>'', where `n`\f$==\f$`q.numerator()` and `d`\f$==\f$`q.denominator()`.
|
||||
std::ostream& operator<<(std::ostream& out, const Quotient<NT>& q);
|
||||
|
||||
///
|
||||
/// The stream operations are available as well.
|
||||
/// They assume that corresponding stream operators for type `NT` exist.
|
||||
/// \relates Quotient
|
||||
/// reads `q` from istream `in`. Expected format is `n/d`, where `n` and `d` are of type `NT`. A single `n` which is not followed by a `/` is also accepted and interpreted as `n/1`.
|
||||
std::istream& operator>>(std::istream& in, Quotient<NT>& q);
|
||||
|
||||
/// \relates Quotient
|
||||
/// returns some double approximation to `q`.
|
||||
/// Provided to fulfill the \cgal requirements on number types.
|
||||
double to_double(const Quotient<NT>& q);
|
||||
|
||||
/// \relates Quotient
|
||||
/// returns true, if numerator and denominator are valid.
|
||||
/// Provided to fulfill the \cgal requirements on number types.
|
||||
bool is_valid(const Quotient<NT>& q);
|
||||
|
||||
/// \relates Quotient
|
||||
/// returns true, if numerator and denominator are finite.
|
||||
/// Provided to fulfill the \cgal requirements on number types.
|
||||
bool is_finite(const Quotient<NT>& q);
|
||||
|
||||
/// \relates Quotient
|
||||
/// returns the square root of `q`. This is supported if and only if `NT` supports the square root as well.
|
||||
/// Provided to fulfill the \cgal requirements on number types.
|
||||
Quotient<NT> sqrt(const Quotient<NT>& q);
|
||||
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// The class `Rational_traits` can be used to determine the type of the numerator
|
||||
/// and denominator of a rational number type as `Quotient`, `Gmpq`,
|
||||
/// `mpq_class` or `leda_rational`.
|
||||
///
|
||||
///
|
||||
///
|
||||
template< class NT >
|
||||
class Rational_traits {
|
||||
public:
|
||||
|
||||
/// \name Types
|
||||
/// @{
|
||||
/*!
|
||||
the type of the numerator and denominator.
|
||||
*/
|
||||
typedef Hidden_type RT;
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
returns the numerator of `r`.
|
||||
*/
|
||||
RT numerator (const NT & r) const;
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
returns the denominator of `r`.
|
||||
*/
|
||||
RT denominator (const NT & r) const;
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
constructs a rational number.
|
||||
*/
|
||||
NT make_rational(const RT & n, const RT & d) const;
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
constructs a rational number.
|
||||
*/
|
||||
NT make_rational(const NT & n, const NT & d) const;
|
||||
/// @}
|
||||
|
||||
|
||||
}; /* class Rational_traits */
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
/// \deprecated
|
||||
/// This class is deprecated since CGAL-3.8. It is replaced by `Sqrt_extension`.
|
||||
template< typename RT >
|
||||
class Root_of_2 {
|
||||
public:
|
||||
}; /* class Root_of_2 */
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
///
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
///
|
||||
|
||||
///
|
||||
/// The function `compute_roots_of_2` solves a univariate polynomial as it is defined by the
|
||||
/// coefficients given to the function. The solutions are written into the given
|
||||
/// `OutputIterator`.
|
||||
///
|
||||
/// \sa ::RootOf_2
|
||||
/// \sa `CGAL::Root_of_traits<RT>`
|
||||
/// \sa `CGAL::make_root_of_2<RT>`
|
||||
/// \sa `CGAL::make_sqrt<RT>`
|
||||
/// \sa `CGAL::Sqrt_extension<NT,ROOT>`
|
||||
/// Writes the real roots of the polynomial \f$aX^2+bX+c\f$ into \f$oit\f$ in ascending order. `OutputIterator` is required to accept `Root_of_traits::Root_of_2`. Multiplicities are not reported. \pre `RT` is an `IntegralDomainWithoutDivision`. \pre \f$a \neq 0\f$ or \f$b \neq 0\f$.
|
||||
template <typename RT, typename OutputIterator>
|
||||
OutputIterator
|
||||
compute_roots_of_2(const RT& a, const RT& b, const RT& c, OutputIterator oit);
|
||||
/// @}
|
||||
}
|
||||
|
||||
///
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
///
|
||||
|
||||
///
|
||||
/// The function `make_root_of_2` constructs an algebraic number of degree 2 over a
|
||||
/// ring number type.
|
||||
///
|
||||
/// \sa `RootOf_2`
|
||||
/// \sa `CGAL::Root_of_traits<RT>`
|
||||
/// \sa `CGAL::make_sqrt<RT>`
|
||||
/// \sa `CGAL::compute_roots_of_2<RT,OutputIterator>`
|
||||
/// \sa `CGAL::Sqrt_extension<NT,ROOT>`
|
||||
/// Returns the smallest real root of the polynomial \f$aX^2+bX+c\f$ if \f$s\f$ is true, and the largest root is \f$s\f$ is false. \pre `RT` is an `IntegralDomainWithoutDivision`. \pre The polynomial has at least one real root.
|
||||
template <typename RT>
|
||||
Root_of_traits<RT>::Root_of_2
|
||||
make_root_of_2(const RT& a, const RT& b, const RT& c, bool s);
|
||||
/// @}
|
||||
}
|
||||
|
||||
///
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
///
|
||||
|
||||
///
|
||||
/// The function `make_root_of_2` constructs an algebraic number of degree 2 over a
|
||||
/// ring number type.
|
||||
///
|
||||
/// \sa `RootOf_2`
|
||||
/// \sa `CGAL::Root_of_traits<RT>`
|
||||
/// \sa `CGAL::make_sqrt<RT>`
|
||||
/// \sa `CGAL::compute_roots_of_2<RT,OutputIterator>`
|
||||
/// \sa `CGAL::Sqrt_extension<NT,ROOT>`
|
||||
/// Constructs the number \f$α+ β \sqrt{γ} \f$. \pre `RT` is an `IntegralDomainWithoutDivision`. \pre \f$γ \geq 0\f$
|
||||
template <typename RT>
|
||||
Root_of_traits<RT>::Root_of_2
|
||||
make_root_of_2(RT alpha, RT beta, RT gamma);
|
||||
/// @}
|
||||
}
|
||||
|
||||
///
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
///
|
||||
|
||||
///
|
||||
/// The function `make_sqrt` constructs a square root of a given value of type \f$RT\f$.
|
||||
/// Depending on the type \f$RT\f$ the square root may be returned in a new type that
|
||||
/// can represent algebraic extensions of degree \f$2\f$.
|
||||
///
|
||||
/// \sa `RootOf_2`
|
||||
/// \sa `CGAL::make_root_of_2<RT>`
|
||||
/// \sa `CGAL::Root_of_traits<RT>`
|
||||
/// Returns \f$ \sqrt{x} .\f$ \pre `RT` is a `RealEmbeddable` `IntegralDomain`. \pre \f$x \leq 0 \f$
|
||||
template <typename RT> Root_of_traits<RT>::Root_of_2 make_sqrt(const RT& x);
|
||||
/// @}
|
||||
}
|
||||
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// For a `RealEmbeddable` `IntegralDomain` `RT`, the class template
|
||||
/// `Root_of_traits<RT>` associates a type `Root_of_2`, which represents
|
||||
/// algebraic numbers of degree 2 over `RT`. Moreover, the class provides
|
||||
/// `Root_of_1`, which represents the quotient field of `RT`.
|
||||
///
|
||||
///
|
||||
///
|
||||
/// \sa `RootOf_2`
|
||||
/// \sa `CGAL::compute_roots_of_2<RT,OutputIterator>`
|
||||
/// \sa `CGAL::make_root_of_2<RT>`
|
||||
template< class RT >
|
||||
class Root_of_traits {
|
||||
public:
|
||||
|
||||
/// \name Types
|
||||
/// @{
|
||||
/*!
|
||||
A `RealEmbeddable` `Field` representing the quotient field of `RT`.
|
||||
*/
|
||||
typedef Hidden_type Root_of_1;
|
||||
/// @}
|
||||
|
||||
/// \name Types
|
||||
/// @{
|
||||
/*!
|
||||
Model of `RootOf_2`.
|
||||
*/
|
||||
typedef Hidden_type Root_of_2;
|
||||
/// @}
|
||||
|
||||
}; /* class Root_of_traits */
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,334 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// An instance of this class represents an extension of the type
|
||||
/// `NT` by <B>one</B> square root of the type `ROOT`. `NT` is
|
||||
/// required to be constructible from `ROOT`. `NT` is required to be
|
||||
/// an `IntegralDomainWithoutDivision`. `Sqrt_extension` is
|
||||
/// `RealEmbeddable` if NT is `RealEmbeddable`. For example, let
|
||||
/// `Integer` be some type representing \f$Z\f$, then
|
||||
/// `Sqrt_extension<Integer,Integer>` is able to represent \f$Z[
|
||||
/// \sqrt{root} ]\f$ for some arbitrary Integer \f$root\f$.
|
||||
///
|
||||
/// \note \f$R[a]\f$ denotes the extension of a ring \f$R\f$ by an
|
||||
/// element \f$a\f$. See also: <A
|
||||
/// HREF="http://mathworld.wolfram.com/ExtensionRing.html">http://mathworld.wolfram.com/ExtensionRing.html</A>
|
||||
///
|
||||
/// The value of \f$root\f$ is set at construction time, or set to
|
||||
/// zero if it is not specified.
|
||||
///
|
||||
/// Arithmetic operations among different extensions, say \f$Z[
|
||||
/// \sqrt{a} ]\f$ and \f$Z[ \sqrt{b} ]\f$, are not supported. The
|
||||
/// result would be in \f$Z[ \sqrt{a} , \sqrt{b} ]\f$, which is not
|
||||
/// representable by `Sqrt_extension<Integer,Integer>`. <B>The user
|
||||
/// is responsible to check that arithmetic operations are carried
|
||||
/// out for elements from the same extensions only.</B> This is not
|
||||
/// tested by `Sqrt_extension` for efficiency reasons. A violation
|
||||
/// of the precondition leads to undefined behavior. Be aware that
|
||||
/// for efficiency reasons the given \f$root\f$ is stored as it is
|
||||
/// given to the constructor. In particular, an extension by a square
|
||||
/// root of a square is considered as an extension.
|
||||
///
|
||||
/// Since elements of `Sqrt_extension` that lie in different
|
||||
/// extensions are not interoperable with respect to any arithmetic
|
||||
/// operations, the full value range of `Sqrt_extension` does not
|
||||
/// represent an algebraic structure. However, each subset of the
|
||||
/// value range that represents the extension of NT by a particular
|
||||
/// square root is a valid algebraic structure, since this subset is
|
||||
/// closed under all provided arithmetic operations. From there,
|
||||
/// `Sqrt_extension` can be used as if it were a model of an
|
||||
/// algebraic structure concept, with the following correspondence:
|
||||
///
|
||||
/// <TABLE CELLSPACING=5 >
|
||||
/// <TR>
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
/// NT
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
/// `Sqrt_extension`
|
||||
/// <TR><TD ALIGN=LEFT NOWRAP COLSPAN=2><HR>
|
||||
/// <TR>
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
///
|
||||
/// <TR>
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
/// `IntegralDomainWithoutDivision`
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
/// `IntegralDomainWithoutDivision`
|
||||
/// <TR>
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
/// `IntegralDomain`
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
/// `IntegralDomain`
|
||||
/// <TR>
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
/// `UniqueFactorizationDomain`
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
/// `IntegralDomain`
|
||||
/// <TR>
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
/// `EuclideanRing`
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
/// `IntegralDomain`
|
||||
/// <TR>
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
/// `Field`
|
||||
/// <TD class="math" ALIGN=LEFT NOWRAP>
|
||||
/// `Field`
|
||||
/// <TR><TD ALIGN=LEFT NOWRAP COLSPAN=2><HR>
|
||||
/// </TABLE>
|
||||
///
|
||||
/// The extension of a `UniqueFactorizationDomain` or `EuclideanRing`
|
||||
/// is just an `IntegralDomain`, since the extension in general
|
||||
/// destroys the unique factorization property. For instance consider
|
||||
/// \f$Z[ \sqrt{10} ]\f$, the extension of \f$Z\f$ by \f$ \sqrt{10}
|
||||
/// \f$: in \f$Z[ \sqrt{10} ]\f$ the element 10 has two different
|
||||
/// factorizations \f$ \sqrt{10} \cdot \sqrt{10} \f$ and \f$2 \cdot
|
||||
/// 5\f$. In particular, the factorization is not unique.
|
||||
///
|
||||
/// If `NT` is a model of `RealEmbeddable` the type `Sqrt_extension`
|
||||
/// is also considered as `RealEmbeddable`. However, by default it is
|
||||
/// not allowed to compare values from different extensions for
|
||||
/// efficiency reasons. In case such a comparison becomes necessary,
|
||||
/// use the member function compare with the according Boolean flag.
|
||||
///
|
||||
/// If such a comparison is a very frequent case, override the
|
||||
/// default of `DifferentExtensionComparable` by giving
|
||||
/// `::CGAL::Tag_true` as third template parameter. This effects the
|
||||
/// behavior of compare functions as well as the compare operators.
|
||||
///
|
||||
/// The fourth template argument, `FilterPredicates`, triggers an
|
||||
/// internal filter that may speed up comparisons and sign
|
||||
/// computations. In case `FilterPredicates` is set to
|
||||
/// `CGAL::Tag_true` the type first computes a double interval
|
||||
/// containing the represented number and tries to perform the
|
||||
/// comparison or sign computation using this interval. Once
|
||||
/// computed, this interval is stored by the corresponding
|
||||
/// `Sqrt_extension` object for further usage. Note that this
|
||||
/// internal filter is switched off by default, since it may conflict
|
||||
/// with other filtering methods, such as
|
||||
/// `CGAL::Lazy_exact_nt<Sqrt_extension>`.
|
||||
///
|
||||
/// In case `NT` is not `RealEmbeddable`,
|
||||
/// `DifferentExtensionComparable` as well as `FilterPredicates` have
|
||||
/// no effect.
|
||||
///
|
||||
/// \models ::Assignable
|
||||
/// \models ::CopyConstructible
|
||||
/// \models ::DefaultConstructible
|
||||
/// \models ::EqualityComparable
|
||||
/// \models ::ImplicitInteroperable with int
|
||||
/// \models ::ImplicitInteroperable with NT
|
||||
/// \models ::Fraction:: if NT is a ::Fraction
|
||||
/// \models ::RootOf_2
|
||||
///
|
||||
/// \sa `IntegralDomainWithoutDivision`
|
||||
/// \sa `IntegralDomain`
|
||||
/// \sa `Field`
|
||||
/// \sa `RealEmbeddable`
|
||||
/// \sa `ImplicitInteroperable`
|
||||
/// \sa `Fraction`
|
||||
/// \sa `RootOf_2`
|
||||
/// \sa `CGAL::Tag_true`
|
||||
/// \sa `CGAL::Tag_false`
|
||||
template< class NT, class ROOT, class DifferentExtensionComparable = CGAL::Tag_false,
|
||||
class FilterPredicates = CGAL::Tag_false>
|
||||
class Sqrt_extension {
|
||||
public:
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
Introduces an variable initialized with 0.
|
||||
*/
|
||||
Sqrt_extension ();
|
||||
/// @}
|
||||
|
||||
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
Copy constructor.
|
||||
*/
|
||||
Sqrt_extension (const Sqrt_extension& x);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
Introduces an variable initialized with \f$i\f$.
|
||||
*/
|
||||
Sqrt_extension (const int &i);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
Introduces an variable initialized with \f$x\f$.
|
||||
*/
|
||||
Sqrt_extension (const NT &x);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
Constructor from int: `ext`\f$= a0 +a1 \cdot sqrt(r)\f$. \pre \f$r \neq 0\f$
|
||||
*/
|
||||
Sqrt_extension (int a0, int a1, int r);
|
||||
/// @}
|
||||
|
||||
/// \name Creation
|
||||
/// @{
|
||||
/*!
|
||||
General constructor: `ext`\f$= a0 + a1 \cdot sqrt(r)\f$. \pre \f$r \neq 0\f$
|
||||
*/
|
||||
Sqrt_extension (NT a0, NT a1, ROOT r);
|
||||
/// @}
|
||||
|
||||
|
||||
/// \name Operations
|
||||
/// An object of type `Sqrt_extension` represent an expression of the
|
||||
/// form: \f$a0 + a1 * sqrt(root)\f$.
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
Const access operator for a0
|
||||
*/
|
||||
const NT & a0 () const ;
|
||||
|
||||
/*!
|
||||
Const access operator for a1
|
||||
*/
|
||||
const NT & a1 () const ;
|
||||
|
||||
/*!
|
||||
Const access operator for root
|
||||
*/
|
||||
const ROOT & root () const;
|
||||
|
||||
/*!
|
||||
Returns true in case root of `ext` is not zero. Note that \f$a1 == 0 \f$ does not imply \f$root == 0\f$.
|
||||
*/
|
||||
bool is_extended () const;
|
||||
|
||||
/*!
|
||||
Simplifies the representation, in particular \f$root\f$ is set to zero if \f$a1\f$ is zero, that is, `ext` becomes not extended. Moreover, it propagates the simplify command to members of `ext`. see also: `AlgebraicStructureTraits::Simplify`.
|
||||
*/
|
||||
void simplify ();
|
||||
|
||||
/*!
|
||||
returns true if `ext` represents the value zero.
|
||||
*/
|
||||
bool is_zero () const;
|
||||
|
||||
/*!
|
||||
Determines the sign of `ext` by (repeated) squaring. \pre `Sqrt_extension` is `RealEmbeddable`.
|
||||
*/
|
||||
CGAL::Sign sign () const;
|
||||
|
||||
/*!
|
||||
returns the absolute value of `ext`. \pre `Sqrt_extension` is `RealEmbeddable`.
|
||||
*/
|
||||
Sqrt_extension abs () const;
|
||||
|
||||
/*!
|
||||
Compares `ext` with y. The optional bool `in_same_extension` indicates whether `ext` and \f$y\f$ are in the same extension of NT.
|
||||
*/
|
||||
CGAL::Comparison_result compare(const Sqrt_extension& y, bool in_same_extension = !DifferentExtensionComparable::value) const;
|
||||
|
||||
/*!
|
||||
\pre `(this->root()==0 or a.root()==0 or this->root() == a.root())`
|
||||
*/
|
||||
Sqrt_extension & operator+=(const Sqrt_extension& a);
|
||||
/// @}
|
||||
|
||||
/*!
|
||||
\pre `(this->root()==0 or a.root()==0 or this->root() == a.root())`
|
||||
*/
|
||||
Sqrt_extension & operator-=(const Sqrt_extension& a);
|
||||
|
||||
/*!
|
||||
\pre `(this->root()==0 or a.root()==0 or this->root() == a.root())`
|
||||
*/
|
||||
Sqrt_extension & operator*=(const Sqrt_extension& a);
|
||||
|
||||
/*!
|
||||
In case `NT` is only an `IntegralDomain` operator/ implements integral division.
|
||||
In case `NT` is a `Field` operator/ implements the field division.
|
||||
\pre `(this->root()==0 or a.root()==0 or this->root() == a.root())`
|
||||
*/
|
||||
Sqrt_extension & operator/=(const Sqrt_extension& a);
|
||||
|
||||
/// @}
|
||||
|
||||
}; /* class Sqrt_extension */
|
||||
|
||||
///
|
||||
/// \relates Sqrt_extension<NT,ROOT>
|
||||
/// \pre `(a.root()==0 or b.root()==0 or a.root() == b.root())`
|
||||
Sqrt_extension operator+(const Sqrt_extension&a,const Sqrt_extension& b);
|
||||
///
|
||||
/// \relates Sqrt_extension<NT,ROOT>
|
||||
/// \pre `(a.root()==0 or b.root()==0 or a.root() == b.root())`
|
||||
Sqrt_extension operator-(const Sqrt_extension&a,const Sqrt_extension& b);
|
||||
///
|
||||
/// \relates Sqrt_extension<NT,ROOT>
|
||||
/// \pre `(a.root()==0 or b.root()==0 or a.root() == b.root())`
|
||||
Sqrt_extension operator*(const Sqrt_extension&a,const Sqrt_extension& b);
|
||||
|
||||
/// In case `NT` is only an `IntegralDomain` operator/ implements integral division.
|
||||
/// In case `NT` is a `Field` operator/ implements the field division.
|
||||
/// \relates Sqrt_extension<NT,ROOT>
|
||||
/// \pre `(a.root()==0 or b.root()==0 or a.root() == b.root())`
|
||||
Sqrt_extension operator/(const Sqrt_extension&a,const Sqrt_extension& b);
|
||||
|
||||
///
|
||||
/// \relates Sqrt_extension<NT,ROOT>
|
||||
/// \pre `(a.root()==0 or b.root()==0 or a.root() == b.root())`
|
||||
bool operator==(const Sqrt_extension&a,const Sqrt_extension& b);
|
||||
///
|
||||
/// \relates Sqrt_extension<NT,ROOT>
|
||||
/// \pre `(a.root()==0 or b.root()==0 or a.root() == b.root())`
|
||||
bool operator!=(const Sqrt_extension&a,const Sqrt_extension& b);
|
||||
|
||||
|
||||
/// In case `Sqrt_extension` is `RealEmbeddable`:
|
||||
/// \relates Sqrt_extension<NT,ROOT>
|
||||
/// \pre `(a.root()==0 or b.root()==0 or a.root() == b.root())`
|
||||
bool operator< (const Sqrt_extension&a,const Sqrt_extension& b);
|
||||
///
|
||||
/// \relates Sqrt_extension<NT,ROOT>
|
||||
/// \pre `(a.root()==0 or b.root()==0 or a.root() == b.root())`
|
||||
bool operator<=(const Sqrt_extension&a,const Sqrt_extension& b);
|
||||
///
|
||||
/// \relates Sqrt_extension<NT,ROOT>
|
||||
/// \pre `(a.root()==0 or b.root()==0 or a.root() == b.root())`
|
||||
bool operator> (const Sqrt_extension&a,const Sqrt_extension& b);
|
||||
///
|
||||
/// \relates Sqrt_extension<NT,ROOT>
|
||||
/// \pre `(a.root()==0 or b.root()==0 or a.root() == b.root())`
|
||||
bool operator>=(const Sqrt_extension&a,const Sqrt_extension& b);
|
||||
|
||||
/// The stream operations are available as well.
|
||||
/// They assume that corresponding stream operators for type `NT` and `ROOT` exist.
|
||||
///
|
||||
/// \relates Sqrt_extension<NT,ROOT>
|
||||
/// writes `ext` to ostream `os`. The format depends on the `CGAL::IO::MODE` of `os`. In case the mode is `CGAL::IO::ASCII` the format is <TT>EXT[a0,a1,root]</TT>. In case the mode is `CGAL::IO::PRETTY` the format is human readable.
|
||||
std::ostream& operator<<(std::ostream& os, const Sqrt_extension<NT,ROOT> &ext);
|
||||
|
||||
/// The stream operations are available as well.
|
||||
/// They assume that corresponding stream operators for type `NT` and `ROOT` exist.
|
||||
///
|
||||
/// \relates Sqrt_extension<NT,ROOT>
|
||||
/// reads `ext` from istream `is` in format <TT>EXT[a0,a1,root]</TT>, the output format in mode `CGAL::IO::ASCII`
|
||||
std::istream& operator>>(std::istream& is, const Sqrt_extension<NT,ROOT> &ext);
|
||||
|
||||
};
|
||||
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
/// The fundamental type `double` is an `RealEmbeddable`
|
||||
/// `Field`. Due to rounding errors and overflow `double` is
|
||||
/// considered as not exact.
|
||||
///
|
||||
/// \models ::FieldWithSqrt
|
||||
/// \models ::RealEmbeddable
|
||||
class double {
|
||||
public:
|
||||
|
||||
|
||||
}; /* class double */
|
||||
|
||||
namespace CGAL {
|
||||
/// \relates double
|
||||
/// Determines whether the argument represents a value in \f$R\f$.
|
||||
bool is_finite(double x);
|
||||
|
||||
} // CGAL
|
||||
|
||||
/// @}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
/// The fundamental type `float` is an `RealEmbeddable`
|
||||
/// `FieldWithSqrt`. Due to rounding errors and overflow `float` is
|
||||
/// considered as not exact.
|
||||
///
|
||||
/// \models ::FieldWithSqrt
|
||||
/// \models ::RealEmbeddable
|
||||
class float {
|
||||
public:
|
||||
|
||||
}; /* class float */
|
||||
|
||||
/// @}
|
||||
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
/// \relates float
|
||||
/// Determines whether the argument represents a value in \f$R\f$.
|
||||
bool is_finite(float x);
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// The class `mpq_class` is an exact multiprecision rational number type,
|
||||
/// provided by <span class="textsc">Gmp</span>.
|
||||
/// CGAL provides the necessary functions to make it compliant to the number type
|
||||
/// concept.
|
||||
///
|
||||
/// \models ::Field
|
||||
/// \models ::RealEmbeddable
|
||||
/// \models ::Fraction
|
||||
class mpq_class {
|
||||
public:
|
||||
|
||||
}; /* class mpq_class */
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// The class `mpz_class` is an exact multiprecision integer number type,
|
||||
/// provided by <span class="textsc">Gmp</span>.
|
||||
/// CGAL provides the necessary functions to make it compliant to the number type
|
||||
/// concept.
|
||||
///
|
||||
/// \models ::EuclideanRing
|
||||
/// \models ::RealEmbeddable
|
||||
class mpz_class {
|
||||
public:
|
||||
|
||||
}; /* class mpz_class */
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
/// The fundamental type `int` is an `RealEmbeddable` `EuclideanRing`.
|
||||
/// Due to overflow `int` is considered as not exact.
|
||||
///
|
||||
/// \models ::EuclideanRing
|
||||
/// \models ::RealEmbeddable
|
||||
class int {
|
||||
public:
|
||||
|
||||
}; /* class int */
|
||||
/// @}
|
||||
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
/// The fundamental type `long int` is an `RealEmbeddable`
|
||||
/// `EuclideanRing`. Due to overflow `long int` is considered as not exact.
|
||||
///
|
||||
/// \models ::EuclideanRing
|
||||
/// \models ::RealEmbeddable
|
||||
class long int {
|
||||
public:
|
||||
|
||||
}; /* class long int */
|
||||
/// @}
|
||||
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
/// The fundamental type `short int` is an `RealEmbeddable`
|
||||
/// `EuclideanRing`. Due to overflow `short int` is considered as not exact.
|
||||
///
|
||||
/// \models ::EuclideanRing
|
||||
/// \models ::RealEmbeddable
|
||||
class short int {
|
||||
public:
|
||||
|
||||
}; /* class short int */
|
||||
/// @}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// The class `leda_bigfloat` is a wrapper class that provides the functions
|
||||
/// needed to use the number type `bigfloat`.
|
||||
/// `bigfloat`
|
||||
/// Rounding mode and precision (i.e. mantissa length) of
|
||||
/// `leda_bigfloat` can be set.
|
||||
/// For more details on the number types of \leda we refer to the \leda manual \cite cgal:mnsu-lum.
|
||||
///
|
||||
/// \models ::FieldWithKthRoot
|
||||
/// \models ::RealEmbeddable
|
||||
/// \models ::FromDoubleConstructible
|
||||
class leda_bigfloat {
|
||||
public:
|
||||
|
||||
}; /* class leda_bigfloat */
|
||||
/// @}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// The class `leda_integer` provides exact computation in \f$Z\f$.
|
||||
/// The class `leda_integer` is a wrapper class that provides the functions
|
||||
/// needed to use the number type `leda::integer`, representing exact
|
||||
/// multiprecision integers provided by <span class="textsc">LEDA</span>.
|
||||
///
|
||||
/// \models ::EuclideanRing
|
||||
/// \models ::RealEmbeddable
|
||||
class leda_integer {
|
||||
public:
|
||||
|
||||
}; /* class leda_integer */
|
||||
/// @}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// The class `leda_rational` provides exact computation in \f$R\f$.
|
||||
/// The class `leda_rational` is a wrapper class that provides the functions
|
||||
/// needed to use the number type `rational`, representing exact
|
||||
/// multiprecision rational numbers provided by <span class="textsc">LEDA</span>.
|
||||
///
|
||||
/// \models ::Field
|
||||
/// \models ::RealEmbeddable
|
||||
/// \models ::Fraction
|
||||
/// \models ::FromDoubleConstructible
|
||||
class leda_rational {
|
||||
public:
|
||||
|
||||
}; /* class leda_rational */
|
||||
/// @}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
///
|
||||
/// The class `leda_real` is a wrapper class that provides the functions needed
|
||||
/// to use the number type `real`, representing exact real numbers
|
||||
/// numbers provided by \leda.
|
||||
/// The class `leda_real` provides exact computation over the subset of real
|
||||
/// numbers that contains integers, and which is closed by the operations
|
||||
/// \f$+,-, × ,/, \sqrt{} \f$ and \f$kth_root\f$. For \leda version 5.0 or later
|
||||
/// `leda_real` is also able to represent real roots of polynomials.
|
||||
/// Operations and comparisons between objects of this type are guaranteed
|
||||
/// to be exact.
|
||||
///
|
||||
/// \models ::FieldWithRootOf
|
||||
/// \models ::RealEmbeddable
|
||||
/// \models ::FromDoubleConstructible
|
||||
class leda_real {
|
||||
public:
|
||||
|
||||
}; /* class leda_real */
|
||||
/// @}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
/// The fundamental type `long double` is an `RealEmbeddable`
|
||||
/// `FieldWithSqrt`. Due to rounding errors and overflow `long double` is
|
||||
/// considered as not exact.
|
||||
///
|
||||
/// \models ::FieldWithSqrt
|
||||
/// \models ::RealEmbeddable
|
||||
class long_double {
|
||||
public:
|
||||
|
||||
}; /* class long double */
|
||||
|
||||
/// @}
|
||||
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// \relates long_double
|
||||
/// Determines whether the argument represents a value in \f$R\f$.
|
||||
bool is_finite(long double x);
|
||||
/// @}
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
|
||||
/// The fundamental type `long long int` is an `RealEmbeddable`
|
||||
/// `EuclideanRing`. Due to overflow `long long int` is considered as not exact.
|
||||
///
|
||||
/// \models ::EuclideanRing
|
||||
/// \models ::RealEmbeddable
|
||||
class long long int {
|
||||
public:
|
||||
|
||||
}; /* class long long int */
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
///
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
///
|
||||
|
||||
///
|
||||
/// The function `simplest_rational_in_interval` computes the simplest rational number in an
|
||||
/// interval of two `double` values.
|
||||
///
|
||||
/// Implementation
|
||||
/// --------------
|
||||
///
|
||||
/// See Knuth, "Seminumerical algorithms", page 654, answer to exercise
|
||||
/// 4.53-39.
|
||||
/// computes the rational number with the smallest denominator in the interval `[d1,d2].`
|
||||
Rational simplest_rational_in_interval(double d1, double d2);
|
||||
/// @}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
///
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
///
|
||||
|
||||
///
|
||||
/// The function `to_rational` computes the rational number representing a
|
||||
/// given double precision floating point number.
|
||||
///
|
||||
/// Implementation
|
||||
/// --------------
|
||||
///
|
||||
/// computes the rational number that equals `d`.
|
||||
Rational to_rational(double d);
|
||||
/// @}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
///
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
///
|
||||
|
||||
///
|
||||
/// Not all values of a type need to be valid.
|
||||
/// The function `is_valid` returns whether the argument is valid.
|
||||
///
|
||||
/// \sa `Is_valid`
|
||||
///
|
||||
bool is_valid(const T& x);
|
||||
/// @}
|
||||
}
|
||||
|
||||
///
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
///
|
||||
|
||||
///
|
||||
/// The function `max` returns the larger of two values.
|
||||
///
|
||||
/// \sa `Max`
|
||||
T max(const T& x, const T& y);
|
||||
/// @}
|
||||
}
|
||||
|
||||
///
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
///
|
||||
|
||||
///
|
||||
/// The function `min` returns the smaller of two values.
|
||||
///
|
||||
/// \sa `Min`
|
||||
///
|
||||
T min(const T& x, const T& y);
|
||||
/// @}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
///
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
///
|
||||
|
||||
///
|
||||
/// Not all values of a type need to be valid. The function object
|
||||
/// class `Is_valid` checks this.
|
||||
///
|
||||
/// For example, an expression like
|
||||
/// `NT(0)/NT(0)` can result in an invalid number.
|
||||
/// Routines may have as a precondition that all values are valid.
|
||||
///
|
||||
/// \models ::AdaptableFunctor
|
||||
template<class T>
|
||||
class Is_valid {
|
||||
/*!
|
||||
returns if the argument is valid.
|
||||
*/
|
||||
bool operator()(const T& x);
|
||||
};
|
||||
|
||||
///
|
||||
/// The function object class `Max` returns the larger of two values.
|
||||
/// The order is induced by the second template argument <TT>Less</TT>.
|
||||
/// The default value for `Less` is `std::less`.
|
||||
/// Note that `T` must be a model of `LessThanComparable`
|
||||
/// in case `std::less` is used.
|
||||
///
|
||||
/// \models ::AdaptableFunctor
|
||||
template<typename T, typename Less>
|
||||
class Max {
|
||||
/*!
|
||||
default constructor.
|
||||
*/
|
||||
|
||||
Max();
|
||||
/*!
|
||||
The constructed object will use `c` to compare the arguments.
|
||||
*/
|
||||
Max(Less c);
|
||||
|
||||
/*!
|
||||
returns the larger of `x` and `y`, with respect to the order induced by `Less`.
|
||||
*/
|
||||
T operator()(const T& x, const T& y);
|
||||
};
|
||||
template
|
||||
|
||||
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
||||
namespace CGAL {
|
||||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
///
|
||||
|
||||
///
|
||||
/// The function object class `Min` returns the smaller of two values.
|
||||
/// The order is induced by the second template argument <TT>Less</TT>.
|
||||
/// The default value for `Less` is `std::less`.
|
||||
/// Note that `T` must be a model of `LessThanComparable`
|
||||
/// in case `std::less` is used.
|
||||
///
|
||||
template<typename T, typename Less>
|
||||
class Min {
|
||||
/*!
|
||||
default constructor.
|
||||
*/
|
||||
Min();
|
||||
|
||||
/*!
|
||||
The constructed object will use `c` to compare the arguments.
|
||||
*/
|
||||
Min(Less c);
|
||||
|
||||
/*!
|
||||
returns the larger of `x` and `y`, with respect to the order induced by `Less`.
|
||||
*/
|
||||
T operator()(const T& x, const T& y);
|
||||
|
||||
};
|
||||
|
||||
/// \models ::AdaptableFunctor
|
||||
/// @}
|
||||
} // namespace CGAL
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/// \addtogroup PkgNumberTypes Number Types
|
||||
/// @{
|
||||
|
||||
/// \addtogroup NumberTypesConcepts Concepts
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Concept to represent algebraic numbers of degree up to 2 over a `RealEmbeddable` `IntegralDomain` `RT`.
|
||||
///
|
||||
/// A model of this concept is associated to this `RT` via `CGAL::Root_of_traits<RT>`, which
|
||||
/// provides `Root_of_2` as a public type. Moreover, `CGAL::Root_of_traits<RT>` provides
|
||||
/// the public type `Root_of_1`, which is the quotient field of `RT`.
|
||||
/// We refer to `Root_of_1` as FT (for field type).
|
||||
///
|
||||
/// The model of `RootOf_2 ` is a `RealEmbeddable` `IntegralDomain`,
|
||||
/// which is `ImplicitInteroperable` with `RT`, `FT`.
|
||||
/// In particular, it provides the comparison operators `==, !=, <, >, <=, >=` as well as the `sign`
|
||||
/// and `compare` functions needed to compare elements of types `RootOf_2, RT` and `FT`.
|
||||
/// It also provides all arithmetic operators `+,-,*,/` among elements of type `RootOf_2` as well as mixed forms with `RT` and `FT`.
|
||||
///
|
||||
/// However, it is important to note that arithmetic operations among elements of `RootOf_2`
|
||||
/// are only allowed in the special case when they have been constructed from equations having the
|
||||
/// same discriminant, that is, if they are defined in the same algebraic extension of degree 2.
|
||||
///
|
||||
/// Besides construction from `int, RT` and `FT` the following functions provide
|
||||
/// special construction for extensions of degree 2:
|
||||
///
|
||||
/// Same for operator `-,*,/,!=,<=,>,>=` as well as mixed forms with `RT` and `FT`.
|
||||
///
|
||||
/// - `make_root_of_2`
|
||||
/// - `make_sqrt`
|
||||
///
|
||||
/// \refines ::DefaultConstructible
|
||||
/// \refines ::CopyConstructible
|
||||
/// \refines ::FromIntConstructible
|
||||
/// \refines ::ImplicitInteroperable with RT
|
||||
/// \refines ::ImplicitInteroperable with FT
|
||||
/// \hasModel `double` (not exact)
|
||||
/// \hasModel ::CGAL::Sqrt_extension
|
||||
/// \sa `CGAL::make_root_of_2<RT>`
|
||||
/// \sa `CGAL::make_sqrt<RT>`
|
||||
/// \sa `CGAL::compute_roots_of_2<RT,OutputIterator>`
|
||||
/// \sa `CGAL::Root_of_traits<RT>`
|
||||
/// \sa `AlgebraicKernelForCircles::PolynomialForCircles_2_2`
|
||||
/// \sa `AlgebraicKernelForCircles`
|
||||
class RootOf_2 {
|
||||
public:
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
/*!
|
||||
\pre `*this` and `a` are defined in the same extension.
|
||||
*/
|
||||
RootOf_2 & operator+=(const RootOf_2& a);
|
||||
/// @}
|
||||
|
||||
}; /* concept RootOf_2 */
|
||||
|
||||
/// @}
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
/// \relates RootOf_2
|
||||
/// \pre `a` and `b` are defined in the same extension.
|
||||
RootOf_2 operator+(const RootOf_2&a,const RootOf_2& b);
|
||||
|
||||
/// \relates RootOf_2
|
||||
///
|
||||
bool operator==(const RootOf_2&a,const RootOf_2& b);
|
||||
|
||||
/// \relates RootOf_2
|
||||
///
|
||||
bool operator< (const RootOf_2&a,const RootOf_2& b);
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
|
||||
namespace CGAL {
|
||||
/*!
|
||||
|
||||
\page Numbertype Number Types
|
||||
\authors Michael Hemmer, Susan Hert, Sylvain Pion, and Stefan Schirra
|
||||
\par Reference Manual:
|
||||
\ref PkgNumberTypes
|
||||
|
||||
# Introduction #
|
||||
|
||||
This chapter gives an overview of the number types supported by
|
||||
\cgal. Number types must fulfill certain syntactical and semantic
|
||||
requirements, such that they can be successfully used in \cgal code.
|
||||
In general they are expected to be a model of an algebraic structure
|
||||
concepts and in case they model a subring of the real numbers they are
|
||||
also a model of `RealEmbeddable`. For an overview of the algebraic
|
||||
structure concepts see Section \ref PkgAlgebraicFoundations "Algebraic Foundations".
|
||||
|
||||
# Built-in Number Types #
|
||||
|
||||
The built-in number types `float`, `double` and `long double` have the
|
||||
required arithmetic and comparison operators. They lack some required
|
||||
routines though which are automatically included by \cgal.
|
||||
|
||||
\note The functions can be found in the header files `CGAL/int.h`, `CGAL/float.h`, `CGAL/double.h` and `CGAL/long_long.h`.
|
||||
|
||||
All built-in number types of \cpp can represent a discrete (bounded)
|
||||
subset of the rational numbers only. We assume that the
|
||||
floating-point arithmetic of your machine follows <span
|
||||
class="textsc">Ieee</span> floating-point standard. Since the
|
||||
floating-point culture has much more infrastructural support
|
||||
(hardware, language definition and compiler) than exact computation,
|
||||
it is very efficient. Like with all number types with finite
|
||||
precision representation which are used as approximations to the
|
||||
infinite ranges of integers or real numbers, the built-in number types
|
||||
are inherently potentially inexact. Be aware of this if you decide to
|
||||
use the efficient built-in number types: you have to cope with
|
||||
numerical problems. For example, you can compute the intersection
|
||||
point of two lines and then check whether this point lies on the two
|
||||
lines. With floating point arithmetic, roundoff errors may cause the
|
||||
answer of the check to be `false`. With the built-in integer types
|
||||
overflow might occur.
|
||||
|
||||
# Number Types Provided by CGAL #
|
||||
\anchor cgalnt
|
||||
|
||||
\cgal provides several number types that can be used for exact
|
||||
computation. These include the `Quotient` class that can be used to
|
||||
create, for example, a number type that behaves like a rational number
|
||||
when parameterized with a number type which can represent integers.
|
||||
The number type `MP_Float` is able to represent multi-precision
|
||||
floating point values, a generalization of integers scaled by a
|
||||
(potentially negative) power of 2. It allows to deal with ring
|
||||
operations over floating-point values with requiring rational numbers.
|
||||
By plugging it in `Quotient`, one obtains rational numbers. Note that
|
||||
`MP_Float` may not be as efficient as the integer types provided by
|
||||
<span class="textsc">Gmp</span> or \leda, but it has the advantage to
|
||||
make more parts of \cgal independent on these external libraries for
|
||||
handling robustness issues. The templated number type
|
||||
`Lazy_exact_nt<NT>` is able to represent any number that `NT` is able
|
||||
to represent, but because it first tries to use an approximate value
|
||||
to perform computations it can be faster than `NT`. A number type for
|
||||
doing interval arithmetic, `Interval_nt`, is provided. This number
|
||||
type helps in doing arithmetic filtering in many places such as
|
||||
`Filtered_predicate`. `CGAL::Sqrt_extension` is a number type that
|
||||
allows to represent algebraic numbers of degree 2 as well as nested
|
||||
forms. A generic function `CGAL::make_root_of_2` allows to build this
|
||||
type generically. A debugging helper
|
||||
`Number_type_checker<NT1,NT2,Comparator>` is also provided which
|
||||
allows to compare the behavior of operations over two number types.
|
||||
|
||||
# Number Types Provided by GMP #
|
||||
|
||||
\anchor gmpnt
|
||||
\cgal provides wrapper classes for number types defined in the <span class="textsc">Gnu</span> Multiple Precision arithmetic library \cite g-ggmpa-. The file
|
||||
`CGAL/Gmpz.h` provides the class `Gmpz`, a wrapper class for
|
||||
the arbitrary-precision integer type `mpz_t`, which is compliant
|
||||
with the \cgal number type requirements. The file `CGAL/Gmpq.h`
|
||||
provides the class `Gmpq`, a wrapper class for the arbitrary-precision
|
||||
rational type `mpq_t`, which is compliant with the \cgal number
|
||||
type requirements.
|
||||
The file `CGAL/Gmpzf.h` provides the class `Gmpzf`, an exact
|
||||
arbitrary-precision floating-point type. Hence, It does not support
|
||||
operators like `/` to guarantee exactness of the operations. The
|
||||
arithmetic operations on this type are restricted to <TT>+</TT>, <TT>-</TT>,
|
||||
`*` and `CGAL::integral_division`.
|
||||
The file `CGAL/Gmpfr.h` provides the class `Gmpfr`,
|
||||
a fixed-precision floating-point number type. Since the precision
|
||||
(number of bits used to represent the mantissa of the number) is fixed
|
||||
for each object, the result of each operation is rounded when necessary.
|
||||
Though not necessary at first, the user will take full advantage of this
|
||||
number type by understanding the ideas behind floating-point arithmetic,
|
||||
such as precision and rounding, and understanding the flags set by this
|
||||
library after each operation. For more details, the reader should refer
|
||||
to \cite cgal:mt-mpfr and the `Gmpfr` reference manual.
|
||||
In addition, it is possible to directly use the \cpp number types provided by
|
||||
<span class="textsc">Gmp</span> : `mpz_class`, `mpq_class` (note that support for
|
||||
`mpf_class` is incomplete). The file `CGAL/gmpxx.h` provides the
|
||||
necessary functions to make these classes compliant to the \cgal number type
|
||||
requirements.
|
||||
To use these classes, <span class="textsc">Gmp</span> and <span class="textsc">Mpfr</span> must be installed.
|
||||
|
||||
# Number Types Provided by LEDA #
|
||||
|
||||
\anchor ledant
|
||||
\leda provides number types that can be used for exact computation
|
||||
with both Cartesian and homogeneous representations. If you are using
|
||||
homogeneous representation with the built-in integer types
|
||||
`short`, `int`, and `long` as ring type, exactness of
|
||||
computations can be guaranteed only if your input data come from a
|
||||
sufficiently small integral range and the depth of the computations is
|
||||
sufficiently small. \leda provides the number type `leda_integer` for
|
||||
integers of arbitrary length. (Of course the length is
|
||||
somehow bounded by the resources of your computer.) It can be used as
|
||||
ring type in homogeneous kernels and leads to exact
|
||||
computation as long as all intermediate results are rational. For the
|
||||
same kind of problems, Cartesian representation with number type
|
||||
`leda_rational` leads to exact computation as well.
|
||||
The number type `leda_bigfloat` in \leda is a variable precision
|
||||
floating-point type. Rounding mode and precision (i.e. mantissa length) of
|
||||
`leda_bigfloat` can be set.
|
||||
The most sophisticated number type in \leda is the number type called
|
||||
`leda_real`. Like in Pascal, where the name `real` is used for
|
||||
floating-point numbers, the name `leda_real` does not describe the
|
||||
number type precisely, but intentionally.
|
||||
`leda_real`s are a subset of real algebraic
|
||||
numbers. Any integer is `leda_real` and `leda_real`s are closed under
|
||||
the operations \f$+,-,*,/\f$ and \f$k\f$-th root computation. For \leda version 5.0 and
|
||||
or later `leda_real` is also able to represent real roots of polynomials.
|
||||
`leda_real`s guarantee that
|
||||
all comparisons between expressions involving `leda_real`s produce the
|
||||
exact result.
|
||||
The files <TT>CGAL/leda_integer.h</TT>, <TT>CGAL/leda_rational.h</TT>,
|
||||
<TT>CGAL/leda_bigfloat.h</TT> and <TT>CGAL/leda_real.h</TT> provide the
|
||||
necessary functions to make these classes compliant to the \cgal number type
|
||||
requirements.
|
||||
|
||||
# Number Types Provided by CORE #
|
||||
|
||||
\anchor corent
|
||||
In principle <span class="textsc">Core</span> \cite klpy-clp-99 provides the same set of number types as \leda.
|
||||
The type `CORE::BigInt` represent integers and `CORE::BigRat`
|
||||
represent rationals of arbitrary length. The number type `CORE::BigFloat` is
|
||||
a variable precision floating-point type. It is also possible to interpret it as an
|
||||
interval type, since it also carries the error of a computed value.
|
||||
As for \leda, the most sophisticated number type in <span class="textsc">Core</span> is `CORE::Expr`,
|
||||
which is in its functionality equivalent to `leda_real`.
|
||||
|
||||
The files <TT>CGAL/CORE_BigInt.h</TT>, <TT>CGAL/CORE_BigRat.h</TT>,
|
||||
<TT>CGAL/CORE_BigFloat.h</TT> and <TT>CGAL/CORE_Expr.h</TT> provide the
|
||||
necessary functions to make these classes compliant to the \cgal number type
|
||||
requirements.
|
||||
<span class="textsc">Core</span> version 1.7 or later is required.
|
||||
|
||||
# Interval arithmetic #
|
||||
|
||||
Interval arithmetic is very important for geometric programming. It
|
||||
is a fundamental tool for filtering predicates. For many problems,
|
||||
intervals of machine double-precision numbers are sufficient, but it is
|
||||
not always enough. For example, one approach for determining the sign of
|
||||
an expression is to evaluate its sign using interval arithmetic and to
|
||||
repeatedly increase the precision of the bounds of the intervals until
|
||||
either the interval does not contain zero or its width is less than the
|
||||
separation bound of the polynomial.
|
||||
For intervals of machine double-precision numbers, \cgal provides
|
||||
the class `Interval_nt`. For intervals of floating-point
|
||||
arbitrary-precision numbers, the class `Gmpfi` is provided in the
|
||||
file <TT>CGAL/Gmpfi.h</TT>.
|
||||
Endpoints of `Gmpfi` intervals are represented as `Gmpfr`
|
||||
numbers. Each interval has an associated <I>precision</I>, which is
|
||||
the maximum precision (number of bits used to represent the mantissa)
|
||||
of its endpoints. The result of the operations is guaranteed to be
|
||||
always contained in the returned interval. Since the interval arithmetic
|
||||
is implemented on top of `Gmpfr`, the global flags and the default
|
||||
precision are inherited from the `Gmpfr` interface. See
|
||||
\cite cgal:r-mpfi and the `Gmpfi` reference manual for details.
|
||||
To use the `Gmpfi` class, <span class="textsc">Mpfi</span> must be installed.
|
||||
|
||||
# User-supplied Number Types #
|
||||
|
||||
In order to use your own number type it must be a model of the according
|
||||
algebraic structure concept, in particular you must provide a
|
||||
specialization of `CGAL::Algebraic_structure_traits` and also of
|
||||
`Real_embeddable_traits` in case it is a sub ring of the real numbers.
|
||||
If you even want to provide a related ensemble of number types you should also
|
||||
provide specializations for `CGAL::Coercion_traits` in order to
|
||||
reflect their interoperability.
|
||||
|
||||
# Design and Implementation History #
|
||||
|
||||
This package was naturally one of the first packages implemented in \cgal.
|
||||
It initially contained the `Quotient`, `Gmpz` and `Gmpq` classes,
|
||||
together with the interfaces to the number types provided by \leda, which were
|
||||
implemented by Stefan Schirra and Andreas Fabri.
|
||||
Later, around 1998-2002, Sylvain Pion implemented `Interval_nt`
|
||||
`MP_Float` and `Lazy_exact_nt`, together with the interfaces to
|
||||
the `mpz_class` and `mpq_class` types from <span class="textsc">Gmp</span>.
|
||||
Number type concepts were then refined, notably by Lutz Kettner and
|
||||
Susan Hert, who also contributed utility algorithms.
|
||||
The work on concepts was further extended within the <span class="textsc">Exacus</span> project, and was finally
|
||||
contributed to \cgal by Michael Hemmer in 2006, as what is now the separate
|
||||
Algebraic Foundations package \ref ChapterAlgebraicFoundations , together with
|
||||
a rewritten interface to operations on number types.
|
||||
The class `Sqrt_extension` was contributed by Michael Hemmer and Ron Wein around 2006. In 2010 it went through a considerable reinvestigation by S'bastien Loriot, Michael Hemmer, and Monique Teillaud. As a result it got further improved and now replaces several similar types such as `Root_of_2`, which had been contributed by Pedro M. M. de Castro, Sylvain Pion and Monique Teillaud, and is deprecated since CGAL-3.8.
|
||||
|
||||
In 2008-2010, Bernd Gärtner added the `Gmpzf` class, while
|
||||
Luis Peñaranda and Sylvain Lazard contributed the `Gmpfi` and
|
||||
`Gmpfr` classes.
|
||||
|
||||
*/
|
||||
} // namespace CGAL
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*!
|
||||
\addtogroup PkgNumberTypes Number Types
|
||||
<table cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="2"><h1>Number Types</h1></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan="2">\image html illustration.png "" </td>
|
||||
<td>
|
||||
\par Michael Hemmer, Susan Hert, Sylvain Pion, and Stefan Schirra
|
||||
|
||||
\par "" This package provides number type concepts as well as number type classes and wrapper classes for third party number type libraries.
|
||||
|
||||
\since \cgal 1.0
|
||||
|
||||
\cgalbib{cgal:hhkps-nt-12}
|
||||
|
||||
\license{ \ref licensesLGPL "LGPL" }
|
||||
|
||||
\par Resources:
|
||||
\ref Numbertype "User Manual"
|
||||
</td>
|
||||
</table>
|
||||
*/
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
|
|
@ -66,7 +66,7 @@ was constructed is guaranteed to be included in the constructed interval.
|
|||
Precision_type p=get_default_precision());}
|
||||
{creates a \ccc{Gmpfi} initialized with endpoints \ccc{left}
|
||||
and \ccc{right}. The rounding of the endpoints will guarantee
|
||||
that \([\ccc{left},\ccc{right}]\) is included in \ccVar .}
|
||||
that [\ccc{left},\ccc{right}] is included in \ccVar .}
|
||||
|
||||
\ccConstructor{template<class L, class R>
|
||||
Gmpfi(std::pair<const L&,const R&> endpoints,
|
||||
|
|
@ -75,7 +75,7 @@ was constructed is guaranteed to be included in the constructed interval.
|
|||
\ccc{endpoints.first} and \ccc{endpoints.second}. \ccc{L} and
|
||||
\ccc{R} are types from which \ccc{Gmpfr} can be constructed
|
||||
from. The rounding of the endpoints will guarantee that
|
||||
\([\ccc{endpoints.first},\ccc{endpoints.second}]\) is included in
|
||||
[\ccc{endpoints.first},\ccc{endpoints.second}] is included in
|
||||
\ccVar .}
|
||||
|
||||
\ccOperations
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ than the precision of the result number, the results are rounded following
|
|||
different possible criteria (called \emph{rounding modes}).
|
||||
|
||||
Currently, \mpfr\ supports four rounding modes: round to nearest,
|
||||
round toward zero, round down (or toward \(-\infty\)) and round up
|
||||
(or toward \(+\infty\)). When not specified explicitly, the
|
||||
round toward zero, round down (or toward $-\infty$) and round up
|
||||
(or toward $+\infty$). When not specified explicitly, the
|
||||
operations use the default rounding mode, which is in practice a
|
||||
variable local to each execution thread. The default rounding mode
|
||||
can be set to any of the four rounding modes (initially, it is set
|
||||
|
|
|
|||
|
|
@ -18,26 +18,23 @@
|
|||
|
||||
\input{NumberTypeSupport_ref/mpz_class.tex}
|
||||
\input{NumberTypeSupport_ref/mpq_class.tex}
|
||||
%\input{NumberTypeSupport_ref/mpf_class.tex}
|
||||
|
||||
|
||||
\input{NumberTypeSupport_ref/Gmpz.tex}
|
||||
\input{NumberTypeSupport_ref/Gmpq.tex}
|
||||
\input{NumberTypeSupport_ref/Gmpzf.tex}
|
||||
\input{NumberTypeSupport_ref/Gmpfr.tex}
|
||||
\input{NumberTypeSupport_ref/Gmpfi.tex}
|
||||
% \input{NumberTypeSupport_ref/Gmpfr.tex}
|
||||
% \input{NumberTypeSupport_ref/Gmpfi.tex}
|
||||
|
||||
\input{NumberTypeSupport_ref/MP_Float.tex}
|
||||
\input{NumberTypeSupport_ref/Interval_nt.tex}
|
||||
\input{NumberTypeSupport_ref/Lazy_exact_nt.tex}
|
||||
\input{NumberTypeSupport_ref/Quotient.tex}
|
||||
%\input{NumberTypeSupport_ref/Counted_number.tex}
|
||||
\input{NumberTypeSupport_ref/Number_type_checker.tex}
|
||||
|
||||
%functors
|
||||
\input{NumberTypeSupport_ref/Max_functor.tex}
|
||||
\input{NumberTypeSupport_ref/Min_functor.tex}
|
||||
\input{NumberTypeSupport_ref/Is_valid_functor.tex}
|
||||
%functions
|
||||
\input{NumberTypeSupport_ref/max.tex}
|
||||
\input{NumberTypeSupport_ref/min.tex}
|
||||
\input{NumberTypeSupport_ref/is_valid.tex}
|
||||
|
|
|
|||
Loading…
Reference in New Issue