Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
miscmaths
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
miscmaths
Commits
897d824e
Commit
897d824e
authored
21 years ago
by
Mark Woolrich
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
eeedb54a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
minimize.cc
+1
-1
1 addition, 1 deletion
minimize.cc
minimize.h
+5
-4
5 additions, 4 deletions
minimize.h
with
6 additions
and
5 deletions
minimize.cc
+
1
−
1
View file @
897d824e
...
...
@@ -193,7 +193,7 @@ ReturnMatrix hessian(const ColumnVector& x, const EvalFunction& func, float h,in
}
void
min
imize
(
ColumnVector
&
x
,
const
EvalFunction
&
func
){
void
f
min
search
(
ColumnVector
&
x
,
const
EvalFunction
&
func
){
//perform generic function minimization without gradient info
int
n
=
x
.
Nrows
(),
maxiter
=
200
*
n
,
iter
=
0
;
int
func_evals
=
0
;
...
...
This diff is collapsed.
Click to expand it.
minimize.h
+
5
−
4
View file @
897d824e
...
...
@@ -42,7 +42,7 @@ public:
};
class
EvalFunction
{
//Function where gradient is not analytic (or you are too lazy to work it out)
{
//Function where gradient is not analytic (or you are too lazy to work it out)
(required for fminsearch)
public:
EvalFunction
(){}
virtual
float
evaluate
(
const
ColumnVector
&
x
)
const
=
0
;
//evaluate the function
...
...
@@ -56,11 +56,12 @@ private:
class
gEvalFunction
:
public
EvalFunction
{
//Function where gradient is analytic (required for scg)
public:
gEvalFunction
()
:
EvalFunction
(){}
// evaluate is inherited from EvalFunction
// virtual float evaluate(const ColumnVector& x) const = 0; //evaluate the function
virtual
ColumnVector
g_evaluate
(
const
ColumnVector
&
x
)
const
=
0
;
//evaluate the gradient
virtual
ReturnMatrix
g_evaluate
(
const
ColumnVector
&
x
)
const
=
0
;
//evaluate the gradient
virtual
~
gEvalFunction
(){};
private
:
...
...
@@ -80,8 +81,8 @@ ReturnMatrix gradient(const ColumnVector& x, const EvalFunction& func,float h,in
ReturnMatrix
hessian
(
const
ColumnVector
&
x
,
const
EvalFunction
&
func
,
float
h
,
int
errorord
=
4
);
// finite diff hessian
void
fminsearch
(
ColumnVector
&
x
,
const
EvalFunction
&
func
);
void
minimize
(
ColumnVector
&
x
,
const
EvalFunction
&
func
);
void
scg
(
ColumnVector
&
x
,
const
gEvalFunction
&
func
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment