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 {
template <class Functional>
void descentMinimisation(Functional const &J,
typename Functional::SmallVector &x,
typename Functional::SmallVector const &descDir,
typename Functional::SmallVector const &v,
Bisection const &bisection) {
using SmallVector = typename Functional::SmallVector;
using LocalNonlinearityType = typename Functional::NonlinearityType;
......@@ -27,15 +27,15 @@ void descentMinimisation(Functional const &J,
since A is symmetric.
*/
SmallVector tmp = J.b; // b
J.A.mmv(x, tmp); // b-Au
double const JRestb = tmp * descDir; // <b-Au,v>
SmallVector tmp = J.b; // b
J.A.mmv(x, tmp); // b-Au
double const JRestb = tmp * v; // <b-Au,v>
J.A.mv(descDir, tmp); // Av
double const JRestA = tmp * descDir; // <Av,v>
J.A.mv(v, tmp); // Av
double const JRestA = tmp * v; // <Av,v>
MyDirectionalConvexFunction<LocalNonlinearityType> const JRest(
JRestA, JRestb, *J.phi, x, descDir);
MyDirectionalConvexFunction<LocalNonlinearityType> const JRest(JRestA, JRestb,
*J.phi, x, v);
// }}}
{ // Debug
......@@ -66,7 +66,7 @@ void descentMinimisation(Functional const &J,
<< std::endl;
;
x.axpy(stepsize, descDir);
x.axpy(stepsize, v);
}
template <class Functional>
......@@ -75,14 +75,14 @@ void minimise(Functional const &J, typename Functional::SmallVector &x,
using SmallVector = typename Functional::SmallVector;
for (size_t step = 0; step < steps; ++step) {
SmallVector descDir;
J.gradient(x, descDir);
descDir *= -1;
SmallVector v;
J.gradient(x, v);
v *= -1;
if (descDir.two_norm() < 1e-14) // TODO: Make controllable
if (v.two_norm() < 1e-14) // TODO: Make controllable
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.
Finish editing this message first!
Please register or to comment