Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
7d9e31b0
Commit
7d9e31b0
authored
Dec 30, 2017
by
Jordan P. Lefebvre
Browse files
Applying clang-format to all packages.
parent
3c8371e7
Pipeline
#11077
passed with stage
in 3 minutes and 28 seconds
Changes
113
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixalgorithm/ordering.cc
View file @
7d9e31b0
...
...
@@ -2,11 +2,9 @@
#include
<iostream>
namespace
radix
{
void
super_sad_necessary_hack_for_dll_lib_creation
::
foo_method
()
{
std
::
cout
<<
"This is a dummy method for compilation symbol"
<<
std
::
endl
;
namespace
radix
{
void
super_sad_necessary_hack_for_dll_lib_creation
::
foo_method
()
{
std
::
cout
<<
"This is a dummy method for compilation symbol"
<<
std
::
endl
;
}
}
// namespace radix
}
// namespace radix
radixalgorithm/ordering.hh
View file @
7d9e31b0
#include
<vector>
#include
<numeric>
#include
<utility>
// swap
#include
<algorithm>
#include
<numeric>
#include
<radixbug/bug.hh>
#include
<utility>
// swap
#include
<vector>
#include
"radixdl/visibility.hh"
namespace
radix
{
namespace
radix
{
struct
RADIX_PUBLIC
super_sad_necessary_hack_for_dll_lib_creation
{
void
foo_method
();
struct
RADIX_PUBLIC
super_sad_necessary_hack_for_dll_lib_creation
{
void
foo_method
();
};
template
<
typename
list_type
,
typename
compare_type
>
RADIX_PUBLIC
std
::
vector
<
size_t
>
sort_permutation
(
const
list_type
&
data
,
compare_type
&
comparator
)
{
// create list of indices the size of the incoming data
std
::
vector
<
std
::
size_t
>
order
(
data
.
size
());
// initialize list with initial index, starting at zero
std
::
iota
(
order
.
begin
(),
order
.
end
(),
0
);
// order ordering according to comparator
std
::
sort
(
order
.
begin
(),
order
.
end
(),
[
&
](
std
::
size_t
data_i
,
std
::
size_t
data_j
)
{
radix_line
(
"Comparing ["
<<
data_i
<<
", "
<<
data_j
<<
"]"
);
return
comparator
(
data
[
data_i
],
data
[
data_j
]);
});
return
order
;
}
// sort_permutation
template
<
typename
list_type
,
typename
compare_type
>
RADIX_PUBLIC
std
::
vector
<
size_t
>
sort_permutation
(
const
list_type
&
data
,
compare_type
&
comparator
)
{
// create list of indices the size of the incoming data
std
::
vector
<
std
::
size_t
>
order
(
data
.
size
());
// initialize list with initial index, starting at zero
std
::
iota
(
order
.
begin
(),
order
.
end
(),
0
);
// order ordering according to comparator
std
::
sort
(
order
.
begin
(),
order
.
end
(),
[
&
](
std
::
size_t
data_i
,
std
::
size_t
data_j
)
{
radix_line
(
"Comparing ["
<<
data_i
<<
", "
<<
data_j
<<
"]"
);
return
comparator
(
data
[
data_i
],
data
[
data_j
]);
});
return
order
;
}
// sort_permutation
template
<
typename
list_type
>
RADIX_PUBLIC
void
apply_permutation
(
list_type
&
data
,
const
std
::
vector
<
size_t
>&
order
)
{
std
::
vector
<
bool
>
done
(
data
.
size
(),
false
);
for
(
size_t
i
=
0
;
i
<
data
.
size
();
++
i
)
{
if
(
done
[
i
])
continue
;
done
[
i
]
=
true
;
// previous ordering is that of the loop, so index i it is
size_t
prev_j
=
i
;
// get the new order lookup
size_t
j
=
order
[
i
];
//
while
(
i
!=
j
)
{
radix_line
(
i
<<
". swapping "
<<
prev_j
<<
" for "
<<
j
);
std
::
swap
(
data
[
prev_j
],
data
[
j
]);
done
[
j
]
=
true
;
prev_j
=
j
;
j
=
order
[
j
];
}
RADIX_PUBLIC
void
apply_permutation
(
list_type
&
data
,
const
std
::
vector
<
size_t
>
&
order
)
{
std
::
vector
<
bool
>
done
(
data
.
size
(),
false
);
for
(
size_t
i
=
0
;
i
<
data
.
size
();
++
i
)
{
if
(
done
[
i
])
continue
;
done
[
i
]
=
true
;
// previous ordering is that of the loop, so index i it is
size_t
prev_j
=
i
;
// get the new order lookup
size_t
j
=
order
[
i
];
//
while
(
i
!=
j
)
{
radix_line
(
i
<<
". swapping "
<<
prev_j
<<
" for "
<<
j
);
std
::
swap
(
data
[
prev_j
],
data
[
j
]);
done
[
j
]
=
true
;
prev_j
=
j
;
j
=
order
[
j
];
}
}
// apply_permutation
}
// namespace radix
}
}
// apply_permutation
}
// namespace radix
radixalgorithm/tests/tstOrdering.cc
View file @
7d9e31b0
#include
<iostream>
#include
"gtest/gtest.h"
#include
"radixbug/bug.hh"
#include
"radixalgorithm/ordering.hh"
#include
"radixbug/bug.hh"
TEST
(
radixalgorithm
,
Ordering
)
{
std
::
vector
<
double
>
list
{
2.0
,
1.0
,
3.0
,
4.0
,
5.0
,
0.0
,
10.0
};
// permutation 5, 1, 0, 2, 3, 4, 6
// correct ordering
std
::
vector
<
int
>
list2
{
0
,
1
,
2
,
3
,
4
,
5
,
6
};
auto
comparator
=
[](
double
a
,
double
b
)
{
radix_line
(
"
\t
["
<<
a
<<
","
<<
b
<<
"]"
);
return
a
<
b
;
};
std
::
vector
<
size_t
>
permutation
=
radix
::
sort_permutation
(
list
,
comparator
);
// test edges
EXPECT_EQ
(
permutation
[
0
],
5
);
EXPECT_EQ
(
permutation
[
6
],
6
);
std
::
cout
<<
"Ordering:"
<<
std
::
endl
;
for
(
size_t
i
=
0
;
i
<
permutation
.
size
();
++
i
)
{
std
::
cout
<<
"index "
<<
i
<<
". ("
<<
list
[
i
]
<<
") recieves value from "
<<
permutation
[
i
]
<<
" ("
<<
list
[
permutation
[
i
]]
<<
")"
<<
std
::
endl
;
}
//
// sort list given the
radix
::
apply_permutation
(
list
,
permutation
);
EXPECT_DOUBLE_EQ
(
list
[
0
],
0.0
);
EXPECT_DOUBLE_EQ
(
list
[
6
],
10.0
);
radix
::
apply_permutation
(
list2
,
permutation
);
EXPECT_EQ
(
list2
[
0
],
5
);
EXPECT_EQ
(
list2
[
6
],
6
);
for
(
size_t
i
=
0
;
i
<
list
.
size
();
++
i
)
{
std
::
cout
<<
"["
<<
list
[
i
]
<<
","
<<
list2
[
i
]
<<
"]"
<<
std
::
endl
;
}
TEST
(
radixalgorithm
,
Ordering
)
{
std
::
vector
<
double
>
list
{
2.0
,
1.0
,
3.0
,
4.0
,
5.0
,
0.0
,
10.0
};
// permutation 5, 1, 0, 2, 3, 4, 6
// correct ordering
std
::
vector
<
int
>
list2
{
0
,
1
,
2
,
3
,
4
,
5
,
6
};
auto
comparator
=
[](
double
a
,
double
b
)
{
radix_line
(
"
\t
["
<<
a
<<
","
<<
b
<<
"]"
);
return
a
<
b
;
};
std
::
vector
<
size_t
>
permutation
=
radix
::
sort_permutation
(
list
,
comparator
);
// test edges
EXPECT_EQ
(
permutation
[
0
],
5
);
EXPECT_EQ
(
permutation
[
6
],
6
);
std
::
cout
<<
"Ordering:"
<<
std
::
endl
;
for
(
size_t
i
=
0
;
i
<
permutation
.
size
();
++
i
)
{
std
::
cout
<<
"index "
<<
i
<<
". ("
<<
list
[
i
]
<<
") recieves value from "
<<
permutation
[
i
]
<<
" ("
<<
list
[
permutation
[
i
]]
<<
")"
<<
std
::
endl
;
}
//
// sort list given the
radix
::
apply_permutation
(
list
,
permutation
);
EXPECT_DOUBLE_EQ
(
list
[
0
],
0.0
);
EXPECT_DOUBLE_EQ
(
list
[
6
],
10.0
);
radix
::
apply_permutation
(
list2
,
permutation
);
EXPECT_EQ
(
list2
[
0
],
5
);
EXPECT_EQ
(
list2
[
6
],
6
);
for
(
size_t
i
=
0
;
i
<
list
.
size
();
++
i
)
{
std
::
cout
<<
"["
<<
list
[
i
]
<<
","
<<
list2
[
i
]
<<
"]"
<<
std
::
endl
;
}
}
radixams/main.cc
View file @
7d9e31b0
...
...
@@ -8,87 +8,77 @@
#include
<cmath>
using
namespace
radix
;
int
main
(
int
argc
,
char
**
argv
)
{
CommandLine
command
(
argc
,
argv
);
command
.
declareArgument
(
"altitude"
,
"Altitude at which to calcuate dose rate (0 for sea level) in m"
);
command
.
declareArgument
(
"activity"
,
"Activity of the area in Ci/m^2"
);
command
.
declareArgument
(
"energy"
,
"Gamma ray energy in MeV"
);
// expecting three arguments
if
(
!
command
.
validate
(
std
::
cerr
))
{
command
.
help
(
std
::
cerr
);
return
0
;
}
// altitude above sea level - default to 0
double
z
=
0.0
;
z
=
command
.
arg
<
double
>
(
0
);
// activity in Ci/m^2 of the area of interest - default to 1.767e3
double
a
=
1.767e3
;
a
=
command
.
arg
<
double
>
(
1
);
// gamma-ray energy in MeV - default to 7e-1
double
e
=
7e-1
;
e
=
command
.
arg
<
double
>
(
2
);
// radius of area of interest (assumed to be altitude), distance
// double r = z;
// double s = std::sqrt(z*z + r*r);
// sigma scalar; constant at sea level
double
sigma
=
1.225
;
// not at sea level, update sigma
if
(
std
::
fabs
(
z
)
>
1e-16
)
{
sigma
=
1.911515e-16
*
(
z
*
z
*
z
*
z
)
-
9.857582e-13
*
(
z
*
z
*
z
)
+
5.399174e-9
*
(
z
*
z
)
-
1.180686e-4
*
z
+
1.22507
;
}
// absorption/attenuation of gamma ray as it passes through air
// auto mua = radix::gammaRayAbsorptionInAir(e);
auto
mut
=
radix
::
gammaRayAttenuationInAir
(
e
);
// mu scalars
auto
mutg
=
mut
*
1.225
;
// auto muag = -mua * 1.225;
auto
mutz
=
mut
*
sigma
;
// auto muaz = -mua * sigma;
// exponential integral values and their ratio
auto
EIg
=
1.0
/
radix
::
exponentialIntegral
(
mutg
);
auto
EIz
=
1.0
/
radix
::
exponentialIntegral
(
mutz
*
z
);
auto
EIRatio
=
EIz
/
EIg
;
// dose rate at sea level/altitude
auto
DRg
=
9.62
*
a
;
auto
DRz
=
DRg
*
EIRatio
;
// report dose rate at sea level
if
(
std
::
fabs
(
z
)
<
1e-16
)
{
std
::
cout
<<
std
::
scientific
<<
DRg
<<
" is the Dose Rate at Ground Sea Level in R/hr"
<<
std
::
endl
;
}
// report dose rate at altitude above sea level
else
{
std
::
cout
<<
std
::
scientific
<<
DRz
<<
" is the Dose Rate at your Altitude above Ground Sea Level in R/hr"
<<
std
::
endl
;
}
int
main
(
int
argc
,
char
**
argv
)
{
CommandLine
command
(
argc
,
argv
);
command
.
declareArgument
(
"altitude"
,
"Altitude at which to calcuate dose rate (0 for sea level) in m"
);
command
.
declareArgument
(
"activity"
,
"Activity of the area in Ci/m^2"
);
command
.
declareArgument
(
"energy"
,
"Gamma ray energy in MeV"
);
// expecting three arguments
if
(
!
command
.
validate
(
std
::
cerr
))
{
command
.
help
(
std
::
cerr
);
return
0
;
}
// altitude above sea level - default to 0
double
z
=
0.0
;
z
=
command
.
arg
<
double
>
(
0
);
// activity in Ci/m^2 of the area of interest - default to 1.767e3
double
a
=
1.767e3
;
a
=
command
.
arg
<
double
>
(
1
);
// gamma-ray energy in MeV - default to 7e-1
double
e
=
7e-1
;
e
=
command
.
arg
<
double
>
(
2
);
// radius of area of interest (assumed to be altitude), distance
// double r = z;
// double s = std::sqrt(z*z + r*r);
// sigma scalar; constant at sea level
double
sigma
=
1.225
;
// not at sea level, update sigma
if
(
std
::
fabs
(
z
)
>
1e-16
)
{
sigma
=
1.911515e-16
*
(
z
*
z
*
z
*
z
)
-
9.857582e-13
*
(
z
*
z
*
z
)
+
5.399174e-9
*
(
z
*
z
)
-
1.180686e-4
*
z
+
1.22507
;
}
// absorption/attenuation of gamma ray as it passes through air
// auto mua = radix::gammaRayAbsorptionInAir(e);
auto
mut
=
radix
::
gammaRayAttenuationInAir
(
e
);
// mu scalars
auto
mutg
=
mut
*
1.225
;
// auto muag = -mua * 1.225;
auto
mutz
=
mut
*
sigma
;
// auto muaz = -mua * sigma;
// exponential integral values and their ratio
auto
EIg
=
1.0
/
radix
::
exponentialIntegral
(
mutg
);
auto
EIz
=
1.0
/
radix
::
exponentialIntegral
(
mutz
*
z
);
auto
EIRatio
=
EIz
/
EIg
;
// dose rate at sea level/altitude
auto
DRg
=
9.62
*
a
;
auto
DRz
=
DRg
*
EIRatio
;
// report dose rate at sea level
if
(
std
::
fabs
(
z
)
<
1e-16
)
{
std
::
cout
<<
std
::
scientific
<<
DRg
<<
" is the Dose Rate at Ground Sea Level in R/hr"
<<
std
::
endl
;
}
// report dose rate at altitude above sea level
else
{
std
::
cout
<<
std
::
scientific
<<
DRz
<<
" is the Dose Rate at your Altitude above Ground Sea Level in R/hr"
<<
std
::
endl
;
}
return
0
;
}
radixbug/bug.hh
View file @
7d9e31b0
...
...
@@ -20,32 +20,45 @@
*
* Available MACROs:
* radix(arg) - std::cerr << arg - Pushes content to stderr
* radix_line(arg) - std::cerr << arg << std::endl - Push newline terminated
content to stderr
* radix(arg) - std::cerr << arg - Pushes content to stderr
* radix_warning(arg) - std::cerr << arg << std::endl - Push newline terminated
content to stderr
* radix_tagged_line(arg) - Same as radixLine, prefixed with
FILE and LINE
* radix_tagged(arg) - Same as radix, prefixed with FILE and LINE
* radix_line(arg) - std::cerr << arg << std::endl - Push newline terminated
*
content to stderr
radix(arg) - std::cerr << arg - Pushes content to stderr
* radix_warning(arg) - std::cerr << arg << std::endl - Push newline terminated
*
content to stderr
radix_tagged_line(arg) - Same as radixLine, prefixed with
*
FILE and LINE
radix_tagged(arg) - Same as radix, prefixed with FILE and LINE
* radix_tagged_warning(arg) - Same as radixWarning, prefixed with FILE and Line
* radix_block(block) - block - Simply places code block in preprocessor
*/
#include
<iostream>
#include
<cstdio>
#include
<iostream>
#if DEBUG_OUTPUT & 1
#ifndef radix_stream
#define radix_stream std::cerr
#endif
#define radix_define_stream
#define radix_line(arg) radix_stream << arg << std::endl
#define radix_flush_line(arg) radix_stream << arg << std::endl;fflush(stderr)
#define radix_flush_line(arg) \
radix_stream << arg << std::endl; \
fflush(stderr)
#define radix(arg) radix_stream << arg
#define radix_warning(arg) radix_stream << arg << std::endl
#define radix_tagged_warning(arg) radix_stream << __FILE__ << ":" << __LINE__ << ": " << arg << std::endl
#define radix_flush_warning(arg) radix_stream << arg << std::endl;fflush(stderr)
#define radix_tagged_line(arg) radix_stream << __FILE__ << ":" << __LINE__ << ": " << arg << std::endl
#define radix_flush_tagged_line(arg) radix_stream << __FILE__ << ":" << __LINE__ << ": " << arg << std::endl;fflush(stderr)
#define radix_tagged(arg) radix_stream << __FILE__ << ":" << __LINE__ << ": " << arg
#define radix_flush_tagged_warning(arg) radix_stream << __FILE__ << ":" << __LINE__ << ": " << arg << std::endl;fflush(stderr)
#define radix_tagged_block(block) radix_stream << __FILE__ << ":" << __LINE__ << ":" << std::endl; block
#define radix_tagged_warning(arg) \
radix_stream << __FILE__ << ":" << __LINE__ << ": " << arg << std::endl
#define radix_flush_warning(arg) \
radix_stream << arg << std::endl; \
fflush(stderr)
#define radix_tagged_line(arg) \
radix_stream << __FILE__ << ":" << __LINE__ << ": " << arg << std::endl
#define radix_flush_tagged_line(arg) \
radix_stream << __FILE__ << ":" << __LINE__ << ": " << arg << std::endl; \
fflush(stderr)
#define radix_tagged(arg) \
radix_stream << __FILE__ << ":" << __LINE__ << ": " << arg
#define radix_flush_tagged_warning(arg) \
radix_stream << __FILE__ << ":" << __LINE__ << ": " << arg << std::endl; \
fflush(stderr)
#define radix_tagged_block(block) \
radix_stream << __FILE__ << ":" << __LINE__ << ":" << std::endl; \
block
#define radix_block(block) block
#else
#define radix(arg)
...
...
@@ -62,8 +75,8 @@
#define radix_block(block)
#endif
/* DEBUG_OUTPUT */
#include
<stdexcept>
#include
<sstream>
#include
<stdexcept>
#ifndef RADIX_DBC
#define RADIX_DBC 0
#endif
...
...
@@ -76,42 +89,49 @@
// RADIX_DBC = 7 enables all
// Insist is always enabled
#if RADIX_DBC & 1
#define radix_require(c) if(!(c)) {\
std::ostringstream stream; \
stream << __FILE__ << ":" \
<< __LINE__ << " radix_require("<< #c << ") failed." << std::endl; \
throw std::runtime_error(stream.str()); }
#define radix_require(c) \
if (!(c)) { \
std::ostringstream stream; \
stream << __FILE__ << ":" << __LINE__ << " radix_require(" << #c \
<< ") failed." << std::endl; \
throw std::runtime_error(stream.str()); \
}
#else
#define radix_require(c)
#endif
#if RADIX_DBC & 2
#define radix_check(c) if(!(c)) {\
std::ostringstream stream; \
stream << __FILE__ << ":" \
<< __LINE__ << " radix_check("<< #c << ") failed." << std::endl; \
throw std::runtime_error(stream.str()); }
#define radix_check(c) \
if (!(c)) { \
std::ostringstream stream; \
stream << __FILE__ << ":" << __LINE__ << " radix_check(" << #c \
<< ") failed." << std::endl; \
throw std::runtime_error(stream.str()); \
}
#else
#define radix_check(c)
#endif
#if RADIX_DBC & 4
#define radix_ensure(c) if(!(c)) {\
std::ostringstream stream; \
stream << __FILE__ << ":" \
<< __LINE__ << " radix_ensure("<< #c << ") failed." << std::endl; \
throw std::runtime_error(stream.str()); }
#define radix_ensure(c) \
if (!(c)) { \
std::ostringstream stream; \
stream << __FILE__ << ":" << __LINE__ << " radix_ensure(" << #c \
<< ") failed." << std::endl; \
throw std::runtime_error(stream.str()); \
}
#define radix_remember(c) c
#else
#define radix_ensure(c)
#define radix_remember(c)
#endif
#define radix_insist(c, msg) if(!(c)) { \
std::ostringstream stream; \
stream << __FILE__ << ":" \
<< __LINE__ << "radix_insist("<< #c \
<< ") failed with this message:" \
<< std::endl << msg << std::endl; \
throw std::runtime_error(stream.str()); }
#define radix_insist(c, msg) \
if (!(c)) { \
std::ostringstream stream; \
stream << __FILE__ << ":" << __LINE__ << "radix_insist(" << #c \
<< ") failed with this message:" << std::endl \
<< msg << std::endl; \
throw std::runtime_error(stream.str()); \
}
/// set default timing to off
#ifndef RADIX_TIMING
...
...
@@ -120,48 +140,38 @@
#include
<chrono>
#include
<ctime>
namespace
radix
{
class
Timer
{
private:
bool
mRunning
;
std
::
chrono
::
steady_clock
::
time_point
mStart
;
std
::
chrono
::
steady_clock
::
time_point
mEnd
;
std
::
chrono
::
nanoseconds
mDuration
;
size_t
mIntervals
;
public:
Timer
()
:
mRunning
(
false
)
,
mDuration
(
0
)
,
mIntervals
(
0
)
{}
void
start
()
{
radix_check
(
!
mRunning
);
mRunning
=
true
;
mIntervals
++
;
mStart
=
std
::
chrono
::
steady_clock
::
now
();
}
void
stop
()
{
radix_check
(
mRunning
);
mEnd
=
std
::
chrono
::
steady_clock
::
now
();
mRunning
=
false
;
mDuration
+=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
nanoseconds
>
(
mEnd
-
mStart
);
}
namespace
radix
{
class
Timer
{
private:
bool
mRunning
;
std
::
chrono
::
steady_clock
::
time_point
mStart
;
std
::
chrono
::
steady_clock
::
time_point
mEnd
;
std
::
chrono
::
nanoseconds
mDuration
;
size_t
mIntervals
;
public:
Timer
()
:
mRunning
(
false
),
mDuration
(
0
),
mIntervals
(
0
)
{}
void
start
()
{
radix_check
(
!
mRunning
);
mRunning
=
true
;
mIntervals
++
;
mStart
=
std
::
chrono
::
steady_clock
::
now
();
}
void
stop
()
{
radix_check
(
mRunning
);
mEnd
=
std
::
chrono
::
steady_clock
::
now
();
mRunning
=
false
;
mDuration
+=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
nanoseconds
>
(
mEnd
-
mStart
);
}
double
duration
()
const
{
radix_check
(
!
mRunning
);
return
mDuration
.
count
();
}
size_t
intervals
()
const
{
return
mIntervals
;
}
};
// class Timer
}
// namespace radix
double
duration
()
const
{
radix_check
(
!
mRunning
);
return
mDuration
.
count
();
}
size_t
intervals
()
const
{
return
mIntervals
;
}
};
// class Timer
}
// namespace radix
#if RADIX_TIMING > 0
#define radix_timer(name) radix::Timer name
...
...
@@ -198,5 +208,4 @@ public:
#define radix_timer_block_3(content)
#endif
#endif
/* RADIX_RADIXBUG_BUG_HH_*/
#endif
/* RADIX_RADIXBUG_BUG_HH_*/
radixbug/tests/tstBug.cc
View file @
7d9e31b0
...
...
@@ -4,49 +4,41 @@
#define RADIX_TIMING 3
#include
"radixbug/bug.hh"
TEST
(
radixbug
,
Timer
)
{
radix_timer
(
timer1
);
radix_timer_2
(
timer2
);
radix_timer_3
(
timer3
);
double
value
=
0
;
auto
func
=
[](
double
value
)
->
double
{
return
value
*
value
;
};
//
// demostrate timing metrics
radix_timer_start
(
timer1
);
for
(
size_t
i
=
0
;
i
<
100
;
++
i
)
{
radix_timer_start_2
(
timer2
);
for
(
size_t
j
=
0
;
j
<
10000
;
++
j
)
{
radix_timer_start_3
(
timer3
);
value
=
value
+
func
(
value
);
radix_timer_stop_3
(
timer3
);
}
radix_timer_stop_2
(
timer2
);
TEST
(
radixbug
,
Timer
)
{
radix_timer
(
timer1
);
radix_timer_2
(
timer2
);
radix_timer_3
(
timer3
);
double
value
=
0
;
auto
func
=
[](
double
value
)
->
double
{
return
value
*
value
;
};
//
// demostrate timing metrics
radix_timer_start
(
timer1
);