cgal/Algebraic_kernel_GBRS/doc_tex/MpfiInterval_ref/MpfiInterval_ref.tex

147 lines
6.1 KiB
TeX

% Copyright (c) 2006 Inria Lorraine (France). All rights reserved.
%
% This file is part of CGAL (www.cgal.org); you can redistribute it and/or
% modify it under the terms of the GNU Lesser General Public License as
% published by the Free Software Foundation; version 2.1 of the License.
% See the file LICENSE.LGPL distributed with CGAL.
%
% Licensees holding a valid commercial license may use this file in
% accordance with the commercial license agreement provided with the software.
%
% This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
% WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%
% $URL$
% $Id$
%
%
% Author(s) : Luis Peñaranda <penarand@loria.fr>
\begin{ccRefClass}{MpfiInterval}
\ccIsModel{FieldNumberType}
\ccDefinition
An object of the class \ccRefName\ is an interval, whose endpoints
are arbitrary precision floating point numbers (implemented using the
{\sc MPFR} library).
\ccInclude{CGAL/Gbrs_algebraic_1.h}
\ccCreationVariable{i}
\ccCreation
Creation of an interval object without setting its endpoints.
\ccConstructor{MpfiInterval();}{}
Creation of an interval object \ccStyle{i} given a number. Both endpoints of
\ccStyle{i} will be equal.
\ccConstructor{MpfiInterval (int n);}{} \ccGlue
\ccConstructor{MpfiInterval (unsigned int n);}{} \ccGlue
\ccConstructor{MpfiInterval (long int n);}{} \ccGlue
\ccConstructor{MpfiInterval (unsigned long int n);}{} \ccGlue
\ccConstructor{MpfiInterval (double n);}{} \ccGlue
\ccConstructor{MpfiInterval (mpz_t n);}{} \ccGlue
\ccConstructor{MpfiInterval (mpq_t n);}{} \ccGlue
\ccConstructor{MpfiInterval (CGAL::Gmpq n);}{} \ccGlue
\ccConstructor{MpfiInterval (CGAL::Gmpz n);}{} \ccGlue
\ccConstructor{MpfiInterval (mpfr_t n);}{}
Creation of an interval object \ccStyle{i} given its two endpoints,
\ccStyle{left} and \ccStyle{right}.
\ccConstructor{MpfiInterval (int left, int right);}{} \ccGlue
\ccConstructor{MpfiInterval (unsigned int left, unsigned int right);}{} \ccGlue
\ccConstructor{MpfiInterval (long int left, long int right);}{} \ccGlue
\ccConstructor{MpfiInterval (unsigned long int left, unsigned long int right);}{} \ccGlue
\ccConstructor{MpfiInterval (double left, double right);}{} \ccGlue
\ccConstructor{MpfiInterval (mpz_t left, mpz_t right);}{} \ccGlue
\ccConstructor{MpfiInterval (mpq_t left, mpq_t right);}{} \ccGlue
\ccConstructor{MpfiInterval (CGAL::Gmpq left, CGAL::Gmpq right);}{} \ccGlue
\ccConstructor{MpfiInterval (CGAL::Gmpz left, CGAL::Gmpz right);}{} \ccGlue
\ccConstructor{MpfiInterval (mpfr_t left, mpfr_t right);}{}
Creation of an interval object \ccStyle{i} given another interval \ccStyle{n}.
\ccConstructor{MpfiInterval (mpfi_t n);}{} \ccGlue
\ccConstructor{MpfiInterval (MpfiInterval n);}{}
\ccOperations
%\ccSetThreeColumns{MpfiInterval}{}{\hspace*{8cm}}
\textbf{Comparison operators}. Here \ccStyle{i} is an interval and \ccStyle{n}
is a number of type int, mpz\_t, mpq\_t, Gmpz, Gmpq, mpfr\_t or an interval.
If interval \ccStyle{i} contains \ccStyle{n} or overlaps with \ccStyle{n} then
the exception \ccStyle{exn_overlap} is thrown.
\ccMethod{bool operator== (n);}{} \ccGlue
\ccMethod{bool operator!= (n);}{} \ccGlue
\ccMethod{bool operator< (n);}{} \ccGlue
\ccMethod{bool operator> (n);}{} \ccGlue
\ccMethod{bool operator<= (n);}{} \ccGlue
\ccMethod{bool operator>= (n);}{} \ccGlue
\ccFunction{bool operator== (n, MpfiInterval i);}{} \ccGlue
\ccFunction{bool operator!= (n, MpfiInterval i);}{} \ccGlue
\ccFunction{bool operator> (n, MpfiInterval i);}{} \ccGlue
\ccFunction{bool operator< (n, MpfiInterval i);}{} \ccGlue
\ccFunction{bool operator>= (n, MpfiInterval i);}{} \ccGlue
\ccFunction{bool operator<= (n, MpfiInterval i);}{}
\textbf{Arithmetic operators}. \ccStyle{i} is an interval and \ccStyle{n}
can be an int, mpz\_t, mpq\_t, Gmpz, Gmpq, mpfr\_t or a MpfiInterval.
\ccMethod{MpfiInterval operator+ (n);}{} \ccGlue
\ccMethod{MpfiInterval operator- (n);}{} \ccGlue
\ccMethod{MpfiInterval operator* (n);}{} \ccGlue
\ccMethod{MpfiInterval operator/ (n);}{} \ccGlue
\ccFunction{MpfiInterval operator+ (n, MpfiInterval i);}{} \ccGlue
\ccFunction{MpfiInterval operator- (n, MpfiInterval i);}{} \ccGlue
\ccFunction{MpfiInterval operator* (n, MpfiInterval i);}{} \ccGlue
\ccFunction{MpfiInterval operator/ (n, MpfiInterval i);}{} \ccGlue
\ccMethod{MpfiInterval operator+= (n);}{} \ccGlue
\ccMethod{MpfiInterval operator-= (n);}{} \ccGlue
\ccMethod{MpfiInterval operator*= (n);}{} \ccGlue
\ccMethod{MpfiInterval operator/= (n);}{}
\textbf{Other functions}
\ccMethod{mpfi_t mpfi();}
{returns the interval of type mpfi\_t stored in \ccStyle{i}.}
\ccMethod{void set_prec(mp_prec_t p);}{sets the precision of the interval to \ccStyle{p}.}
\ccMethod{mp_prec_t get_prec ();}{returns the current precision of the interval.}
\ccMethod{void get_left (mpfr_t left);}
{stores in \ccStyle{left} the value of the left endpoint of the interval.}
\ccMethod{void get_right (mpfr_t right);}
{stores in \ccStyle{right} the value of the right endpoint of the interval.}
\ccMethod{void get_endpoints (mpfr_t left, mpfr_t right);}
{stores in \ccStyle{left} and \ccStyle{right} the values of the endpoints of the interval.}
\ccMethod{bool is_point ();}
{returns true iff the two endpoints of the interval are equal.}
The \ccStyle{contains} functions return true iff the interval \ccStyle{i}
contains \ccStyle{n}.
\ccMethod{bool contains (int n);}{} \ccGlue
\ccMethod{bool contains (mpfr_t n);}{} \ccGlue
\ccMethod{bool contains (mpz_t n);}{} \ccGlue
\ccMethod{bool contains (mpq_t n);}{} \ccGlue
\ccMethod{bool contains (Gmpz n);}{} \ccGlue
\ccMethod{bool contains (Gmpq n);}{}
\ccMethod{bool is_valid ();}{returns true iff both endpoints aren't NAN.}
\ccMethod{bool is_finite ();}{returns true iff the interval is bounded.}
\ccMethod{double to_double ();}
{returns the center of the interval, rounded to the nearest double.}
\ccMethod{std::pair <double,double> to_interval ();}
{returns a pair formed by the endpoints of the interval, rounded to the
nearest doubles.}
\ccMethod{MpfiInterval sqrt ();}
{returns the square root of the interval (NAN if it is negative).}
%\ccFunction{std::ostream\& \operator<< (std::ostream \&, MpfiInterval &);}{}
\end{ccRefClass}