NumCpp
2.14.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Variables
a
c
d
e
g
h
i
j
m
n
o
p
s
t
v
Typedefs
Enumerations
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
c
d
e
i
l
m
n
p
r
s
t
v
x
y
z
Typedefs
a
c
d
i
p
r
s
t
v
Enumerations
Related Symbols
Files
File List
Globals
All
Macros
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
essentiallyEqual.hpp
Go to the documentation of this file.
1
28
#pragma once
29
30
#include <cmath>
31
#include <complex>
32
#include <string>
33
34
#include "
NumCpp/Core/DtypeInfo.hpp
"
35
#include "
NumCpp/Core/Internal/TypeTraits.hpp
"
36
37
namespace
nc::utils
38
{
39
//============================================================================
40
// Method Description:
48
template<typename dtype, std::enable_if_t<std::is_integral<dtype>::value
,
int
> = 0>
49
bool
essentiallyEqual
(
dtype
inValue1
,
dtype
inValue2
)
noexcept
50
{
51
return
inValue1
==
inValue2
;
52
}
49
bool
essentiallyEqual
(
dtype
inValue1
,
dtype
inValue2
)
noexcept
{
…
}
53
54
//============================================================================
55
// Method Description:
64
template<typename dtype, std::enable_if_t<std::is_floating_point<dtype>::value
,
int
> = 0>
65
bool
essentiallyEqual
(
dtype
inValue1
,
dtype
inValue2
,
dtype
inEpsilon
)
noexcept
66
{
67
const
auto
absValue1
= std::abs(
inValue1
);
68
const
auto
absValue2
= std::abs(
inValue2
);
69
return
std::abs(
inValue1
-
inValue2
) <= ((
absValue1
>
absValue2
?
absValue2
:
absValue1
) * std::abs(
inEpsilon
));
70
}
65
bool
essentiallyEqual
(
dtype
inValue1
,
dtype
inValue2
,
dtype
inEpsilon
)
noexcept
{
…
}
71
72
//============================================================================
73
// Method Description:
81
template<typename dtype, std::enable_if_t<std::is_floating_point<dtype>::value
,
int
> = 0>
82
bool
essentiallyEqual
(
dtype
inValue1
,
dtype
inValue2
)
noexcept
83
{
84
return
essentiallyEqual
(
inValue1
,
inValue2
,
DtypeInfo<dtype>::epsilon
());
85
}
86
}
// namespace nc::utils
DtypeInfo.hpp
TypeTraits.hpp
nc::DtypeInfo
Holds info about the dtype.
Definition
DtypeInfo.hpp:41
nc::utils
Definition
Utils/cube.hpp:33
nc::utils::essentiallyEqual
bool essentiallyEqual(dtype inValue1, dtype inValue2) noexcept
Definition
essentiallyEqual.hpp:49
nc::arange
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition
arange.hpp:59
include
NumCpp
Utils
essentiallyEqual.hpp
Generated by
1.9.8