DGtal
1.1.0
tests
kernel
testLinearAlgebra.cpp
Go to the documentation of this file.
1
30
#include <iostream>
32
#include "DGtal/base/Common.h"
33
#include "DGtal/kernel/SpaceND.h"
34
#include "DGtal/kernel/LinearAlgebra.h"
36
37
using namespace
std;
38
using namespace
DGtal
;
39
41
// Functions for testing class LinearAlgebra.
43
47
bool
testLinearAlgebra
()
48
{
49
unsigned
int
nbok = 0;
50
unsigned
int
nb = 0;
51
52
trace
.
beginBlock
(
"Testing block ..."
);
53
54
typedef
SpaceND<2,DGtal::int32_t>
Space2Int;
55
typedef
Space2Int::Point
Point
;
56
typedef
SpaceND<2,DGtal::int64_t >
Space2LongInt;
57
typedef
Space2LongInt::Point
Pointlong;
58
59
Point
a,b;
60
Pointlong c,d;
61
62
LinearAlgebra<Space2Int>::determinant
(a,b);
63
LinearAlgebra<Space2LongInt>::determinant
(c,d);
64
65
nbok +=
true
? 1 : 0;
66
nb++;
67
trace
.
info
() <<
"("
<< nbok <<
"/"
<< nb <<
") "
68
<<
"true == true"
<< std::endl;
69
trace
.
endBlock
();
70
71
return
nbok == nb;
72
}
73
75
// Standard services - public :
76
77
int
main
(
int
argc,
char
** argv )
78
{
79
trace
.
beginBlock
(
"Testing class LinearAlgebra"
);
80
trace
.
info
() <<
"Args:"
;
81
for
(
int
i = 0; i < argc; ++i )
82
trace
.
info
() <<
" "
<< argv[ i ];
83
trace
.
info
() << endl;
84
85
bool
res =
testLinearAlgebra
();
// && ... other tests
86
trace
.
emphase
() << ( res ?
"Passed."
:
"Error."
) << endl;
87
trace
.
endBlock
();
88
return
res ? 0 : 1;
89
}
90
// //
main
int main(int argc, char **argv)
Definition:
testLinearAlgebra.cpp:77
DGtal::Trace::endBlock
double endBlock()
DGtal::Trace::emphase
std::ostream & emphase()
DGtal::trace
Trace trace
Definition:
Common.h:150
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::LinearAlgebra
Aim: A utility class that contains methods to perform integral linear algebra.
Definition:
LinearAlgebra.h:62
DGtal::SpaceND
Definition:
SpaceND.h:96
DGtal::Trace::info
std::ostream & info()
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition:
ClosedIntegerHalfPlane.h:49
Point
MyPointD Point
Definition:
testClone2.cpp:383
testLinearAlgebra
bool testLinearAlgebra()
Definition:
testLinearAlgebra.cpp:47
Generated on Fri Oct 9 2020 08:58:23 for DGtal by
1.8.20