Essentia
2.1-beta6-dev
tnt_math_utils.h
Go to the documentation of this file.
1
#ifndef MATH_UTILS_H
2
#define MATH_UTILS_H
3
4
/* needed for fabs, sqrt() below */
5
#include <cmath>
6
7
8
9
namespace
TNT
10
{
17
template
<
class
Real>
18
Real
hypot
(
const
Real
&a,
const
Real
&b)
19
{
20
21
if
(a== 0)
22
return
fabs(b);
23
else
24
{
25
Real
c = b/a;
26
return
fabs(a) * sqrt(1 + c*c);
27
}
28
}
29
}
/* TNT namespace */
30
31
32
33
#endif
34
/* MATH_UTILS_H */
TNT
Definition:
tnt_array1d.h:36
TNT::hypot
Real hypot(const Real &a, const Real &b)
Definition:
tnt_math_utils.h:18
essentia::Real
float Real
Definition:
types.h:69
src
essentia
utils
tnt
tnt_math_utils.h
Generated on Wed Jun 5 2024 10:48:01 for Essentia by
1.9.1