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
1b0a7a92
Commit
1b0a7a92
authored
Jul 01, 2014
by
Davis King
Browse files
Moved negate_function() to a different file to avoid an #include ordering bug
that happened when using find_max_single_variable().
parent
53aff1c8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
37 deletions
+37
-37
dlib/optimization/optimization.h
dlib/optimization/optimization.h
+0
-21
dlib/optimization/optimization_abstract.h
dlib/optimization/optimization_abstract.h
+0
-16
dlib/optimization/optimization_line_search.h
dlib/optimization/optimization_line_search.h
+21
-0
dlib/optimization/optimization_line_search_abstract.h
dlib/optimization/optimization_line_search_abstract.h
+16
-0
No files found.
dlib/optimization/optimization.h
View file @
1b0a7a92
...
@@ -102,27 +102,6 @@ namespace dlib
...
@@ -102,27 +102,6 @@ namespace dlib
return
central_differences
<
funct
>
(
f
,
eps
);
return
central_differences
<
funct
>
(
f
,
eps
);
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
funct
>
class
negate_function_object
{
public:
negate_function_object
(
const
funct
&
f_
)
:
f
(
f_
){}
template
<
typename
T
>
double
operator
()(
const
T
&
x
)
const
{
return
-
f
(
x
);
}
private:
const
funct
&
f
;
};
template
<
typename
funct
>
const
negate_function_object
<
funct
>
negate_function
(
const
funct
&
f
)
{
return
negate_function_object
<
funct
>
(
f
);
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
funct
,
typename
EXP1
,
typename
EXP2
>
template
<
typename
funct
,
typename
EXP1
,
typename
EXP2
>
...
...
dlib/optimization/optimization_abstract.h
View file @
1b0a7a92
...
@@ -68,22 +68,6 @@ namespace dlib
...
@@ -68,22 +68,6 @@ namespace dlib
- returns derivative(f, 1e-7)
- returns derivative(f, 1e-7)
!*/
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
funct
>
const
negate_function_object
<
funct
>
negate_function
(
const
funct
&
f
);
/*!
requires
- f == a function that returns a scalar
ensures
- returns a function that represents the negation of f. That is,
the returned function object represents g(x) == -f(x)
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
...
...
dlib/optimization/optimization_line_search.h
View file @
1b0a7a92
...
@@ -807,6 +807,27 @@ namespace dlib
...
@@ -807,6 +807,27 @@ namespace dlib
return
f2
;
return
f2
;
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
funct
>
class
negate_function_object
{
public:
negate_function_object
(
const
funct
&
f_
)
:
f
(
f_
){}
template
<
typename
T
>
double
operator
()(
const
T
&
x
)
const
{
return
-
f
(
x
);
}
private:
const
funct
&
f
;
};
template
<
typename
funct
>
const
negate_function_object
<
funct
>
negate_function
(
const
funct
&
f
)
{
return
negate_function_object
<
funct
>
(
f
);
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
funct
>
template
<
typename
funct
>
...
...
dlib/optimization/optimization_line_search_abstract.h
View file @
1b0a7a92
...
@@ -249,6 +249,22 @@ namespace dlib
...
@@ -249,6 +249,22 @@ namespace dlib
value from this function.
value from this function.
!*/
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
funct
>
const
negate_function_object
<
funct
>
negate_function
(
const
funct
&
f
);
/*!
requires
- f == a function that returns a scalar
ensures
- returns a function that represents the negation of f. That is,
the returned function object represents g(x) == -f(x)
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class
optimize_single_variable_failure
:
public
error
;
class
optimize_single_variable_failure
:
public
error
;
...
...
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