33 #include "DGtal/base/Common.h"
34 #include "DGtal/kernel/CPointPredicate.h"
35 #include "DGtal/arithmetic/IntegerComputer.h"
36 #include "DGtal/arithmetic/SternBrocot.h"
37 #include "DGtal/arithmetic/Pattern.h"
38 #include "DGtal/arithmetic/StandardDSLQ0.h"
42 using namespace DGtal;
48 template <
typename DSL>
55 DSL S = D.smartDSS( A, B );
63 template <
typename Fraction>
76 clock_t timeBegin, timeEnd;
79 for (
unsigned int i = 0; i < nbtries; ++i )
83 if ( ic.
gcd( a, b ) == 1 )
85 for (
Integer mu = 0; mu < 5; ++mu )
87 DSL D( a, b, rand() % (moda+modb) );
88 for (
Integer x = 0; x < 10; ++x )
91 Integer x2 = x1 + 1 + ( rand() % modx );
92 Point A = D.lowestY( x1 );
93 Point B = D.lowestY( x2 );
94 checkSubStandardDSLQ0<DSL>( D, A, B );
102 CPUTime = ((double)timeEnd-(
double)timeBegin)/((
double)CLOCKS_PER_SEC);
106 std::cout << modx <<
" " << (
long double) CPUTime/(nbtries*5*10) << std::endl;
115 int main(
int argc,
char** argv)
118 typedef SB::Fraction Fraction;
120 unsigned int nbtries = ( argc > 1 ) ? atoi( argv[ 1 ] ) : 10000;
131 for(
Integer modx = 10; modx < modb/2;modx*=2)
133 testSubStandardDSLQ0<Fraction>( nbtries, moda, modb, modx );
Integer gcd(IntegerParamType a, IntegerParamType b) const
Aim: Represents a digital straight line with slope in the first quadrant (Q0: x >= 0,...
Aim: The Stern-Brocot tree is the tree of irreducible fractions. This class allows to construct it pr...
Point::Coordinate Integer
DGtal is the top-level namespace which contains all DGtal functions and types.
bool checkSubStandardDSLQ0(const DSL &D, const typename DSL::Point &A, const typename DSL::Point &B)
int main(int argc, char **argv)
bool testSubStandardDSLQ0(unsigned int nbtries, typename Fraction::Integer moda, typename Fraction::Integer modb, typename Fraction::Integer modx)