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{ \ccIgnore{
For types representing \Z, this is round $q$ towards zero. 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. MP_Float Z[1/2] is not clear yet.
} }

View File

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

View File

@ -2,145 +2,15 @@
\ccDefinition \ccDefinition
The concept \ccRefName\ defines the syntactic requirements a number type must The concept \ccRefName\ combines the requirements of the concepts
meet in order to be used in \cgal\ as a ring type. This implies that \ccc{IntegralDomainWithoutDivision} and \ccc{RealEmbeddable}.
\ccc{CGAL::Number_type_traits<RingNumberType>::Has_division} is not required A model of \ccRefName\ can be used as a template parameter
to be \ccc{CGAL::Tag_true}. Unsigned numbers are excluded due to for Homogeneous kernels.
semantical limitations in the ordering.
\ccRefines \ccRefines
CopyConstructible, Assignable \ccc{IntegralDomainWithoutDivision}\\
\ccc{RealEmbeddable}
\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}.}
\ccHasModels \ccHasModels
@ -158,8 +28,6 @@ have as a precondition that all numerical values are valid.}
\ccc{leda_real} \\ \ccc{leda_real} \\
\ccSeeAlso \ccSeeAlso
\ccRefConceptPage{EuclideanRingNumberType} \\
\ccRefConceptPage{FieldNumberType} \\ \ccRefConceptPage{FieldNumberType} \\
\ccRefIdfierPage{CGAL::Ring_tag} \\
\end{ccRefConcept} \end{ccRefConcept}

View File

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

View File

@ -104,7 +104,7 @@
%Miscellaneous %Miscellaneous
%\input{Algebraic_foundations_ref/RingNumberType.tex} \input{Algebraic_foundations_ref/RingNumberType.tex}
%\input{Algebraic_foundations_ref/FieldNumberType.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 add a new entry in the globally maintained Bib file.
\item extra review of \ccc{Root_of_2} \item extra review of \ccc{Root_of_2}
\item add isModel to traits classes and hasModels to concepts \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 rm inexact version of \ccc{MP_float}.
\item Functions \ccc{min}, \ccc{max}, \ccc{is_valid} are considered to be more \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. basic than this package. We added a file utils.h for this.
@ -71,7 +69,7 @@ Keep in mind:
\subsection{Changes} \subsection{Changes}
\begin{itemize} \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 function \ccc{CGAL::is_finite} for float, double, long double
\item Moved Max/Min/Is\_valid/Boolean\_tag.. to STL-extension \item Moved Max/Min/Is\_valid/Boolean\_tag.. to STL-extension
\item mv \ccc{AdaptableUnaryFunction} and \ccc{AdaptableBinaryFunction} \item mv \ccc{AdaptableUnaryFunction} and \ccc{AdaptableBinaryFunction}