Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-tectonic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
podlesny
dune-tectonic
Commits
093c3102
Commit
093c3102
authored
11 years ago
by
Elias Pipping
Browse files
Options
Downloads
Patches
Plain Diff
[Cleanup] Refactor minimisation
parent
e95f0bd4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/tectonic/minimisation.hh
+11
-15
11 additions, 15 deletions
dune/tectonic/minimisation.hh
with
11 additions
and
15 deletions
dune/tectonic/minimisation.hh
+
11
−
15
View file @
093c3102
...
@@ -12,22 +12,16 @@
...
@@ -12,22 +12,16 @@
#include
"mydirectionalconvexfunction.hh"
#include
"mydirectionalconvexfunction.hh"
template
<
class
Functional
>
template
<
class
Functional
>
void
descentMinimisation
(
Functional
const
&
J
,
double
lineSearch
(
Functional
const
&
J
,
typename
Functional
::
LocalVector
&
x
,
typename
Functional
::
LocalVector
const
&
x
,
typename
Functional
::
LocalVector
const
&
v
,
typename
Functional
::
LocalVector
const
&
v
,
Bisection
const
&
bisection
)
{
Bisection
const
&
bisection
)
{
using
LocalVector
=
typename
Functional
::
LocalVector
;
MyDirectionalConvexFunction
<
typename
Functional
::
Nonlinearity
>
const
JRest
(
using
LocalNonlinearity
=
typename
Functional
::
Nonlinearity
;
MyDirectionalConvexFunction
<
LocalNonlinearity
>
const
JRest
(
computeDirectionalA
(
J
.
A
,
v
),
computeDirectionalb
(
J
.
A
,
J
.
b
,
x
,
v
),
*
J
.
phi
,
computeDirectionalA
(
J
.
A
,
v
),
computeDirectionalb
(
J
.
A
,
J
.
b
,
x
,
v
),
*
J
.
phi
,
x
,
v
);
x
,
v
);
// }}}
int
count
;
int
count
;
double
const
stepsize
=
bisection
.
minimize
(
JRest
,
0.0
,
0.0
,
count
);
return
bisection
.
minimize
(
JRest
,
0.0
,
0.0
,
count
);
Arithmetic
::
addProduct
(
x
,
stepsize
,
v
);
}
}
template
<
class
Functional
>
template
<
class
Functional
>
...
@@ -38,12 +32,14 @@ void minimise(Functional const &J, typename Functional::LocalVector &x,
...
@@ -38,12 +32,14 @@ void minimise(Functional const &J, typename Functional::LocalVector &x,
for
(
size_t
step
=
0
;
step
<
steps
;
++
step
)
{
for
(
size_t
step
=
0
;
step
<
steps
;
++
step
)
{
LocalVector
v
;
LocalVector
v
;
J
.
gradient
(
x
,
v
);
J
.
gradient
(
x
,
v
);
if
(
v
.
two_norm
()
==
0.0
)
return
;
double
const
vnorm
=
v
.
two_norm
();
if
(
vnorm
<=
0.0
)
return
;
v
*=
-
1
;
v
*=
-
1
;
descentMinimisation
(
J
,
x
,
v
,
bisection
);
double
const
alpha
=
lineSearch
(
J
,
x
,
v
,
bisection
);
Arithmetic
::
addProduct
(
x
,
alpha
,
v
);
}
}
}
}
#endif
#endif
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