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
cea45407
Commit
cea45407
authored
Jul 02, 2014
by
Davis E. King
Browse files
Made find_min_single_variable() a little more efficient.
parent
fa43cde6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
dlib/optimization/optimization_line_search.h
dlib/optimization/optimization_line_search.h
+2
-2
No files found.
dlib/optimization/optimization_line_search.h
View file @
cea45407
...
@@ -666,7 +666,7 @@ namespace dlib
...
@@ -666,7 +666,7 @@ namespace dlib
// if f1 is small then take a step to the left
// if f1 is small then take a step to the left
if
(
f1
<
f3
)
if
(
f1
<
=
f3
)
{
{
// check if the minimum is butting up against the bounds and if so then pick
// check if the minimum is butting up against the bounds and if so then pick
// a point between p1 and p2 in the hopes that shrinking the interval will
// a point between p1 and p2 in the hopes that shrinking the interval will
...
@@ -769,7 +769,7 @@ namespace dlib
...
@@ -769,7 +769,7 @@ namespace dlib
// make sure one side of the bracket isn't super huge compared to the other
// make sure one side of the bracket isn't super huge compared to the other
// side. If it is then contract it.
// side. If it is then contract it.
const
double
bracket_ratio
=
abs
(
p1
-
p2
)
/
abs
(
p2
-
p3
);
const
double
bracket_ratio
=
abs
(
p1
-
p2
)
/
abs
(
p2
-
p3
);
if
(
!
(
bracket_ratio
<
10
0
&&
bracket_ratio
>
0.
0
1
)
)
if
(
!
(
bracket_ratio
<
10
&&
bracket_ratio
>
0.1
)
)
{
{
// Force p_min to be on a reasonable side. But only if lagrange_poly_min_extrap()
// Force p_min to be on a reasonable side. But only if lagrange_poly_min_extrap()
// didn't put it on a good side already.
// didn't put it on a good side already.
...
...
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