Loading [MathJax]/extensions/TeX/newcommand.js
Reference documentation for deal.II version 9.2.0
\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}
\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}
\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}
\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}
Main Page
Tutorial
Code gallery
Modules
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
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
Variables
a
b
c
d
e
f
i
l
m
n
o
p
r
s
t
u
v
w
z
Typedefs
a
b
c
g
i
l
m
o
p
s
t
v
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
Classes
Class List
Class Index
Class Hierarchy
Class Members
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
z
~
Variables
_
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
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
v
w
Enumerations
a
b
c
d
e
f
g
i
m
o
p
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Related Functions
:
a
b
c
d
f
g
h
i
l
m
o
p
r
s
t
u
v
Related Pages
Files
File List
File Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
s
t
u
v
z
Variables
a
c
d
f
g
i
l
m
p
q
s
t
u
v
Typedefs
Enumerations
Enumerator
m
u
Macros
a
b
d
e
h
i
m
s
t
dealii.org
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
include
deal.II
differentiation
ad
sacado_math.h
Go to the documentation of this file.
1
// ---------------------------------------------------------------------
2
//
3
// Copyright (C) 2016 - 2018 by the deal.II authors
4
//
5
// This file is part of the deal.II library.
6
//
7
// The deal.II library is free software; you can use it, redistribute
8
// it, and/or modify it under the terms of the GNU Lesser General
9
// Public License as published by the Free Software Foundation; either
10
// version 2.1 of the License, or (at your option) any later version.
11
// The full text of the license can be found in the file LICENSE.md at
12
// the top level directory of deal.II.
13
//
14
// ---------------------------------------------------------------------
15
16
#ifndef dealii_differentiation_ad_sacado_math_h
17
#define dealii_differentiation_ad_sacado_math_h
18
19
#include <
deal.II/base/config.h
>
20
21
#ifdef DEAL_II_TRILINOS_WITH_SACADO
22
23
# include <
deal.II/base/numbers.h
>
24
25
# include <
deal.II/differentiation/ad/ad_number_traits.h
>
26
# include <
deal.II/differentiation/ad/sacado_number_types.h
>
27
28
29
# ifndef DOXYGEN
30
34
namespace
std
35
{
39
template
<
40
typename
ADNumberType,
41
typename
=
typename
std::enable_if<
42
::Differentiation::AD::is_sacado_number<ADNumberType>::value
&&
43
::Differentiation::AD::is_real_valued_ad_number
<
44
ADNumberType>
::value
>::type>
45
inline
ADNumberType
46
erf
(ADNumberType x)
47
{
48
// Reference:
49
// Handbook of Mathematical Functions: with Formulas, Graphs, and
50
// Mathematical Tables Abramowitz, M. and Stegun, I. Dover Books on
51
// Mathematics. 1972.
52
//
53
// Current implementation source:
54
// https://www.johndcook.com/blog/cpp_erf/
55
// https://www.johndcook.com/blog/2009/01/19/stand-alone-error-function-erf/
56
//
57
// Note: This implementation has a reported maximum round-off error
58
// of 1.5e-7.
59
60
// Constants
61
const
double
a1 = 0.254829592;
62
const
double
a2 = -0.284496736;
63
const
double
a3 = 1.421413741;
64
const
double
a4 = -1.453152027;
65
const
double
a5 = 1.061405429;
66
const
double
p = 0.3275911;
67
68
// Save the sign of x
69
const
bool
neg_val =
70
(
x < ::internal::NumberType<ADNumberType>::value
(0.0) ? true :
71
false
);
72
x =
std::fabs
(x);
73
74
// Abramowitz1972a equation 7.1.26
75
const
ADNumberType t = 1.0 / (1.0 + p * x);
76
const
ADNumberType y =
77
1.0 -
78
(((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * std::exp(-x * x);
79
80
if
(!neg_val)
81
return
y;
82
else
83
return
-y;
84
}
85
86
90
template
<
91
typename
ADNumberType,
92
typename
=
typename
std::enable_if<
93
::Differentiation::AD::is_sacado_number<ADNumberType>::value
>::type>
94
inline
ADNumberType
95
erfc
(
const
ADNumberType &x)
96
{
97
return
1.0 -
std::erf
(x);
98
}
99
100
}
// namespace std
101
102
# endif // DOXYGEN
103
104
#endif // DEAL_II_TRILINOS_WITH_SACADO
105
106
#endif
Differentiation::AD::is_sacado_number
Definition:
sacado_number_types.h:39
Differentiation::SD::erfc
Expression erfc(const Expression &x)
Definition:
symengine_math.cc:329
Differentiation::SD::erf
Expression erf(const Expression &x)
Definition:
symengine_math.cc:322
Differentiation::SD::fabs
Expression fabs(const Expression &x)
Definition:
symengine_math.cc:273
value
static const bool value
Definition:
dof_tools_constraints.cc:433
sacado_number_types.h
ad_number_traits.h
config.h
Differentiation::AD::is_real_valued_ad_number
Definition:
ad_number_traits.h:284
numbers.h
Generated by
1.8.17