Skip to content
Snippets Groups Projects
Commit e391a7b2 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

rename: descDir -> v

parent a6f29d8a
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,7 @@ namespace Dune { ...@@ -14,7 +14,7 @@ namespace Dune {
template <class Functional> template <class Functional>
void descentMinimisation(Functional const &J, void descentMinimisation(Functional const &J,
typename Functional::SmallVector &x, typename Functional::SmallVector &x,
typename Functional::SmallVector const &descDir, typename Functional::SmallVector const &v,
Bisection const &bisection) { Bisection const &bisection) {
using SmallVector = typename Functional::SmallVector; using SmallVector = typename Functional::SmallVector;
using LocalNonlinearityType = typename Functional::NonlinearityType; using LocalNonlinearityType = typename Functional::NonlinearityType;
...@@ -27,15 +27,15 @@ void descentMinimisation(Functional const &J, ...@@ -27,15 +27,15 @@ void descentMinimisation(Functional const &J,
since A is symmetric. since A is symmetric.
*/ */
SmallVector tmp = J.b; // b SmallVector tmp = J.b; // b
J.A.mmv(x, tmp); // b-Au J.A.mmv(x, tmp); // b-Au
double const JRestb = tmp * descDir; // <b-Au,v> double const JRestb = tmp * v; // <b-Au,v>
J.A.mv(descDir, tmp); // Av J.A.mv(v, tmp); // Av
double const JRestA = tmp * descDir; // <Av,v> double const JRestA = tmp * v; // <Av,v>
MyDirectionalConvexFunction<LocalNonlinearityType> const JRest( MyDirectionalConvexFunction<LocalNonlinearityType> const JRest(JRestA, JRestb,
JRestA, JRestb, *J.phi, x, descDir); *J.phi, x, v);
// }}} // }}}
{ // Debug { // Debug
...@@ -66,7 +66,7 @@ void descentMinimisation(Functional const &J, ...@@ -66,7 +66,7 @@ void descentMinimisation(Functional const &J,
<< std::endl; << std::endl;
; ;
x.axpy(stepsize, descDir); x.axpy(stepsize, v);
} }
template <class Functional> template <class Functional>
...@@ -75,14 +75,14 @@ void minimise(Functional const &J, typename Functional::SmallVector &x, ...@@ -75,14 +75,14 @@ void minimise(Functional const &J, typename Functional::SmallVector &x,
using SmallVector = typename Functional::SmallVector; using SmallVector = typename Functional::SmallVector;
for (size_t step = 0; step < steps; ++step) { for (size_t step = 0; step < steps; ++step) {
SmallVector descDir; SmallVector v;
J.gradient(x, descDir); J.gradient(x, v);
descDir *= -1; v *= -1;
if (descDir.two_norm() < 1e-14) // TODO: Make controllable if (v.two_norm() < 1e-14) // TODO: Make controllable
return; return;
descentMinimisation(J, x, descDir, bisection); descentMinimisation(J, x, v, bisection);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment