File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/config/TeX-MML-AM_CHTML/MathJax.js
DGtal 2.0.0
testInHalfPlane-benchmark.cpp File Reference
#include <iostream>
#include <cstdlib>
#include <ctime>
#include "DGtal/base/Common.h"
#include "DGtal/kernel/PointVector.h"
#include "DGtal/geometry/tools/determinant/C2x2DetComputer.h"
#include "DGtal/geometry/tools/determinant/Simple2x2DetComputer.h"
#include "DGtal/geometry/tools/determinant/SimpleIncremental2x2DetComputer.h"
#include "DGtal/geometry/tools/determinant/AvnaimEtAl2x2DetSignComputer.h"
#include "DGtal/geometry/tools/determinant/Filtered2x2DetComputer.h"
#include "DGtal/geometry/tools/determinant/COrientationFunctor2.h"
#include "DGtal/geometry/tools/determinant/InHalfPlaneBy2x2DetComputer.h"
#include "DGtal/geometry/tools/determinant/InHalfPlaneBySimple3x3Matrix.h"
Include dependency graph for testInHalfPlane-benchmark.cpp:

Go to the source code of this file.

Functions

DGtal::int32_t randomInt15 ()
DGtal::int32_t randomInt26 ()
DGtal::int32_t randomInt30 ()
DGtal::int64_t randomInt52 ()
double randomDouble52 ()
DGtal::int64_t randomInt62 ()
DGtal::BigInteger randomBigInt62 ()
DGtal::int32_t signedRandomInt15 ()
DGtal::int32_t signedRandomInt26 ()
DGtal::int32_t signedRandomInt30 ()
DGtal::int64_t signedRandomInt52 ()
double signedRandomDouble52 ()
DGtal::int64_t signedRandomInt62 ()
DGtal::BigInteger signedRandomBigInt62 ()
template<typename OrientationFunctor, typename RandomFunctor>
bool randomTest (OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
template<typename OrientationFunctor, typename RandomFunctor>
bool nullSameVectorsTest (OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
template<typename OrientationFunctor, typename RandomFunctor>
bool nullZeroVectorTest (OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
template<typename OrientationFunctor, typename RandomFunctor>
bool nullTest (OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
template<typename OrientationFunctor, typename RandomFunctor>
bool quasiNullTest (OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
template<typename OrientationFunctor>
bool incTest (OrientationFunctor f, const DGtal::int32_t n=1000000)
bool incTestComparison ()
bool randomTest30All ()
bool randomTest52All ()
bool randomTest62All ()
int main (int argc, char **argv)

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Tristan Roussillon (trist.nosp@m.an.r.nosp@m.oussi.nosp@m.llon.nosp@m.@liri.nosp@m.s.cn.nosp@m.rs.fr ) Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2013/11/22

This file is part of the DGtal library.

Definition in file testInHalfPlane-benchmark.cpp.

Function Documentation

◆ incTest()

template<typename OrientationFunctor>
bool incTest ( OrientationFunctor f,
const DGtal::int32_t n = 1000000 )

Function that traces to the standard output the running time of a given orientation functor f for n computations. The orientation functor is initialized with 2 points given once for all. We then compute the orientation of a random sequence of adjacent points with respect to these two points.

Parameters
fa functor to run
nnumber of tries
Template Parameters
OrientationFunctora model of COrientationFunctor2

Definition at line 454 of file testInHalfPlane-benchmark.cpp.

455{
457
458 typedef typename OrientationFunctor::Point Point;
459 Point P, Q, R;
460
461 typedef typename Point::Coordinate Coordinate;
462 Coordinate dx, dy;
463
464 Coordinate max = 1073741824;
465 P = Point(0,0);
466 Q = Point(max, max);
467 R = Point(max/2, max/2);
468 f.init(P, Q);
469
470 clock_t timeBegin, timeEnd;
471 timeBegin = clock();
472
473 for (DGtal::int32_t i = 0; (i < n); ++i)
474 {
475 dx = (rand() % 3) - 1;
476 dy = (rand() % 3) - 1;
477 R[0] += dx;
478 ASSERT( R[0] >= -max );
479 ASSERT( R[0] < max );
480 R[1] += dy;
481 ASSERT( R[0] >= -max );
482 ASSERT( R[0] < max );
483 f( R );
484 }
485
486 timeEnd = clock();
487 long double time, CPUTime;
488 time = ((double)timeEnd-(double)timeBegin);
489 CPUTime = time/((double)CLOCKS_PER_SEC);
490 std::cout << CPUTime << " ";
491
492 return true;
493}
std::int32_t int32_t
signed 32-bit integer.
Definition BasicTypes.h:71
Aim: This concept is a refinement of COrientationFunctor, useful for simple algebraic curves that can...
int max(int a, int b)
MyPointD Point

References max().

Referenced by incTestComparison().

◆ incTestComparison()

bool incTestComparison ( )

Function that traces to the standard output the running time of all available functors for random points whose coordinates are within [-2^30 ; 2^30[.

Definition at line 500 of file testInHalfPlane-benchmark.cpp.

501{
503
504 long seed = time(NULL);
505
506 std::cout << "# incremental input " << std::endl;
507 std::cout << "# running times in s. for 1 million tries" << std::endl;
508
509 {
510 srand(seed);
511 std::cout << "2x2-int32-int64 ";
514 incTest( F() );
515 std::cout << std::endl;
516 }
517 {
518 srand(seed);
519 std::cout << "2x2-inc-int32-int64 ";
522 incTest( F() );
523 std::cout << std::endl;
524 }
525 {
526 srand(seed);
527 std::cout << "2x2-avnaim++-int32-double ";
528 typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
529 typedef Filtered2x2DetComputer<DetComputer> FDetComputer;
531 incTest( F() );
532 std::cout << std::endl;
533 }
534 {
535 srand(seed);
536 std::cout << "2x2-int32-BigInt ";
539 incTest( F() );
540 std::cout << std::endl;
541 }
542 {
543 srand(seed);
544 std::cout << "2x2-inc-int32-BigInt ";
547 incTest( F() );
548 std::cout << std::endl;
549 }
550 return true;
551}
Aim: Class that provides a way of computing the sign of the determinant of a 2x2 matrix from its four...
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: 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...
srand(0)
bool incTest(OrientationFunctor f, const DGtal::int32_t n=1000000)

References incTest(), and srand().

Referenced by main().

◆ main()

int main ( int argc,
char ** argv )

Definition at line 889 of file testInHalfPlane-benchmark.cpp.

890{
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;
896
901
902 bool res = true;
903 trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
904 trace.endBlock();
905 return res ? 0 : 1;
906}
Trace trace
bool randomTest30All()
bool incTestComparison()
bool randomTest62All()
bool randomTest52All()

References incTestComparison(), randomTest30All(), randomTest52All(), randomTest62All(), and DGtal::trace.

◆ nullSameVectorsTest()

template<typename OrientationFunctor, typename RandomFunctor>
bool nullSameVectorsTest ( OrientationFunctor f,
RandomFunctor gen,
const DGtal::int32_t n = 1000000 )

Function that traces to the standard output the running time of a given orientation functor f for n computations for three points P, Q, R such that Q = R. The coordinates of P and Q are randomly chosen by gen.

Parameters
fa functor to run
gena generator providing random numbers
nnumber of tries
Template Parameters
OrientationFunctora model of COrientationFunctor2

Definition at line 269 of file testInHalfPlane-benchmark.cpp.

270{
272
273 typedef typename OrientationFunctor::Point Point;
274 Point P, Q;
275
276 clock_t timeBegin, timeEnd;
277 timeBegin = clock();
278
279 for (DGtal::int32_t i = 0; (i < n); ++i)
280 {
281 P[0] = gen();
282 P[1] = gen();
283 Q[0] = gen();
284 Q[1] = gen();
285 f.init(P, Q);
286 f( Q );
287 }
288
289 timeEnd = clock();
290 long double time, CPUTime;
291 time = ((double)timeEnd-(double)timeBegin);
292 CPUTime = time/((double)CLOCKS_PER_SEC);
293 std::cout << CPUTime << " ";
294
295 return true;
296}

Referenced by randomTest30All(), randomTest52All(), and randomTest62All().

◆ nullTest()

template<typename OrientationFunctor, typename RandomFunctor>
bool nullTest ( OrientationFunctor f,
RandomFunctor gen,
const DGtal::int32_t n = 1000000 )

Function that traces to the standard output the running time of a given orientation functor f for n computations for three collinear points P, Q, R such that Q-P = ku and R-P = lu. P is set to (0,0), the components of u, k and l are randomly chosen by gen.

Parameters
fa functor to run
gena generator providing random numbers
nnumber of tries
Template Parameters
OrientationFunctora model of COrientationFunctor2

Definition at line 350 of file testInHalfPlane-benchmark.cpp.

351{
353
354 typedef typename OrientationFunctor::Point Point;
355 Point P, Q, R;
356 P = Point(0,0);
357
358 typedef typename Point::Coordinate Coordinate;
359 Coordinate k, l, u0, u1;
360
361 clock_t timeBegin, timeEnd;
362 timeBegin = clock();
363
364 for (DGtal::int32_t i = 0; (i < n); ++i)
365 {
366 k = gen();
367 l = gen();
368 u0 = gen();
369 u1 = gen();
370 Q[0] = k*u0;
371 Q[1] = k*u1;
372 R[0] = l*u0;
373 R[1] = l*u1;
374 f.init(P, Q);
375 f( R );
376 }
377
378 timeEnd = clock();
379 long double time, CPUTime;
380 time = ((double)timeEnd-(double)timeBegin);
381 CPUTime = time/((double)CLOCKS_PER_SEC);
382 std::cout << CPUTime << " ";
383
384 return true;
385}

Referenced by randomTest30All(), randomTest52All(), and randomTest62All().

◆ nullZeroVectorTest()

template<typename OrientationFunctor, typename RandomFunctor>
bool nullZeroVectorTest ( OrientationFunctor f,
RandomFunctor gen,
const DGtal::int32_t n = 1000000 )

Function that traces to the standard output the running time of a given orientation functor f for n computations for three points P, Q, R such that R = P. The coordinates of P and R are randomly chosen by gen.

Parameters
fa functor to run
gena generator providing random numbers
nnumber of tries
Template Parameters
OrientationFunctora model of COrientationFunctor2

Definition at line 309 of file testInHalfPlane-benchmark.cpp.

310{
312
313 typedef typename OrientationFunctor::Point Point;
314 Point P, Q;
315
316 clock_t timeBegin, timeEnd;
317 timeBegin = clock();
318
319 for (DGtal::int32_t i = 0; (i < n); ++i)
320 {
321 P[0] = gen();
322 P[1] = gen();
323 Q[0] = gen();
324 Q[1] = gen();
325 f.init(P, Q);
326 f( P );
327 }
328
329 timeEnd = clock();
330 long double time, CPUTime;
331 time = ((double)timeEnd-(double)timeBegin);
332 CPUTime = time/((double)CLOCKS_PER_SEC);
333 std::cout << CPUTime << " ";
334
335 return true;
336}

Referenced by randomTest30All(), randomTest52All(), and randomTest62All().

◆ quasiNullTest()

template<typename OrientationFunctor, typename RandomFunctor>
bool quasiNullTest ( OrientationFunctor f,
RandomFunctor gen,
const DGtal::int32_t n = 1000000 )

Function that traces to the standard output the running time of a given orientation functor f for n computations for three quasi-collinear points P, Q, R defined such that Q-P = ku + epsilon and R-P = lu + epsilon where espilon is a random integer between -2 and 2.
P is set to (0,0), the components of u, k and l are randomly chosen by gen.

Parameters
fa functor to run
gena generator providing random numbers
nnumber of tries
Template Parameters
OrientationFunctora model of COrientationFunctor2

Definition at line 400 of file testInHalfPlane-benchmark.cpp.

401{
403
404 typedef typename OrientationFunctor::Point Point;
405 Point P, Q, R;
406 P = Point(0,0);
407
408 typedef typename Point::Coordinate Coordinate;
409 Coordinate k, l, u0, u1;
410
411 clock_t timeBegin, timeEnd;
412 timeBegin = clock();
413
414 for (DGtal::int32_t i = 0; (i < n); ++i)
415 {
416 k = gen();
417 l = gen();
418 u0 = gen();
419 u1 = gen();
420 Q[0] = k*u0;
421 Q[0] += (rand()%5)-2;
422 Q[1] = k*u1;
423 Q[1] += (rand()%5)-2;
424 R[0] = l*u0;
425 R[0] += (rand()%5)-2;
426 R[1] = l*u1;
427 R[1] += (rand()%5)-2;
428 f.init(P, Q);
429 f( R );
430 }
431
432 timeEnd = clock();
433 long double time, CPUTime;
434 time = ((double)timeEnd-(double)timeBegin);
435 CPUTime = time/((double)CLOCKS_PER_SEC);
436 std::cout << CPUTime << " ";
437
438 return true;
439}

Referenced by randomTest30All(), randomTest52All(), and randomTest62All().

◆ randomBigInt62()

DGtal::BigInteger randomBigInt62 ( )
Returns
a random integer of type DGtal::BigInteger lying in the range [0 ; 2^62[

Definition at line 131 of file testInHalfPlane-benchmark.cpp.

132{
133 return
134 static_cast<DGtal::BigInteger>(rand() % 4) +
135 ( static_cast<DGtal::BigInteger>(randomInt30()) +
136 ( static_cast<DGtal::BigInteger>(randomInt30()) )
137 * 1073741824 )
138 * 4;
139}
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<>, boost::multiprecision::et_off > BigInteger
Definition BasicTypes.h:75
DGtal::int32_t randomInt30()

References randomInt30().

Referenced by signedRandomBigInt62().

◆ randomDouble52()

double randomDouble52 ( )
Returns
a random integer of type double lying in the range [0 ; 2^52[

Definition at line 102 of file testInHalfPlane-benchmark.cpp.

103{
104 return
105 static_cast<double>(rand() % 128) +
106 ( static_cast<double>(randomInt15()) +
107 ( static_cast<double>(randomInt30()) )
108 * 32768 )
109 * 128;
110}
DGtal::int32_t randomInt15()

References randomInt15(), and randomInt30().

Referenced by signedRandomDouble52().

◆ randomInt15()

DGtal::int32_t randomInt15 ( )
Returns
a random integer of type DGtal::int32_t lying in the range [0 ; 2^15[

Definition at line 59 of file testInHalfPlane-benchmark.cpp.

60{
61 return static_cast<DGtal::int32_t>(rand() % 32768);
62}

Referenced by randomDouble52(), randomInt26(), randomInt30(), randomInt52(), and signedRandomInt15().

◆ randomInt26()

DGtal::int32_t randomInt26 ( )
Returns
a random integer of type DGtal::int32_t lying in the range [0 ; 2^26[

Definition at line 68 of file testInHalfPlane-benchmark.cpp.

69{
70 return static_cast<DGtal::int32_t>(rand() % 2048) +
71 ( randomInt15() * 2048 );
72}

References randomInt15().

Referenced by signedRandomInt26().

◆ randomInt30()

DGtal::int32_t randomInt30 ( )
Returns
a random integer of type DGtal::int32_t lying in the range [0 ; 2^30[

Definition at line 78 of file testInHalfPlane-benchmark.cpp.

79{
80 return randomInt15() +
81 ( randomInt15() * 32768 );
82}

References randomInt15().

Referenced by randomBigInt62(), randomDouble52(), randomInt52(), randomInt62(), and signedRandomInt30().

◆ randomInt52()

DGtal::int64_t randomInt52 ( )
Returns
a random integer of type DGtal::int64_t lying in the range [0 ; 2^52[

Definition at line 88 of file testInHalfPlane-benchmark.cpp.

89{
90 return
91 static_cast<DGtal::int64_t>(rand() % 128) +
92 ( static_cast<DGtal::int64_t>(randomInt15()) +
93 ( static_cast<DGtal::int64_t>(randomInt30()) )
94 * 32768 )
95 * 128;
96}
std::int64_t int64_t
signed 94-bit integer.
Definition BasicTypes.h:73

References randomInt15(), and randomInt30().

Referenced by signedRandomInt52().

◆ randomInt62()

DGtal::int64_t randomInt62 ( )
Returns
a random integer of type DGtal::int64_t lying in the range [0 ; 2^62[

Definition at line 116 of file testInHalfPlane-benchmark.cpp.

117{
118 return
119 static_cast<DGtal::int64_t>(rand() % 4) +
120 ( static_cast<DGtal::int64_t>(randomInt30()) +
121 ( static_cast<DGtal::int64_t>(randomInt30()) )
122 * 1073741824 )
123 * 4;
124}

References randomInt30().

Referenced by signedRandomInt62().

◆ randomTest()

template<typename OrientationFunctor, typename RandomFunctor>
bool randomTest ( OrientationFunctor f,
RandomFunctor gen,
const DGtal::int32_t n = 1000000 )

Function that traces to the standard output the running time of a given functor f for n computations over points whose coordinates are randomly chosen by gen.

Parameters
fa functor to run
gena generator providing random numbers
nnumber of tries
Template Parameters
OrientationFunctora model of COrientationFunctor2

Definition at line 227 of file testInHalfPlane-benchmark.cpp.

228{
230
231 typedef typename OrientationFunctor::Point Point;
232 Point P, Q, R;
233
234 clock_t timeBegin, timeEnd;
235 timeBegin = clock();
236
237 for (DGtal::int32_t i = 0; (i < n); ++i)
238 {
239 P[0] = gen();
240 P[1] = gen();
241 Q[0] = gen();
242 Q[1] = gen();
243 f.init(P, Q);
244 R[0] = gen();
245 R[1] = gen();
246 f( R );
247 }
248
249 timeEnd = clock();
250 long double time, CPUTime;
251 time = ((double)timeEnd-(double)timeBegin);
252 CPUTime = time/((double)CLOCKS_PER_SEC);
253 std::cout << CPUTime << " ";
254
255 return true;
256}

Referenced by randomTest30All(), randomTest52All(), and randomTest62All().

◆ randomTest30All()

bool randomTest30All ( )

Function that traces to the standard output the running time of all available functors for random points whose coordinates are within [-2^30 ; 2^30[.

Definition at line 558 of file testInHalfPlane-benchmark.cpp.

559{
561
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;
566
567 long seed = time(NULL);
568
569 {
570 srand(seed);
571 std::cout << "3x3-int32-int64 ";
578 std::cout << std::endl;
579 }
580 {
581 srand(seed);
582 std::cout << "3x3-int32-BigInt ";
589 std::cout << std::endl;
590}
591 {
592 srand(seed);
593 std::cout << "2x2-int32-int64 ";
601 std::cout << std::endl;
602 }
603 {
604 srand(seed);
605 std::cout << "2x2-int32-BigInt ";
613 std::cout << std::endl;
614 }
615 {
616 srand(seed);
617 std::cout << "2x2-inc-int32-int64 ";
625 std::cout << std::endl;
626 }
627 {
628 srand(seed);
629 std::cout << "2x2-inc-int32-BigInt ";
637 std::cout << std::endl;
638 }
639 {
640 srand(seed);
641 std::cout << "2x2-avnaim-int32-int32 ";
649 std::cout << std::endl;
650 }
651 {
652 srand(seed);
653 std::cout << "2x2-avnaim-int32-double ";
654 typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
661 std::cout << std::endl;
662 }
663 {
664 srand(seed);
665 std::cout << "2x2-avnaim++-int32-double ";
666 typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
667 typedef Filtered2x2DetComputer<DetComputer> FDetComputer;
674 std::cout << std::endl;
675 }
676
677 return true;
678}
Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation o...
bool nullZeroVectorTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
DGtal::int32_t signedRandomInt30()
DGtal::int32_t signedRandomInt15()
bool randomTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
bool quasiNullTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
bool nullSameVectorsTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)
bool nullTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n=1000000)

References nullSameVectorsTest(), nullTest(), nullZeroVectorTest(), quasiNullTest(), randomTest(), signedRandomInt15(), signedRandomInt30(), and srand().

Referenced by main().

◆ randomTest52All()

bool randomTest52All ( )

Function that traces to the standard output the running time of all available functors for random points whose coordinates are within [-2^52 ; 2^52[.

BigInt cannot be constructed from a DGtal::int64_t

Definition at line 685 of file testInHalfPlane-benchmark.cpp.

686{
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;
691
692 long seed = time(NULL);
693
694 {
695 srand(seed);
696 std::cout << "3x3-double-BigInt ";
704 std::cout << std::endl;
705 }
706 {
707 srand(seed);
708 std::cout << "2x2-double-BigInt ";
717 std::cout << std::endl;
718 }
719 {
720 srand(seed);
721 std::cout << "2x2-avnaim-int64-int64 ";
730 std::cout << std::endl;
731 }
732 {
733 srand(seed);
734 std::cout << "2x2-avnaim-double-int64 ";
743 std::cout << std::endl;
744 }
745 {
746 srand(seed);
747 std::cout << "2x2-avnaim-int64-double ";
749 typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
756 std::cout << std::endl;
757 }
758 {
759 srand(seed);
760 std::cout << "2x2-avnaim-double-double ";
762 typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
769 std::cout << std::endl;
770 }
771 {
772 srand(seed);
773 std::cout << "2x2-avnaim++-int64-double ";
775 typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
776 typedef Filtered2x2DetComputer<DetComputer> FDetComputer;
783 std::cout << std::endl;
784 }
785 {
786 srand(seed);
787 std::cout << "2x2-avnaim++-double-double ";
789 typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
790 typedef Filtered2x2DetComputer<DetComputer> FDetComputer;
797 std::cout << std::endl;
798 }
799
800 return true;
801}
DGtal::int64_t signedRandomInt52()
double signedRandomDouble52()
DGtal::int32_t signedRandomInt26()

References nullSameVectorsTest(), nullTest(), nullZeroVectorTest(), quasiNullTest(), randomTest(), signedRandomDouble52(), signedRandomInt26(), signedRandomInt52(), and srand().

Referenced by main().

◆ randomTest62All()

bool randomTest62All ( )

Function that traces to the standard output the running time of all available functors for random points whose coordinates are within [-2^62 ; 2^62[.

BigInt cannot be constructed from a DGtal::int64_t

Definition at line 808 of file testInHalfPlane-benchmark.cpp.

809{
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;
814
815 long seed = time(NULL);
816
817 {
818 srand(seed);
819 std::cout << "3x3-BigInt-BigInt ";
827 std::cout << std::endl;
828 }
829 {
830 srand(seed);
831 std::cout << "2x2-BigInt-BigInt ";
840 std::cout << std::endl;
841 }
842 {
843 srand(seed);
844 std::cout << "2x2-inc-BigInt-BigInt ";
853 std::cout << std::endl;
854 }
855 {
856 srand(seed);
857 std::cout << "2x2-avnaim-int64-int64 ";
866 std::cout << std::endl;
867 }
868 {
869 srand(seed);
870 std::cout << "2x2-avnaim++-int64-longdouble ";
873 typedef Filtered2x2DetComputer<DetComputer> FDetComputer;
880 std::cout << std::endl;
881 }
882
883 return true;
884}
DGtal::BigInteger signedRandomBigInt62()
DGtal::int64_t signedRandomInt62()

References nullSameVectorsTest(), nullTest(), nullZeroVectorTest(), quasiNullTest(), randomTest(), signedRandomBigInt62(), signedRandomInt30(), signedRandomInt62(), and srand().

Referenced by main().

◆ signedRandomBigInt62()

DGtal::BigInteger signedRandomBigInt62 ( )
Returns
a random (signed) integer of type DGtal::BigInteger lying in the range [-2^62 ; 2^62[

Definition at line 205 of file testInHalfPlane-benchmark.cpp.

206{
208 if (rand() % 2)
209 return x;
210 else
211 return -x;
212}
DGtal::BigInteger randomBigInt62()

References randomBigInt62().

Referenced by randomTest62All().

◆ signedRandomDouble52()

double signedRandomDouble52 ( )
Returns
a random (signed) integer of type double lying in the range [-2^52 ; 2^52[

Definition at line 185 of file testInHalfPlane-benchmark.cpp.

186{
187 double x = randomDouble52();
188 return ((rand() % 2) ? x : -x);
189}
double randomDouble52()

References randomDouble52().

Referenced by randomTest52All().

◆ signedRandomInt15()

DGtal::int32_t signedRandomInt15 ( )
Returns
a random (signed) integer of type DGtal::int32_t lying in the range [-2^15 ; 2^15[

Definition at line 145 of file testInHalfPlane-benchmark.cpp.

146{
148 return ((rand() % 2) ? x : -x);
149}

References randomInt15().

Referenced by randomTest30All().

◆ signedRandomInt26()

DGtal::int32_t signedRandomInt26 ( )
Returns
a random (signed) integer of type DGtal::int32_t lying in the range [-2^26 ; 2^26[

Definition at line 155 of file testInHalfPlane-benchmark.cpp.

156{
158 return ((rand() % 2) ? x : -x);
159}
DGtal::int32_t randomInt26()

References randomInt26().

Referenced by randomTest52All().

◆ signedRandomInt30()

DGtal::int32_t signedRandomInt30 ( )
Returns
a random (signed) integer of type DGtal::int32_t lying in the range [-2^30 ; 2^30[

Definition at line 165 of file testInHalfPlane-benchmark.cpp.

166{
168 return ((rand() % 2) ? x : -x);
169}

References randomInt30().

Referenced by randomTest30All(), and randomTest62All().

◆ signedRandomInt52()

DGtal::int64_t signedRandomInt52 ( )
Returns
a random (signed) integer of type DGtal::int64_t lying in the range [-2^52 ; 2^52[

Definition at line 175 of file testInHalfPlane-benchmark.cpp.

176{
178 return ((rand() % 2) ? x : -x);
179}
DGtal::int64_t randomInt52()

References randomInt52().

Referenced by randomTest52All().

◆ signedRandomInt62()

DGtal::int64_t signedRandomInt62 ( )
Returns
a random (signed) integer of type DGtal::int64_t lying in the range [-2^62 ; 2^62[

Definition at line 195 of file testInHalfPlane-benchmark.cpp.

196{
198 return ((rand() % 2) ? x : -x);
199}
DGtal::int64_t randomInt62()

References randomInt62().

Referenced by randomTest62All().