Sacado Package Browser (Single Doxygen Collection)
Version of the Day
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
Sacado_cmath.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Sacado Package
4
//
5
// Copyright 2006 NTESS and the Sacado contributors.
6
// SPDX-License-Identifier: LGPL-2.1-or-later
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef SACADO_CMATH_HPP
11
#define SACADO_CMATH_HPP
12
13
#include <cmath>
// for most math functions
14
#include "
Sacado_ConfigDefs.h
"
15
16
namespace
Sacado {
17
18
// Replacement for ternary operator, for scalar types that don't implement
19
// logical operations that return bool, e.g., a simd scalar type that returns
20
// a simd bool. Sacado overloaded operators use this internally when ever
21
// the ternary operator would be used. It can also be used by client code.
22
template
<
typename
Cond,
typename
T>
23
SACADO_INLINE_FUNCTION
24
T
if_then_else
(
const
Cond cond,
const
T
&
a
,
const
T
& b) {
25
return
cond ? a : b;
26
}
27
28
// Special version of sqrt(x) that avoids the NaN if x==0 in the derivative.
29
// The default implementation just calls the standard sqrt(x).
30
template
<
typename
T>
31
SACADO_INLINE_FUNCTION
32
T
safe_sqrt
(
const
T
&
x
) {
33
using
std::sqrt
;
34
return
sqrt
(x);
35
}
36
37
}
38
39
#endif // SACADO_CMATH_HPP
a
a
Definition:
Sacado_CacheFad_Ops.hpp:407
T
#define T
Definition:
Sacado_rad.hpp:553
Sacado::if_then_else
SACADO_INLINE_FUNCTION T if_then_else(const Cond cond, const T &a, const T &b)
Definition:
Sacado_cmath.hpp:24
sqrt
sqrt(expr.val())
x
int x
Definition:
gmock-matchers_test.cc:3775
Sacado::safe_sqrt
SACADO_INLINE_FUNCTION T safe_sqrt(const T &x)
Definition:
Sacado_cmath.hpp:32
Sacado_ConfigDefs.h
SACADO_INLINE_FUNCTION
#define SACADO_INLINE_FUNCTION
Definition:
Sacado_ConfigDefs.h:88
Generated on Thu Nov 21 2024 09:23:58 for Sacado Package Browser (Single Doxygen Collection) by
1.8.5