DGtal
0.6.devel
|
#include <ModuloComputer.h>
Public Types | |
typedef NumberTraits< TInteger > ::SignedVersion | Integer |
typedef NumberTraits< Integer > ::ParamType | IntegerParamType |
typedef NumberTraits< TInteger > ::UnsignedVersion | UnsignedInteger |
typedef NumberTraits < UnsignedInteger >::ParamType | UnsignedIntegerParamType |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((CInteger< Integer >)) | |
BOOST_CONCEPT_ASSERT ((CUnsignedInteger< UnsignedInteger >)) | |
ModuloComputer (UnsignedIntegerParamType m) | |
void | increment (UnsignedInteger &i) const |
void | decrement (UnsignedInteger &i) const |
UnsignedInteger | next (UnsignedIntegerParamType i) const |
UnsignedInteger | previous (UnsignedIntegerParamType i) const |
UnsignedInteger | cast (IntegerParamType i) const |
bool | less (UnsignedIntegerParamType i, UnsignedIntegerParamType j) const |
UnsignedInteger | posDiff (UnsignedIntegerParamType j, UnsignedIntegerParamType i) const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Protected Member Functions | |
ModuloComputer () |
Private Member Functions | |
ModuloComputer (const ModuloComputer &other) | |
ModuloComputer & | operator= (const ModuloComputer &other) |
Private Attributes | |
UnsignedInteger | k |
implements basic functions on modular arithmetic.
Description of template class 'ModuloComputer'
TInteger | type of integer. |
Example:
Definition at line 80 of file ModuloComputer.h.
typedef NumberTraits<TInteger>::SignedVersion DGtal::ModuloComputer< TInteger >::Integer |
Definition at line 83 of file ModuloComputer.h.
typedef NumberTraits<Integer>::ParamType DGtal::ModuloComputer< TInteger >::IntegerParamType |
Definition at line 84 of file ModuloComputer.h.
typedef NumberTraits<TInteger>::UnsignedVersion DGtal::ModuloComputer< TInteger >::UnsignedInteger |
Definition at line 86 of file ModuloComputer.h.
typedef NumberTraits<UnsignedInteger>::ParamType DGtal::ModuloComputer< TInteger >::UnsignedIntegerParamType |
Definition at line 87 of file ModuloComputer.h.
|
inline |
Initializes the modulo computer with the value [m].
m | any non-zero integer. |
Definition at line 48 of file ModuloComputer.ih.
|
protected |
Constructor. Forbidden by default (protected to avoid g++ warnings).
|
private |
Copy constructor.
other | the object to clone. Forbidden by default. |
DGtal::ModuloComputer< TInteger >::BOOST_CONCEPT_ASSERT | ( | (CInteger< Integer >) | ) |
DGtal::ModuloComputer< TInteger >::BOOST_CONCEPT_ASSERT | ( | (CUnsignedInteger< UnsignedInteger >) | ) |
|
inline |
i | any integer value. |
i | any integer value. |
Definition at line 119 of file ModuloComputer.ih.
Referenced by DGtal::OrderedAlphabet::duvalPPMod().
|
inline |
Decrement the value [i] modulo.
i | any value between 0 and [k] (excluded). |
Definition at line 78 of file ModuloComputer.ih.
Referenced by DGtal::FreemanChain< TInteger >::cleanOuterSpikes().
|
inline |
Increment the value [i] modulo.
i | any value between 0 and [k] (excluded). |
Definition at line 65 of file ModuloComputer.ih.
Referenced by DGtal::FreemanChain< TInteger >::cleanOuterSpikes(), DGtal::OrderedAlphabet::duvalPPMod(), and DGtal::OrderedAlphabet::firstLyndonFactorMod().
|
inline |
Checks the validity/consistency of the object.
Definition at line 186 of file ModuloComputer.ih.
|
inline |
Less comparator modulo. Be careful, modulo comparisons have no sense when the absolute difference of the values are around k / 2.
i | any value between 0 and [k] (excluded). |
j | any value between 0 and [k] (excluded). |
Less comparator modulo. Be careful, modulo comparisons have no sense when the absolute difference of the values are around k / 2.
i | any value between 0 and [k] (excluded). |
j | any value between 0 and [k] (excluded). |
Definition at line 140 of file ModuloComputer.ih.
|
inline |
i | any value between 0 and [k] (excluded). |
Definition at line 92 of file ModuloComputer.ih.
Referenced by DGtal::FreemanChain< TInteger >::cleanOuterSpikes(), DGtal::OrderedAlphabet::duvalPPMod(), DGtal::OrderedAlphabet::firstLyndonFactorMod(), DGtal::AngleLinearMinimizer::getEnergy(), DGtal::AngleLinearMinimizer::getFormerEnergy(), DGtal::AngleLinearMinimizer::getFormerGradient(), DGtal::AngleLinearMinimizer::getGradient(), DGtal::AngleLinearMinimizer::oneStep(), DGtal::AngleLinearMinimizerByRelaxation::oneStep(), DGtal::AngleLinearMinimizerByGradientDescent::oneStep(), DGtal::AngleLinearMinimizerByAdaptiveStepGradientDescent::oneStep(), and DGtal::AngleLinearMinimizer::optimize().
|
private |
Assignment.
other | the object to copy. |
|
inline |
Performs j - i modulo, assuming less(i,j) is true.
j | any value between 0 and [k] (excluded). |
i | any value between 0 and [k] (excluded). |
Definition at line 160 of file ModuloComputer.ih.
|
inline |
i | any value between 0 and [k] (excluded). |
Definition at line 106 of file ModuloComputer.ih.
Referenced by DGtal::AngleLinearMinimizer::getEnergy(), DGtal::AngleLinearMinimizer::getFormerEnergy(), DGtal::AngleLinearMinimizer::getFormerGradient(), DGtal::AngleLinearMinimizer::getGradient(), DGtal::AngleLinearMinimizer::oneStep(), and DGtal::AngleLinearMinimizerByRelaxation::oneStep().
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 174 of file ModuloComputer.ih.
|
private |
Modulo of all computations.
Definition at line 166 of file ModuloComputer.h.