31#if defined(IntegerComputer_RECURSES)
32#error Recursive header files inclusion detected in IntegerComputer.h
35#define IntegerComputer_RECURSES
37#if !defined IntegerComputer_h
39#define IntegerComputer_h
44#include "DGtal/base/Common.h"
45#include "DGtal/kernel/NumberTraits.h"
46#include "DGtal/kernel/CUnsignedNumber.h"
47#include "DGtal/kernel/CIntegralNumber.h"
48#include "DGtal/kernel/CInteger.h"
49#include "DGtal/kernel/SpaceND.h"
81 template <
typename TInteger>
317 template <
typename OutputIterator>
332 unsigned int k )
const;
455 bool compute_v =
true )
const;
552 template <
typename TInteger>
561#include "DGtal/arithmetic/IntegerComputer.ih"
568#undef IntegerComputer_RECURSES
Aim: This class gathers several types and methods to make computation with integers.
Integer getCFrac(std::vector< Integer > "ients, IntegerParamType a, IntegerParamType b) const
SpaceND< 3, Integer >::Vector Vector3I
void reduce(Vector3I &p) const
static Integer staticGcd(IntegerParamType a, IntegerParamType b)
void getGcd(Integer &g, IntegerParamType a, IntegerParamType b) const
static Integer max(IntegerParamType a, IntegerParamType b, IntegerParamType c)
NumberTraits< TInteger >::SignedVersion Integer
Integer crossProduct(const Vector2I &u, const Vector2I &v) const
static bool isPositiveOrZero(IntegerParamType a)
Integer getCFrac(OutputIterator outIt, IntegerParamType a, IntegerParamType b) const
IntegerComputer< TInteger > Self
Integer _m_a
Used to store parameter a.
static bool isZero(IntegerParamType a)
static Integer min(IntegerParamType a, IntegerParamType b, IntegerParamType c)
Integer _m_a1
Used to for successive computation in gcd.
Integer _m_c2
Used to represent scalar products.
static Integer abs(IntegerParamType a)
std::vector< Integer > _m_bezout[4]
Integer _m_a0
Used to for successive computation in gcd.
Integer ceilDiv(IntegerParamType na, IntegerParamType nb) const
NumberTraits< TInteger >::UnsignedVersion UnsignedInteger
Integer _m_b
Used to store parameter b.
void reduce(Vector2I &p) const
SpaceND< 2, Integer >::Vector Vector2I
static bool isNegativeOrZero(IntegerParamType a)
Integer dotProduct(const Vector2I &u, const Vector2I &v) const
Integer _m_q
Used to represent a quotient.
SpaceND< 2, Integer >::Point Point2I
static bool isNotZero(IntegerParamType a)
Vector2I _m_v1
Used to represent vectors.
BOOST_CONCEPT_ASSERT((concepts::CInteger< Integer >))
void getDotProduct(Integer &dp, const Vector2I &u, const Vector2I &v) const
Point2I convergent(const std::vector< Integer > "ients, unsigned int k) const
Vector2I extendedEuclid(IntegerParamType a, IntegerParamType b, IntegerParamType c) const
void getCrossProduct(Integer &cp, const Vector2I &u, const Vector2I &v) const
static Integer min(IntegerParamType a, IntegerParamType b)
Integer _m_c1
Used to represent scalar products.
void getCoefficientIntersection(Integer &fl, Integer &ce, const Vector2I &p, const Vector2I &u, const Vector2I &N, IntegerParamType c) const
Vector2I _m_v
Used to represent the Bezout vector.
void selfDisplay(std::ostream &out) const
NumberTraits< UnsignedInteger >::ParamType UnsignedIntegerParamType
NumberTraits< Integer >::ParamType IntegerParamType
Vector2I _m_v0
Used to represent vectors.
void getDotProduct(Integer &dp, const Vector3I &u, const Vector3I &v) const
void getValidBezout(Vector2I &v, const Point2I &A, const Vector2I &u, const Vector2I &N, IntegerParamType c, const Vector2I &N2, IntegerParamType c2, bool compute_v=true) const
static bool isPositive(IntegerParamType a)
void getFloorCeilDiv(Integer &fl, Integer &ce, IntegerParamType na, IntegerParamType nb) const
Integer _m_c0
Used to represent scalar products.
IntegerComputer(const Self &other)
void getEuclideanDiv(Integer &q, Integer &r, IntegerParamType a, IntegerParamType b) const
static bool isNegative(IntegerParamType a)
Integer _m_r
Used to represent a remainder.
BOOST_CONCEPT_ASSERT((concepts::CIntegralNumber< UnsignedInteger >))
Integer dotProduct(const Vector3I &u, const Vector3I &v) const
Integer gcd(IntegerParamType a, IntegerParamType b) const
SpaceND< 3, Integer >::Point Point3I
static Integer max(IntegerParamType a, IntegerParamType b)
Integer floorDiv(IntegerParamType na, IntegerParamType nb) const
BOOST_CONCEPT_ASSERT((concepts::CUnsignedNumber< UnsignedInteger >))
Self & operator=(const Self &other)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
std::decay< T >::type UnsignedVersion
Alias to the unsigned version of the number type.
std::decay< T >::type SignedVersion
Alias to the signed version of the number type.
boost::call_traits< std::decay< T >::type >::param_type ParamType
Defines a type that represents the "best" way to pass a parameter of type T to a function.
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Aim: Concept checking for Integral Numbers. Models of this concept should be listed in NumberTraits c...
Aim: Concept checking for Unsigned numbers. Models of this concept should be listed in NumberTraits c...