The class Residue represents a finite field ,
for some prime number .
The prime number is stored in a static member variable. The class provides static member functions to change this value. Note that changing the prime invalidates already existing objects of this type. However, already existing objects do not lose their value with respect to the old prime and can be reused after restoring the old prime. Since the type is based on double arithmetic the prime is restricted to values less than . The initial value of is 67111067.
Please note that the implementation of class CGAL::Residue requires a mantissa precision according to the IEEE Standard for Floating-Point Arithmetic (IEEE 754). However, on some processors the traditional FPU uses an extended precision. Hence, it is indispensable that the proper mantissa length is enforced before performing any arithmetic operations. Moreover, it is required that numbers are rounded to the next nearest value. This can be ensured using CGAL::Protect_FPU_rounding with CGAL_FE_TONEAREST, which also enforces the required precision as a side effect.
In case the flag CGAL_HAS_THREADS is undefined the prime is just stored in a static member of the class, that is, Residue is not thread-safe in this case. In case CGAL_HAS_THREADS the implementation of the class is thread safe using boost::thread_specific_ptr. However, this may cause some performance penalty. Hence, it may be advisable to configure CGAL with CGAL_HAS_NO_THREADS.
#include <CGAL/Residue.h>
| |
introduces a variable x, which is initialized with zero;
| |
| |
copy constructor;
| |
| |
introduces a variable x, which is initialized with ;
| |
| |
introduces a variable x, which is initialized with ;
|
|
|
Static member function; sets current prime to the given value and returns the old prime. |
|
|
Static member function; returns the value of the current prime. |
|
| Returns the unique representative of xwithin the range , where is the current prime. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|