My Project
Loading...
Searching...
No Matches
tnt_math_utils.h
1
#ifndef MATH_UTILS_H
2
#define MATH_UTILS_H
3
4
5
/* needed for abs(), sqrt() below */
6
#include <cmath>
7
8
9
10
namespace
TNT
11
{
12
13
using namespace
std;
20
template
<
class
Real>
21
Real
hypot
(
const
Real
&
a
,
const
Real
&
b
)
22
{
23
24
if
(
a
== 0)
25
return
abs
(
b
);
26
else
27
{
28
Real
c
=
b
/
a
;
29
return
abs
(
a
) *
sqrt
(1 +
c
*
c
);
30
}
31
}
32
}
/* TNT namespace */
33
34
35
36
#endif
37
/* MATH_UTILS_H */
TNT::Array1D
Definition
tnt_array1d.h:40
TNT
Definition
tnt_array1d.h:36
TNT::hypot
Real hypot(const Real &a, const Real &b)
Definition
tnt_math_utils.h:21
Generated by
1.9.8