added concept RingNumberType

added concept FieldNumberType
This commit is contained in:
Michael Hemmer 2007-03-24 10:47:07 +00:00
parent 1c82d5ebb2
commit 022429aa60
6 changed files with 21 additions and 171 deletions

View File

@ -14,7 +14,7 @@ Moreover, we require $q$ to be minimized with respect to the proper integer norm
\ccIgnore{
For types representing \Z, this is round $q$ towards zero.
For univariat polynomials this has no effect at all.
For univariate polynomials this has no effect at all.
MP_Float Z[1/2] is not clear yet.
}

View File

@ -1,30 +1,15 @@
\begin{ccRefConcept}{FieldNumberType}
The concept \ccRefName\ defines the syntactic requirements of a number type
to be used as a template parameter for the Cartesian kernels. This number
type supports the operations $+$, $-$, $*$ and $/$. This implies that
\ccc{CGAL::Number_type_traits<FieldNumberType>::Has_division} is
\ccc{CGAL::Tag_true}.
\ccDefinition
The concept \ccRefName\ combines the requirements of the concepts
\ccc{Field} and \ccc{RealEmbeddable}.
A model of \ccRefName\ can be used as a template parameter
for Cartesian kernels.
\ccRefines
RingNumberType
\ccCreationVariable{n1}
\ccOperations
\ccFunction{FieldNumberType operator/(const FieldNumberType &n1,
const FieldNumberType &n2);} {}
\ccGlue
\ccFunction{FieldNumberType operator/(int n1,
const FieldNumberType &n2);} {}
\ccGlue
\ccFunction{FieldNumberType operator/(const FieldNumberType &n1,
int n2);} {}
\ccGlue
\ccMethod{FieldNumberType operator/=(const FieldNumberType &n2) const;}{}
\ccGlue
\ccMethod{FieldNumberType operator/=(int n2) const;}{}
\ccc{Field}\\
\ccc{RealEmbeddable}
\ccHasModels
\ccc{float} \\
@ -39,8 +24,7 @@ RingNumberType
\ccc{leda_real} \\
\ccSeeAlso
\ccRefConceptPage{EuclideanRingNumberType} \\
\ccRefConceptPage{RingNumberType} \\
\ccRefConceptPage{Kernel} \\
\ccRefIdfierPage{CGAL::Field_tag} \\
\end{ccRefConcept}

View File

@ -2,145 +2,15 @@
\ccDefinition
The concept \ccRefName\ defines the syntactic requirements a number type must
meet in order to be used in \cgal\ as a ring type. This implies that
\ccc{CGAL::Number_type_traits<RingNumberType>::Has_division} is not required
to be \ccc{CGAL::Tag_true}. Unsigned numbers are excluded due to
semantical limitations in the ordering.
The concept \ccRefName\ combines the requirements of the concepts
\ccc{IntegralDomainWithoutDivision} and \ccc{RealEmbeddable}.
A model of \ccRefName\ can be used as a template parameter
for Homogeneous kernels.
\ccRefines
CopyConstructible, Assignable
\ccSetTwoColumns{}{\hspace*{8.5cm}}
\ccCreation
\ccCreationVariable{n1}
\ccConstructor{RingNumberType();}
{Declaration of a variable.}
\ccConstructor{RingNumberType(int i);}
{Declaration and initialization with a small integer
constant $i$, $0 \leq i \leq 127$. The neutral elements for addition
(zero) and multiplication (one) are needed quite often, but sometimes
other small constants are useful too. The value 127 was chosen such
that even signed 8 bit number types can fulfill this condition.}
\ccSetThreeColumns{RingNumberTypeXXX}{}{\hspace*{8.5cm}}
\ccOperations
The comparison operators need to be provided.
\ccFunction{bool operator==(const RingNumberType &n1,
const RingNumberType &n2);} {}
\ccGlue
\ccFunction{bool operator!=(const RingNumberType &n1,
const RingNumberType &n2);} {}
\ccGlue
\ccFunction{bool operator<(const RingNumberType &n1,
const RingNumberType &n2);} {}
\ccGlue
\ccFunction{bool operator>(const RingNumberType &n1,
const RingNumberType &n2);} {}
\ccGlue
\ccFunction{bool operator<=(const RingNumberType &n1,
const RingNumberType &n2);} {}
\ccGlue
\ccFunction{bool operator>=(const RingNumberType &n1,
const RingNumberType &n2);} {}
In addition, the comparisons with small values of type \ccc{int} are also
required.
\ccFunction{bool operator==(int n1, const RingNumberType &n2);} {}
\ccGlue
\ccFunction{bool operator!=(int n1, const RingNumberType &n2);} {}
\ccGlue
\ccFunction{bool operator<(int n1, const RingNumberType &n2);} {}
\ccGlue
\ccFunction{bool operator>(int n1, const RingNumberType &n2);} {}
\ccGlue
\ccFunction{bool operator<=(int n1, const RingNumberType &n2);} {}
\ccGlue
\ccFunction{bool operator>=(int n1, const RingNumberType &n2);} {}
\ccGlue
\ccFunction{bool operator==(const RingNumberType &n1, int n2);} {}
\ccGlue
\ccFunction{bool operator!=(const RingNumberType &n1, int n2);} {}
\ccGlue
\ccFunction{bool operator<(const RingNumberType &n1, int n2);} {}
\ccGlue
\ccFunction{bool operator>(const RingNumberType &n1, int n2);} {}
\ccGlue
\ccFunction{bool operator<=(const RingNumberType &n1, int n2);} {}
\ccGlue
\ccFunction{bool operator>=(const RingNumberType &n1, int n2);} {}
The arithmetic operators for the addition, subtraction and multiplication
are required as well.
\ccFunction{RingNumberType operator+(const RingNumberType &n1,
const RingNumberType &n2);} {}
\ccGlue
\ccFunction{RingNumberType operator-(const RingNumberType &n1,
const RingNumberType &n2);} {}
\ccGlue
\ccFunction{RingNumberType operator*(const RingNumberType &n1,
const RingNumberType &n2);} {}
\ccGlue
\ccFunction{RingNumberType operator-(const RingNumberType &n);} {}
\ccGlue
\ccMethod{RingNumberType operator+=(const RingNumberType &n2) const;} {}
\ccGlue
\ccMethod{RingNumberType operator-=(const RingNumberType &n2) const;} {}
\ccGlue
\ccMethod{RingNumberType operator*=(const RingNumberType &n2) const;} {}
And similarly, the mixed operators with small values of type \ccc{int} are also
required.
\ccFunction{RingNumberType operator+(int n1, const RingNumberType &n2);} {}
\ccGlue
\ccFunction{RingNumberType operator-(int n1, const RingNumberType &n2);} {}
\ccGlue
\ccFunction{RingNumberType operator*(int n1, const RingNumberType &n2);} {}
\ccGlue
\ccFunction{RingNumberType operator+(const RingNumberType &n1, int n2);} {}
\ccGlue
\ccFunction{RingNumberType operator-(const RingNumberType &n1, int n2);} {}
\ccGlue
\ccFunction{RingNumberType operator*(const RingNumberType &n1, int n2);} {}
\ccGlue
\ccMethod{RingNumberType operator+=(int n2) const;} {}
\ccGlue
\ccMethod{RingNumberType operator-=(int n2) const;} {}
\ccGlue
\ccMethod{RingNumberType operator*=(int n2) const;} {}
The following accessory functions are needed for special purposes :
\ccFunction{bool is_valid(const RingNumberType &n);}
{Not all values of a number type need be valid. The function
\ccStyle{is_valid} checks this. For example, an expression like
\ccStyle{NT(0)/NT(0)} can result in an invalid number. Routines may
have as a precondition that all numerical values are valid.}
\ccFunction{bool is_finite(const RingNumberType &n);}
{ When two large values are multiplied, the result may not fit in a
\ccStyle{NT}.
Some number types (e.g. the standard \ccc{float} and \ccc{double} types)
have a way to represent a too big value as infinity.
\ccStyle{is_finite} implies \ccStyle{is_valid}.}
\ccFunction{double to_double(const RingNumberType &n);}
{gives the double value for a number type.
This is usually an approximation for the real (stored) value.
It can be used to send numbers to a renderer or to store them
in a file.}
\ccFunction{std::pair<double,double> to_interval(const RingNumberType &n);}
{gives a double interval that encloses \ccc{n}.}
\ccc{IntegralDomainWithoutDivision}\\
\ccc{RealEmbeddable}
\ccHasModels
@ -158,8 +28,6 @@ have as a precondition that all numerical values are valid.}
\ccc{leda_real} \\
\ccSeeAlso
\ccRefConceptPage{EuclideanRingNumberType} \\
\ccRefConceptPage{FieldNumberType} \\
\ccRefIdfierPage{CGAL::Ring_tag} \\
\end{ccRefConcept}

View File

@ -120,7 +120,7 @@
\subsection*{Miscellaneous}
\subsubsection*{Concepts}
%\ccRefConceptPage{RingNumberType}\\
%\ccRefConceptPage{FieldNumberType}\\
\ccRefConceptPage{RingNumberType}\\
\ccRefConceptPage{FieldNumberType}\\
\ccRefConceptPage{FromIntConstructible}\\
\ccRefConceptPage{FromDoubleConstructible}\\

View File

@ -104,7 +104,7 @@
%Miscellaneous
%\input{Algebraic_foundations_ref/RingNumberType.tex}
%\input{Algebraic_foundations_ref/FieldNumberType.tex}
\input{Algebraic_foundations_ref/RingNumberType.tex}
\input{Algebraic_foundations_ref/FieldNumberType.tex}

View File

@ -27,8 +27,6 @@ TODO:
\item add a new entry in the globally maintained Bib file.
\item extra review of \ccc{Root_of_2}
\item add isModel to traits classes and hasModels to concepts
\item add concept FieldNumberType
\item add concept RingNumberType
\item rm inexact version of \ccc{MP_float}.
\item Functions \ccc{min}, \ccc{max}, \ccc{is_valid} are considered to be more
basic than this package. We added a file utils.h for this.
@ -71,7 +69,7 @@ Keep in mind:
\subsection{Changes}
\begin{itemize}
\item rm IsFinite from \ccc{RealEmeddable} concept
\item rm IsFinite from \ccc{RealEmbeddable} concept
function \ccc{CGAL::is_finite} for float, double, long double
\item Moved Max/Min/Is\_valid/Boolean\_tag.. to STL-extension
\item mv \ccc{AdaptableUnaryFunction} and \ccc{AdaptableBinaryFunction}