Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
1b0a7a92
Commit
1b0a7a92
authored
Jul 02, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved negate_function() to a different file to avoid an #include ordering bug
that happened when using find_max_single_variable().
parent
53aff1c8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
37 deletions
+37
-37
optimization.h
dlib/optimization/optimization.h
+0
-21
optimization_abstract.h
dlib/optimization/optimization_abstract.h
+0
-16
optimization_line_search.h
dlib/optimization/optimization_line_search.h
+21
-0
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
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
>
...
...
dlib/optimization/optimization_abstract.h
View file @
1b0a7a92
...
...
@@ -68,22 +68,6 @@ namespace dlib
- 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
<
...
...
dlib/optimization/optimization_line_search.h
View file @
1b0a7a92
...
...
@@ -807,6 +807,27 @@ namespace dlib
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
>
...
...
dlib/optimization/optimization_line_search_abstract.h
View file @
1b0a7a92
...
...
@@ -249,6 +249,22 @@ namespace dlib
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
;
...
...
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