Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
37d17745
Commit
37d17745
authored
May 24, 2013
by
Davis King
Browse files
Added missing dlib namespace
parent
d93a02e8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
71 deletions
+79
-71
dlib/numerical_integration/integrate_function_adapt_simpson.h
.../numerical_integration/integrate_function_adapt_simpson.h
+53
-50
dlib/numerical_integration/integrate_function_adapt_simpson_abstract.h
...l_integration/integrate_function_adapt_simpson_abstract.h
+26
-21
No files found.
dlib/numerical_integration/integrate_function_adapt_simpson.h
View file @
37d17745
...
@@ -7,9 +7,11 @@
...
@@ -7,9 +7,11 @@
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
T
,
typename
funct
>
namespace
dlib
T
impl_adapt_simp_stop
(
const
funct
&
f
,
T
a
,
T
b
,
T
fa
,
T
fm
,
T
fb
,
T
is
,
int
cnt
)
{
{
template
<
typename
T
,
typename
funct
>
T
impl_adapt_simp_stop
(
const
funct
&
f
,
T
a
,
T
b
,
T
fa
,
T
fm
,
T
fb
,
T
is
,
int
cnt
)
{
const
int
MAXINT
=
500
;
const
int
MAXINT
=
500
;
T
m
=
(
a
+
b
)
/
2.0
;
T
m
=
(
a
+
b
)
/
2.0
;
...
@@ -37,18 +39,18 @@ T impl_adapt_simp_stop(const funct& f, T a, T b, T fa, T fm, T fb, T is, int cnt
...
@@ -37,18 +39,18 @@ T impl_adapt_simp_stop(const funct& f, T a, T b, T fa, T fm, T fb, T is, int cnt
}
}
return
Q
;
return
Q
;
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
T
,
typename
funct
>
template
<
typename
T
,
typename
funct
>
T
integrate_function_adapt_simp
(
T
integrate_function_adapt_simp
(
const
funct
&
f
,
const
funct
&
f
,
T
a
,
T
a
,
T
b
,
T
b
,
T
tol
=
1e-10
T
tol
=
1e-10
)
)
{
{
T
eps
=
std
::
numeric_limits
<
T
>::
epsilon
();
T
eps
=
std
::
numeric_limits
<
T
>::
epsilon
();
if
(
tol
<
eps
)
if
(
tol
<
eps
)
{
{
...
@@ -73,6 +75,7 @@ T integrate_function_adapt_simp(
...
@@ -73,6 +75,7 @@ T integrate_function_adapt_simp(
int
cnt
=
0
;
int
cnt
=
0
;
return
impl_adapt_simp_stop
(
f
,
a
,
b
,
fa
,
fm
,
fb
,
is
,
cnt
);
return
impl_adapt_simp_stop
(
f
,
a
,
b
,
fa
,
fm
,
fb
,
is
,
cnt
);
}
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
dlib/numerical_integration/integrate_function_adapt_simpson_abstract.h
View file @
37d17745
...
@@ -3,14 +3,17 @@
...
@@ -3,14 +3,17 @@
#undef DLIB_INTEGRATE_FUNCTION_ADAPT_SIMPSON_ABSTRACT__
#undef DLIB_INTEGRATE_FUNCTION_ADAPT_SIMPSON_ABSTRACT__
#ifdef DLIB_INTEGRATE_FUNCTION_ADAPT_SIMPSON_ABSTRACT__
#ifdef DLIB_INTEGRATE_FUNCTION_ADAPT_SIMPSON_ABSTRACT__
template
<
typename
T
,
typename
funct
>
namespace
dlib
T
integrate_function_adapt_simp
(
{
template
<
typename
T
,
typename
funct
>
T
integrate_function_adapt_simp
(
const
funct
&
f
,
const
funct
&
f
,
T
a
,
T
a
,
T
b
,
T
b
,
T
tol
=
1e-10
T
tol
=
1e-10
);
);
/*!
/*!
requires
requires
- b > a
- b > a
- tol > 0
- tol > 0
...
@@ -21,9 +24,11 @@ T integrate_function_adapt_simp(
...
@@ -21,9 +24,11 @@ T integrate_function_adapt_simp(
- returns an approximation of the integral of f over the domain [a,b] using the
- returns an approximation of the integral of f over the domain [a,b] using the
adaptive Simpson method outlined in Gander, W. and W. Gautshi, "Adaptive
adaptive Simpson method outlined in Gander, W. and W. Gautshi, "Adaptive
Quadrature -- Revisited" BIT, Vol. 40, (2000), pp.84-101
Quadrature -- Revisited" BIT, Vol. 40, (2000), pp.84-101
- tol is a tolerance parameter that determines the overall accuracy of approximated
- tol is a tolerance parameter that determines the overall accuracy of
integral. We suggest a default value of 1e-10 for tol.
approximated integral. We suggest a default value of 1e-10 for tol.
!*/
!*/
}
#endif // DLIB_INTEGRATE_FUNCTION_ADAPT_SIMPSON__
#endif // DLIB_INTEGRATE_FUNCTION_ADAPT_SIMPSON__
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment