mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Fixed a bug, the initial step size wasn't being used in part of the
code. Also made the initial bracketing step a little more efficient.
This commit is contained in:
parent
3e9f7adbd9
commit
fa43cde658
@ -599,8 +599,8 @@ namespace dlib
|
|||||||
|
|
||||||
|
|
||||||
// The first thing we do is get a starting set of 3 points that are inside the [begin,end] bounds
|
// The first thing we do is get a starting set of 3 points that are inside the [begin,end] bounds
|
||||||
p1 = max(starting_point-1, begin);
|
p1 = max(starting_point-search_radius, begin);
|
||||||
p3 = min(starting_point+1, end);
|
p3 = min(starting_point+search_radius, end);
|
||||||
f1 = f(p1);
|
f1 = f(p1);
|
||||||
f3 = f(p3);
|
f3 = f(p3);
|
||||||
|
|
||||||
@ -647,15 +647,16 @@ namespace dlib
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the left most points are identical in function value then expand out the
|
// If the left most points are identical in function value then expand out the
|
||||||
// left a bit, unless it's already at bound.
|
// left a bit, unless it's already at bound or we would drop that left most
|
||||||
if (f1==f2 && f1!=begin)
|
// point anyway because it's bad.
|
||||||
|
if (f1==f2 && f1<f3 && f1!=begin)
|
||||||
{
|
{
|
||||||
p1 = max(p1 - search_radius, begin);
|
p1 = max(p1 - search_radius, begin);
|
||||||
f1 = f(p1);
|
f1 = f(p1);
|
||||||
search_radius *= 2;
|
search_radius *= 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (f2==f3 && f3!=end)
|
if (f2==f3 && f3<f1 && f3!=end)
|
||||||
{
|
{
|
||||||
p3 = min(p3 + search_radius, end);
|
p3 = min(p3 + search_radius, end);
|
||||||
f3 = f(p3);
|
f3 = f(p3);
|
||||||
|
Loading…
Reference in New Issue
Block a user