DGtal  0.9.2
testInHalfPlane-benchmark.cpp
1 
28 #include <iostream>
30 #include <cstdlib>
31 #include <ctime>
32 
33 #include "DGtal/base/Common.h"
34 
35 #include "DGtal/kernel/PointVector.h"
36 
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"
42 
43 #include "DGtal/geometry/tools/determinant/COrientationFunctor2.h"
44 #include "DGtal/geometry/tools/determinant/InHalfPlaneBy2x2DetComputer.h"
45 #include "DGtal/geometry/tools/determinant/InHalfPlaneBySimple3x3Matrix.h"
47 
48 using namespace std;
49 using namespace DGtal;
50 
51 
53 // Random Functions
55 
59 DGtal::int32_t randomInt15 ()
60 {
61  return static_cast<DGtal::int32_t>(rand() % 32768);
62 }
63 
68 DGtal::int32_t randomInt26 ()
69 {
70  return static_cast<DGtal::int32_t>(rand() % 2048) +
71  ( randomInt15() * 2048 );
72 }
73 
78 DGtal::int32_t randomInt30 ()
79 {
80  return randomInt15() +
81  ( randomInt15() * 32768 );
82 }
83 
88 DGtal::int64_t randomInt52 ()
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 }
97 
102 double randomDouble52 ()
103 {
104  return
105  static_cast<double>(rand() % 128) +
106  ( static_cast<double>(randomInt15()) +
107  ( static_cast<double>(randomInt30()) )
108  * 32768 )
109  * 128;
110 }
111 
116 DGtal::int64_t randomInt62 ()
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 }
125 
126 
127 #ifdef WITH_BIGINTEGER
128 
132 DGtal::BigInteger randomBigInt62 ()
133 {
134  return
135  static_cast<DGtal::BigInteger>(rand() % 4) +
136  ( static_cast<DGtal::BigInteger>(randomInt30()) +
137  ( static_cast<DGtal::BigInteger>(randomInt30()) )
138  * 1073741824 )
139  * 4;
140 }
141 #endif
142 
147 DGtal::int32_t signedRandomInt15 ()
148 {
149  DGtal::int32_t x = randomInt15();
150  return ((rand() % 2) ? x : -x);
151 }
152 
157 DGtal::int32_t signedRandomInt26 ()
158 {
159  DGtal::int32_t x = randomInt26();
160  return ((rand() % 2) ? x : -x);
161 }
162 
167 DGtal::int32_t signedRandomInt30 ()
168 {
169  DGtal::int32_t x = randomInt30();
170  return ((rand() % 2) ? x : -x);
171 }
172 
177 DGtal::int64_t signedRandomInt52 ()
178 {
179  DGtal::int64_t x = randomInt52();
180  return ((rand() % 2) ? x : -x);
181 }
182 
187 double signedRandomDouble52 ()
188 {
189  double x = randomDouble52();
190  return ((rand() % 2) ? x : -x);
191 }
192 
197 DGtal::int64_t signedRandomInt62 ()
198 {
199  DGtal::int64_t x = randomInt62();
200  return ((rand() % 2) ? x : -x);
201 }
202 
203 #ifdef WITH_BIGINTEGER
204 
208 DGtal::BigInteger signedRandomBigInt62 ()
209 {
210  DGtal::BigInteger x = randomBigInt62();
211  if (rand() % 2)
212  return x;
213  else
214  return -x;
215 }
216 #endif
217 
219 // Tests Functions
221 
230 template<typename OrientationFunctor, typename RandomFunctor>
231 bool randomTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n = 1000000)
232 {
233  BOOST_CONCEPT_ASSERT(( COrientationFunctor2<OrientationFunctor> ));
234 
235  typedef typename OrientationFunctor::Point Point;
236  Point P, Q, R;
237 
238  clock_t timeBegin, timeEnd;
239  timeBegin = clock();
240 
241  for (DGtal::int32_t i = 0; (i < n); ++i)
242  {
243  P[0] = gen();
244  P[1] = gen();
245  Q[0] = gen();
246  Q[1] = gen();
247  f.init(P, Q);
248  R[0] = gen();
249  R[1] = gen();
250  f( R );
251  }
252 
253  timeEnd = clock();
254  long double time, CPUTime;
255  time = ((double)timeEnd-(double)timeBegin);
256  CPUTime = time/((double)CLOCKS_PER_SEC);
257  std::cout << CPUTime << " ";
258 
259  return true;
260 }
261 
272 template<typename OrientationFunctor, typename RandomFunctor>
273 bool nullSameVectorsTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n = 1000000)
274 {
275  BOOST_CONCEPT_ASSERT(( COrientationFunctor2<OrientationFunctor> ));
276 
277  typedef typename OrientationFunctor::Point Point;
278  Point P, Q;
279 
280  clock_t timeBegin, timeEnd;
281  timeBegin = clock();
282 
283  for (DGtal::int32_t i = 0; (i < n); ++i)
284  {
285  P[0] = gen();
286  P[1] = gen();
287  Q[0] = gen();
288  Q[1] = gen();
289  f.init(P, Q);
290  f( Q );
291  }
292 
293  timeEnd = clock();
294  long double time, CPUTime;
295  time = ((double)timeEnd-(double)timeBegin);
296  CPUTime = time/((double)CLOCKS_PER_SEC);
297  std::cout << CPUTime << " ";
298 
299  return true;
300 }
301 
312 template<typename OrientationFunctor, typename RandomFunctor>
313 bool nullZeroVectorTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n = 1000000)
314 {
315  BOOST_CONCEPT_ASSERT(( COrientationFunctor2<OrientationFunctor> ));
316 
317  typedef typename OrientationFunctor::Point Point;
318  Point P, Q;
319 
320  clock_t timeBegin, timeEnd;
321  timeBegin = clock();
322 
323  for (DGtal::int32_t i = 0; (i < n); ++i)
324  {
325  P[0] = gen();
326  P[1] = gen();
327  Q[0] = gen();
328  Q[1] = gen();
329  f.init(P, Q);
330  f( P );
331  }
332 
333  timeEnd = clock();
334  long double time, CPUTime;
335  time = ((double)timeEnd-(double)timeBegin);
336  CPUTime = time/((double)CLOCKS_PER_SEC);
337  std::cout << CPUTime << " ";
338 
339  return true;
340 }
341 
353 template<typename OrientationFunctor, typename RandomFunctor>
354 bool nullTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n = 1000000)
355 {
356  BOOST_CONCEPT_ASSERT(( COrientationFunctor2<OrientationFunctor> ));
357 
358  typedef typename OrientationFunctor::Point Point;
359  Point P, Q, R;
360  P = Point(0,0);
361 
362  typedef typename Point::Coordinate Coordinate;
363  Coordinate k, l, u0, u1;
364 
365  clock_t timeBegin, timeEnd;
366  timeBegin = clock();
367 
368  for (DGtal::int32_t i = 0; (i < n); ++i)
369  {
370  k = gen();
371  l = gen();
372  u0 = gen();
373  u1 = gen();
374  Q[0] = k*u0;
375  Q[1] = k*u1;
376  R[0] = l*u0;
377  R[1] = l*u1;
378  f.init(P, Q);
379  f( R );
380  }
381 
382  timeEnd = clock();
383  long double time, CPUTime;
384  time = ((double)timeEnd-(double)timeBegin);
385  CPUTime = time/((double)CLOCKS_PER_SEC);
386  std::cout << CPUTime << " ";
387 
388  return true;
389 }
390 
403 template<typename OrientationFunctor, typename RandomFunctor>
404 bool quasiNullTest(OrientationFunctor f, RandomFunctor gen, const DGtal::int32_t n = 1000000)
405 {
406  BOOST_CONCEPT_ASSERT(( COrientationFunctor2<OrientationFunctor> ));
407 
408  typedef typename OrientationFunctor::Point Point;
409  Point P, Q, R;
410  P = Point(0,0);
411 
412  typedef typename Point::Coordinate Coordinate;
413  Coordinate k, l, u0, u1;
414 
415  clock_t timeBegin, timeEnd;
416  timeBegin = clock();
417 
418  for (DGtal::int32_t i = 0; (i < n); ++i)
419  {
420  k = gen();
421  l = gen();
422  u0 = gen();
423  u1 = gen();
424  Q[0] = k*u0;
425  Q[0] += (rand()%5)-2;
426  Q[1] = k*u1;
427  Q[1] += (rand()%5)-2;
428  R[0] = l*u0;
429  R[0] += (rand()%5)-2;
430  R[1] = l*u1;
431  R[1] += (rand()%5)-2;
432  f.init(P, Q);
433  f( R );
434  }
435 
436  timeEnd = clock();
437  long double time, CPUTime;
438  time = ((double)timeEnd-(double)timeBegin);
439  CPUTime = time/((double)CLOCKS_PER_SEC);
440  std::cout << CPUTime << " ";
441 
442  return true;
443 }
444 
457 template<typename OrientationFunctor>
458 bool incTest(OrientationFunctor f, const DGtal::int32_t n = 1000000)
459 {
460  BOOST_CONCEPT_ASSERT(( COrientationFunctor2<OrientationFunctor> ));
461 
462  typedef typename OrientationFunctor::Point Point;
463  Point P, Q, R;
464 
465  typedef typename Point::Coordinate Coordinate;
466  Coordinate dx, dy;
467 
468  Coordinate max = 1073741824;
469  P = Point(0,0);
470  Q = Point(max, max);
471  R = Point(max/2, max/2);
472  f.init(P, Q);
473 
474  clock_t timeBegin, timeEnd;
475  timeBegin = clock();
476 
477  for (DGtal::int32_t i = 0; (i < n); ++i)
478  {
479  dx = (rand() % 3) - 1;
480  dy = (rand() % 3) - 1;
481  R[0] += dx;
482  ASSERT( R[0] >= -max );
483  ASSERT( R[0] < max );
484  R[1] += dy;
485  ASSERT( R[0] >= -max );
486  ASSERT( R[0] < max );
487  f( R );
488  }
489 
490  timeEnd = clock();
491  long double time, CPUTime;
492  time = ((double)timeEnd-(double)timeBegin);
493  CPUTime = time/((double)CLOCKS_PER_SEC);
494  std::cout << CPUTime << " ";
495 
496  return true;
497 }
498 
504 bool incTestComparison()
505 {
506  typedef PointVector<2, DGtal::int32_t> Point;
507 
508  long seed = time(NULL);
509 
510  std::cout << "# incremental input " << std::endl;
511  std::cout << "# running times in s. for 1 million tries" << std::endl;
512 
513  {
514  srand(seed);
515  std::cout << "2x2-int32-int64 ";
518  incTest( F() );
519  std::cout << std::endl;
520  }
521  {
522  srand(seed);
523  std::cout << "2x2-inc-int32-int64 ";
526  incTest( F() );
527  std::cout << std::endl;
528  }
529  {
530  srand(seed);
531  std::cout << "2x2-avnaim++-int32-double ";
532  typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
533  typedef Filtered2x2DetComputer<DetComputer> FDetComputer;
535  incTest( F() );
536  std::cout << std::endl;
537  }
538 #ifdef WITH_BIGINTEGER
539  {
540  srand(seed);
541  std::cout << "2x2-int32-BigInt ";
544  incTest( F() );
545  std::cout << std::endl;
546  }
547  {
548  srand(seed);
549  std::cout << "2x2-inc-int32-BigInt ";
552  incTest( F() );
553  std::cout << std::endl;
554  }
555 #endif
556  return true;
557 }
558 
564 bool randomTest30All()
565 {
566  typedef PointVector<2, DGtal::int32_t> Point;
567 
568  std::cout << "# random integers within [-2^30 ; 2^30[" << std::endl;
569  std::cout << "# running times in s. for 1 million tries" << std::endl;
570  std::cout << "# columns: random, null1, null2, null3, quasi-null " << std::endl;
571  std::cout << "# NB. double has " << std::numeric_limits<double>::digits << " bits in the mantissa " << std::endl;
572 
573  long seed = time(NULL);
574 
575  {
576  srand(seed);
577  std::cout << "3x3-int32-int64 ";
579  randomTest( F(), signedRandomInt30 );
580  nullSameVectorsTest( F(), signedRandomInt30 );
581  nullZeroVectorTest( F(), signedRandomInt30 );
582  nullTest( F(), signedRandomInt15 );
583  quasiNullTest( F(), signedRandomInt15 );
584  std::cout << std::endl;
585  }
586 #ifdef WITH_BIGINTEGER
587  {
588  srand(seed);
589  std::cout << "3x3-int32-BigInt ";
591  randomTest( F(), signedRandomInt30 );
592  nullSameVectorsTest( F(), signedRandomInt30 );
593  nullZeroVectorTest( F(), signedRandomInt30 );
594  nullTest( F(), signedRandomInt15 );
595  quasiNullTest( F(), signedRandomInt15 );
596  std::cout << std::endl;
597 }
598 #endif
599  {
600  srand(seed);
601  std::cout << "2x2-int32-int64 ";
604  randomTest( F(), signedRandomInt30 );
605  nullSameVectorsTest( F(), signedRandomInt30 );
606  nullZeroVectorTest( F(), signedRandomInt30 );
607  nullTest( F(), signedRandomInt15 );
608  quasiNullTest( F(), signedRandomInt15 );
609  std::cout << std::endl;
610  }
611 #ifdef WITH_BIGINTEGER
612  {
613  srand(seed);
614  std::cout << "2x2-int32-BigInt ";
617  randomTest( F(), signedRandomInt30 );
618  nullSameVectorsTest( F(), signedRandomInt30 );
619  nullZeroVectorTest( F(), signedRandomInt30 );
620  nullTest( F(), signedRandomInt15 );
621  quasiNullTest( F(), signedRandomInt15 );
622  std::cout << std::endl;
623  }
624 #endif
625  {
626  srand(seed);
627  std::cout << "2x2-inc-int32-int64 ";
630  randomTest( F(), signedRandomInt30 );
631  nullSameVectorsTest( F(), signedRandomInt30 );
632  nullZeroVectorTest( F(), signedRandomInt30 );
633  nullTest( F(), signedRandomInt15 );
634  quasiNullTest( F(), signedRandomInt15 );
635  std::cout << std::endl;
636  }
637 #ifdef WITH_BIGINTEGER
638  {
639  srand(seed);
640  std::cout << "2x2-inc-int32-BigInt ";
643  randomTest( F(), signedRandomInt30 );
644  nullSameVectorsTest( F(), signedRandomInt30 );
645  nullZeroVectorTest( F(), signedRandomInt30 );
646  nullTest( F(), signedRandomInt15 );
647  quasiNullTest( F(), signedRandomInt15 );
648  std::cout << std::endl;
649  }
650 #endif
651  {
652  srand(seed);
653  std::cout << "2x2-avnaim-int32-int32 ";
656  randomTest( F(), signedRandomInt30 );
657  nullSameVectorsTest( F(), signedRandomInt30 );
658  nullZeroVectorTest( F(), signedRandomInt30 );
659  nullTest( F(), signedRandomInt15 );
660  quasiNullTest( F(), signedRandomInt15 );
661  std::cout << std::endl;
662  }
663  {
664  srand(seed);
665  std::cout << "2x2-avnaim-int32-double ";
666  typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
668  randomTest( F(), signedRandomInt30 );
669  nullSameVectorsTest( F(), signedRandomInt30 );
670  nullZeroVectorTest( F(), signedRandomInt30 );
671  nullTest( F(), signedRandomInt15 );
672  quasiNullTest( F(), signedRandomInt15 );
673  std::cout << std::endl;
674  }
675  {
676  srand(seed);
677  std::cout << "2x2-avnaim++-int32-double ";
678  typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
679  typedef Filtered2x2DetComputer<DetComputer> FDetComputer;
681  randomTest( F(), signedRandomInt30 );
682  nullSameVectorsTest( F(), signedRandomInt30 );
683  nullZeroVectorTest( F(), signedRandomInt30 );
684  nullTest( F(), signedRandomInt15 );
685  quasiNullTest( F(), signedRandomInt15 );
686  std::cout << std::endl;
687  }
688 
689  return true;
690 }
691 
697 bool randomTest52All()
698 {
699  std::cout << "# random integers within [-2^52 ; 2^52[" << std::endl;
700  std::cout << "# running times in s. for 1 million tries" << std::endl;
701  std::cout << "# columns: random, null1, null2, null3, quasi-null " << std::endl;
702  std::cout << "# NB. double has " << std::numeric_limits<double>::digits << " bits in the mantissa " << std::endl;
703 
704  long seed = time(NULL);
705 
706 #ifdef WITH_BIGINTEGER
707  {
708  srand(seed);
709  std::cout << "3x3-double-BigInt ";
710  typedef PointVector<2, double> Point;
712  randomTest( F(), signedRandomDouble52 );
713  nullSameVectorsTest( F(), signedRandomDouble52 );
714  nullZeroVectorTest( F(), signedRandomDouble52 );
715  nullTest( F(), signedRandomInt26 );
716  quasiNullTest( F(), signedRandomInt26 );
717  std::cout << std::endl;
718  }
719  {
720  srand(seed);
721  std::cout << "2x2-double-BigInt ";
722  typedef PointVector<2, double> Point;
725  randomTest( F(), signedRandomDouble52 );
726  nullSameVectorsTest( F(), signedRandomDouble52 );
727  nullZeroVectorTest( F(), signedRandomDouble52 );
728  nullTest( F(), signedRandomInt26 );
729  quasiNullTest( F(), signedRandomInt26 );
730  std::cout << std::endl;
731  }
732  {
733  srand(seed);
734  std::cout << "2x2-inc-double-BigInt ";
735  typedef PointVector<2, double> Point;
738  randomTest( F(), signedRandomDouble52 );
739  nullSameVectorsTest( F(), signedRandomDouble52 );
740  nullZeroVectorTest( F(), signedRandomDouble52 );
741  nullTest( F(), signedRandomInt26 );
742  quasiNullTest( F(), signedRandomInt26 );
743  std::cout << std::endl;
744  }
745 #endif
746  {
747  srand(seed);
748  std::cout << "2x2-avnaim-int64-int64 ";
749  typedef PointVector<2, DGtal::int64_t> Point;
752  randomTest( F(), signedRandomInt52 );
753  nullSameVectorsTest( F(), signedRandomInt52 );
754  nullZeroVectorTest( F(), signedRandomInt52 );
755  nullTest( F(), signedRandomInt26 );
756  quasiNullTest( F(), signedRandomInt26 );
757  std::cout << std::endl;
758  }
759  {
760  srand(seed);
761  std::cout << "2x2-avnaim-double-int64 ";
762  typedef PointVector<2, double> Point;
765  randomTest( F(), signedRandomDouble52 );
766  nullSameVectorsTest( F(), signedRandomDouble52 );
767  nullZeroVectorTest( F(), signedRandomDouble52 );
768  nullTest( F(), signedRandomInt26 );
769  quasiNullTest( F(), signedRandomInt26 );
770  std::cout << std::endl;
771  }
772  {
773  srand(seed);
774  std::cout << "2x2-avnaim-int64-double ";
775  typedef PointVector<2, DGtal::int64_t> Point;
776  typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
778  randomTest( F(), signedRandomInt52 );
779  nullSameVectorsTest( F(), signedRandomInt52 );
780  nullZeroVectorTest( F(), signedRandomInt52 );
781  nullTest( F(), signedRandomInt26 );
782  quasiNullTest( F(), signedRandomInt26 );
783  std::cout << std::endl;
784  }
785  {
786  srand(seed);
787  std::cout << "2x2-avnaim-double-double ";
788  typedef PointVector<2, double> Point;
789  typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
791  randomTest( F(), signedRandomDouble52 );
792  nullSameVectorsTest( F(), signedRandomDouble52 );
793  nullZeroVectorTest( F(), signedRandomDouble52 );
794  nullTest( F(), signedRandomInt26 );
795  quasiNullTest( F(), signedRandomInt26 );
796  std::cout << std::endl;
797  }
798  {
799  srand(seed);
800  std::cout << "2x2-avnaim++-int64-double ";
801  typedef PointVector<2, DGtal::int64_t> Point;
802  typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
803  typedef Filtered2x2DetComputer<DetComputer> FDetComputer;
805  randomTest( F(), signedRandomInt52 );
806  nullSameVectorsTest( F(), signedRandomInt52 );
807  nullZeroVectorTest( F(), signedRandomInt52 );
808  nullTest( F(), signedRandomInt26 );
809  quasiNullTest( F(), signedRandomInt26 );
810  std::cout << std::endl;
811  }
812  {
813  srand(seed);
814  std::cout << "2x2-avnaim++-double-double ";
815  typedef PointVector<2, double> Point;
816  typedef AvnaimEtAl2x2DetSignComputer<double> DetComputer;
817  typedef Filtered2x2DetComputer<DetComputer> FDetComputer;
819  randomTest( F(), signedRandomDouble52 );
820  nullSameVectorsTest( F(), signedRandomDouble52 );
821  nullZeroVectorTest( F(), signedRandomDouble52 );
822  nullTest( F(), signedRandomInt26 );
823  quasiNullTest( F(), signedRandomInt26 );
824  std::cout << std::endl;
825  }
826 
827  return true;
828 }
829 
835 bool randomTest62All()
836 {
837  std::cout << "# random integers within [-2^62 ; 2^62[" << std::endl;
838  std::cout << "# running times in s. for 1 million tries" << std::endl;
839  std::cout << "# columns: random, null1, null2, null3, quasi-null " << std::endl;
840  std::cout << "# NB. long double has " << std::numeric_limits<long double>::digits << " bits in the mantissa " << std::endl;
841 
842  long seed = time(NULL);
843 
844 #ifdef WITH_BIGINTEGER
845  {
846  srand(seed);
847  std::cout << "3x3-BigInt-BigInt ";
848  typedef PointVector<2, DGtal::BigInteger> Point;
850  randomTest( F(), signedRandomBigInt62 );
851  nullSameVectorsTest( F(), signedRandomBigInt62 );
852  nullZeroVectorTest( F(), signedRandomBigInt62 );
853  nullTest( F(), signedRandomInt30 );
854  quasiNullTest( F(), signedRandomInt30 );
855  std::cout << std::endl;
856  }
857  {
858  srand(seed);
859  std::cout << "2x2-BigInt-BigInt ";
860  typedef PointVector<2, DGtal::BigInteger> Point;
863  randomTest( F(), signedRandomBigInt62 );
864  nullSameVectorsTest( F(), signedRandomBigInt62 );
865  nullZeroVectorTest( F(), signedRandomBigInt62 );
866  nullTest( F(), signedRandomInt30 );
867  quasiNullTest( F(), signedRandomInt30 );
868  std::cout << std::endl;
869  }
870  {
871  srand(seed);
872  std::cout << "2x2-inc-BigInt-BigInt ";
873  typedef PointVector<2, DGtal::BigInteger> Point;
876  randomTest( F(), signedRandomBigInt62 );
877  nullSameVectorsTest( F(), signedRandomBigInt62 );
878  nullZeroVectorTest( F(), signedRandomBigInt62 );
879  nullTest( F(), signedRandomInt30 );
880  quasiNullTest( F(), signedRandomInt30 );
881  std::cout << std::endl;
882  }
883 #endif
884  {
885  srand(seed);
886  std::cout << "2x2-avnaim-int64-int64 ";
887  typedef PointVector<2, DGtal::int64_t> Point;
890  randomTest( F(), signedRandomInt62 );
891  nullSameVectorsTest( F(), signedRandomInt62 );
892  nullZeroVectorTest( F(), signedRandomInt62 );
893  nullTest( F(), signedRandomInt30 );
894  quasiNullTest( F(), signedRandomInt30 );
895  std::cout << std::endl;
896  }
897  {
898  srand(seed);
899  std::cout << "2x2-avnaim++-int64-longdouble ";
900  typedef PointVector<2, DGtal::int64_t> Point;
901  typedef AvnaimEtAl2x2DetSignComputer<long double> DetComputer;
902  typedef Filtered2x2DetComputer<DetComputer> FDetComputer;
904  randomTest( F(), signedRandomInt62 );
905  nullSameVectorsTest( F(), signedRandomInt62 );
906  nullZeroVectorTest( F(), signedRandomInt62 );
907  nullTest( F(), signedRandomInt30 );
908  quasiNullTest( F(), signedRandomInt30 );
909  std::cout << std::endl;
910  }
911 
912  return true;
913 }
914 
916 // Standard services - public :
917 
918 int main( int argc, char** argv )
919 {
920  trace.beginBlock ( "Testing class InHalfPlane-benchmark" );
921  trace.info() << "Args:";
922  for ( int i = 0; i < argc; ++i )
923  trace.info() << " " << argv[ i ];
924  trace.info() << endl;
925 
926  incTestComparison();
927  randomTest30All();
928  randomTest52All();
929  randomTest62All();
930 
931  bool res = true;
932  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
933  trace.endBlock();
934  return res ? 0 : 1;
935 }
936 // //
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:130
STL namespace.
double endBlock()
Aim: Class that provides a way of computing the sign of the determinant of a 2x2 matrix from its four...
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
mpz_class BigInteger
Multi-precision integer with GMP implementation.
Definition: BasicTypes.h:79
Aim: Small class useful to compute the determinant of a 2x2 matrix from its four coefficients, ie. .
std::ostream & emphase()
Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation o...
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & info()
Aim: Class that provides a way of computing the sign of the determinant of a 2x2 matrix from its four...
Aim: Small class useful to compute, in an incremental way, the determinant of a 2x2 matrix from its f...
boost::int32_t int32_t
signed 32-bit integer.
Definition: BasicTypes.h:72
boost::int64_t int64_t
signed 94-bit integer.
Definition: BasicTypes.h:74
Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation o...