33#include "DGtal/base/Common.h"
35#include "DGtal/kernel/PointVector.h"
37#include "DGtal/geometry/tools/determinant/C2x2DetComputer.h"
38#include "DGtal/geometry/tools/determinant/Simple2x2DetComputer.h"
39#include "DGtal/geometry/tools/determinant/SimpleIncremental2x2DetComputer.h"
40#include "DGtal/geometry/tools/determinant/AvnaimEtAl2x2DetSignComputer.h"
41#include "DGtal/geometry/tools/determinant/Filtered2x2DetComputer.h"
43#include "DGtal/geometry/tools/determinant/COrientationFunctor2.h"
44#include "DGtal/geometry/tools/determinant/InHalfPlaneBy2x2DetComputer.h"
45#include "DGtal/geometry/tools/determinant/InHalfPlaneBySimple3x3Matrix.h"
105 static_cast<double>(rand() % 128) +
148 return ((rand() % 2) ? x : -x);
158 return ((rand() % 2) ? x : -x);
168 return ((rand() % 2) ? x : -x);
178 return ((rand() % 2) ? x : -x);
188 return ((rand() % 2) ? x : -x);
198 return ((rand() % 2) ? x : -x);
226template<
typename OrientationFunctor,
typename RandomFunctor>
231 typedef typename OrientationFunctor::Point
Point;
234 clock_t timeBegin, timeEnd;
250 long double time, CPUTime;
251 time = ((double)timeEnd-(double)timeBegin);
252 CPUTime = time/((double)CLOCKS_PER_SEC);
253 std::cout << CPUTime <<
" ";
268template<
typename OrientationFunctor,
typename RandomFunctor>
273 typedef typename OrientationFunctor::Point
Point;
276 clock_t timeBegin, timeEnd;
290 long double time, CPUTime;
291 time = ((double)timeEnd-(double)timeBegin);
292 CPUTime = time/((double)CLOCKS_PER_SEC);
293 std::cout << CPUTime <<
" ";
308template<
typename OrientationFunctor,
typename RandomFunctor>
313 typedef typename OrientationFunctor::Point
Point;
316 clock_t timeBegin, timeEnd;
330 long double time, CPUTime;
331 time = ((double)timeEnd-(double)timeBegin);
332 CPUTime = time/((double)CLOCKS_PER_SEC);
333 std::cout << CPUTime <<
" ";
349template<
typename OrientationFunctor,
typename RandomFunctor>
354 typedef typename OrientationFunctor::Point
Point;
358 typedef typename Point::Coordinate
Coordinate;
361 clock_t timeBegin, timeEnd;
379 long double time, CPUTime;
380 time = ((double)timeEnd-(double)timeBegin);
381 CPUTime = time/((double)CLOCKS_PER_SEC);
382 std::cout << CPUTime <<
" ";
399template<
typename OrientationFunctor,
typename RandomFunctor>
404 typedef typename OrientationFunctor::Point
Point;
408 typedef typename Point::Coordinate
Coordinate;
411 clock_t timeBegin, timeEnd;
421 Q[0] += (rand()%5)-2;
423 Q[1] += (rand()%5)-2;
425 R[0] += (rand()%5)-2;
427 R[1] += (rand()%5)-2;
433 long double time, CPUTime;
434 time = ((double)timeEnd-(double)timeBegin);
435 CPUTime = time/((double)CLOCKS_PER_SEC);
436 std::cout << CPUTime <<
" ";
453template<
typename OrientationFunctor>
458 typedef typename OrientationFunctor::Point
Point;
461 typedef typename Point::Coordinate
Coordinate;
470 clock_t timeBegin, timeEnd;
475 dx = (rand() % 3) - 1;
476 dy = (rand() % 3) - 1;
478 ASSERT( R[0] >= -
max );
479 ASSERT( R[0] <
max );
481 ASSERT( R[0] >= -
max );
482 ASSERT( R[0] <
max );
487 long double time, CPUTime;
488 time = ((double)timeEnd-(double)timeBegin);
489 CPUTime = time/((double)CLOCKS_PER_SEC);
490 std::cout << CPUTime <<
" ";
504 long seed = time(NULL);
506 std::cout <<
"# incremental input " << std::endl;
507 std::cout <<
"# running times in s. for 1 million tries" << std::endl;
511 std::cout <<
"2x2-int32-int64 ";
515 std::cout << std::endl;
519 std::cout <<
"2x2-inc-int32-int64 ";
523 std::cout << std::endl;
527 std::cout <<
"2x2-avnaim++-int32-double ";
532 std::cout << std::endl;
536 std::cout <<
"2x2-int32-BigInt ";
540 std::cout << std::endl;
544 std::cout <<
"2x2-inc-int32-BigInt ";
548 std::cout << std::endl;
562 std::cout <<
"# random integers within [-2^30 ; 2^30[" << std::endl;
563 std::cout <<
"# running times in s. for 1 million tries" << std::endl;
564 std::cout <<
"# columns: random, null1, null2, null3, quasi-null " << std::endl;
565 std::cout <<
"# NB. double has " << std::numeric_limits<double>::digits <<
" bits in the mantissa " << std::endl;
567 long seed = time(NULL);
571 std::cout <<
"3x3-int32-int64 ";
578 std::cout << std::endl;
582 std::cout <<
"3x3-int32-BigInt ";
589 std::cout << std::endl;
593 std::cout <<
"2x2-int32-int64 ";
601 std::cout << std::endl;
605 std::cout <<
"2x2-int32-BigInt ";
613 std::cout << std::endl;
617 std::cout <<
"2x2-inc-int32-int64 ";
625 std::cout << std::endl;
629 std::cout <<
"2x2-inc-int32-BigInt ";
637 std::cout << std::endl;
641 std::cout <<
"2x2-avnaim-int32-int32 ";
649 std::cout << std::endl;
653 std::cout <<
"2x2-avnaim-int32-double ";
661 std::cout << std::endl;
665 std::cout <<
"2x2-avnaim++-int32-double ";
674 std::cout << std::endl;
687 std::cout <<
"# random integers within [-2^52 ; 2^52[" << std::endl;
688 std::cout <<
"# running times in s. for 1 million tries" << std::endl;
689 std::cout <<
"# columns: random, null1, null2, null3, quasi-null " << std::endl;
690 std::cout <<
"# NB. double has " << std::numeric_limits<double>::digits <<
" bits in the mantissa " << std::endl;
692 long seed = time(NULL);
696 std::cout <<
"3x3-double-BigInt ";
704 std::cout << std::endl;
708 std::cout <<
"2x2-double-BigInt ";
717 std::cout << std::endl;
721 std::cout <<
"2x2-avnaim-int64-int64 ";
730 std::cout << std::endl;
734 std::cout <<
"2x2-avnaim-double-int64 ";
743 std::cout << std::endl;
747 std::cout <<
"2x2-avnaim-int64-double ";
756 std::cout << std::endl;
760 std::cout <<
"2x2-avnaim-double-double ";
769 std::cout << std::endl;
773 std::cout <<
"2x2-avnaim++-int64-double ";
783 std::cout << std::endl;
787 std::cout <<
"2x2-avnaim++-double-double ";
797 std::cout << std::endl;
810 std::cout <<
"# random integers within [-2^62 ; 2^62[" << std::endl;
811 std::cout <<
"# running times in s. for 1 million tries" << std::endl;
812 std::cout <<
"# columns: random, null1, null2, null3, quasi-null " << std::endl;
813 std::cout <<
"# NB. long double has " << std::numeric_limits<long double>::digits <<
" bits in the mantissa " << std::endl;
815 long seed = time(NULL);
819 std::cout <<
"3x3-BigInt-BigInt ";
827 std::cout << std::endl;
831 std::cout <<
"2x2-BigInt-BigInt ";
840 std::cout << std::endl;
844 std::cout <<
"2x2-inc-BigInt-BigInt ";
853 std::cout << std::endl;
857 std::cout <<
"2x2-avnaim-int64-int64 ";
866 std::cout << std::endl;
870 std::cout <<
"2x2-avnaim++-int64-longdouble ";
880 std::cout << std::endl;
889int main(
int argc,
char** argv )
891 trace.beginBlock (
"Testing class InHalfPlane-benchmark" );
892 trace.info() <<
"Args:";
893 for (
int i = 0; i < argc; ++i )
894 trace.info() <<
" " << argv[ i ];
895 trace.info() << endl;
903 trace.emphase() << ( res ?
"Passed." :
"Error." ) << endl;
889int main(
int argc,
char** argv ) {
…}
Aim: Class that provides a way of computing the sign of the determinant of a 2x2 matrix from its four...
Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation o...
Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation o...
Aim: Implements basic operations that will be used in Point and Vector classes.
Aim: Small class useful to compute the determinant of a 2x2 matrix from its four coefficients,...
Aim: Small class useful to compute, in an incremental way, the determinant of a 2x2 matrix from its f...
DGtal is the top-level namespace which contains all DGtal functions and types.
std::int32_t int32_t
signed 32-bit integer.
std::int64_t int64_t
signed 94-bit integer.
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<>, boost::multiprecision::et_off > BigInteger
Aim: This concept is a refinement of COrientationFunctor, useful for simple algebraic curves that can...
DGtal::int32_t randomInt15()
bool nullZeroVectorTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
DGtal::BigInteger signedRandomBigInt62()
DGtal::int32_t randomInt30()
DGtal::int64_t signedRandomInt52()
DGtal::int32_t randomInt26()
DGtal::int64_t signedRandomInt62()
bool incTest(OrientationFunctor f, const DGtal::int32_t n=1000000)
DGtal::int64_t randomInt52()
DGtal::int32_t signedRandomInt30()
DGtal::int32_t signedRandomInt15()
bool randomTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
double signedRandomDouble52()
bool quasiNullTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
DGtal::int64_t randomInt62()
bool nullSameVectorsTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
DGtal::int32_t signedRandomInt26()
bool nullTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
DGtal::BigInteger randomBigInt62()