From e315f9ff54bfac1375d086c975d133c01308ccba Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Mon, 31 Oct 2011 14:41:08 +0100 Subject: [PATCH] Clean up qualifiers --- src/samplefunctional.hh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/samplefunctional.hh b/src/samplefunctional.hh index 1f5c409e..a32e9664 100644 --- a/src/samplefunctional.hh +++ b/src/samplefunctional.hh @@ -26,7 +26,7 @@ template <int dim> class SampleFunctional { MyNonlinearity<dim> const &phi) : A(A), b(b), phi(phi) {} - double operator()(const SmallVector v) const { + double operator()(SmallVector const v) const { SmallVector y; A.mv(v, y); // y = Av y /= 2; // y = 1/2 Av @@ -34,7 +34,7 @@ template <int dim> class SampleFunctional { return y * v + phi(v); // <1/2 Av - b,v> + H(|v|) } - void descentDirection(const SmallVector x, SmallVector &ret) const { + void descentDirection(SmallVector const x, SmallVector &ret) const { // Check the squared norm rather than each component because // negative_projection() divides by it if (x.two_norm2() == 0.0) { @@ -87,21 +87,21 @@ template <int dim> class SampleFunctional { private: // Gradient of the smooth part - SmallVector smoothGradient(const SmallVector x) const { + SmallVector smoothGradient(SmallVector const x) const { SmallVector y; A.mv(x, y); // y = Av y -= b; // y = Av - b return y; } - SmallVector upperGradient(const SmallVector x) const { + SmallVector upperGradient(SmallVector const x) const { SmallVector y; phi.upperGradient(x, y); y += smoothGradient(x); return y; } - SmallVector lowerGradient(const SmallVector x) const { + SmallVector lowerGradient(SmallVector const x) const { SmallVector y; phi.lowerGradient(x, y); y += smoothGradient(x); @@ -109,8 +109,8 @@ template <int dim> class SampleFunctional { } // No normalising is done! - SmallVector negative_projection(const SmallVector z, - const SmallVector x) const { + SmallVector negative_projection(SmallVector const z, + SmallVector const x) const { SmallVector y = z; y.axpy(-(z * x) / x.two_norm2(), x); return y; @@ -118,7 +118,7 @@ template <int dim> class SampleFunctional { }; template <class Functional> -void minimise(const Functional J, typename Functional::SmallVector &x, +void minimise(Functional const J, typename Functional::SmallVector &x, size_t steps = 1, Bisection const &bisection = Bisection(0.0, // acceptError: Stop if the search interval has -- GitLab