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

A_ -> A, b_ -> b

parent 09133b90
No related branches found
No related tags found
No related merge requests found
...@@ -20,13 +20,13 @@ class SampleFunctional { ...@@ -20,13 +20,13 @@ class SampleFunctional {
typedef Dune::FieldMatrix<double, dimension, dimension> SmallMatrix; typedef Dune::FieldMatrix<double, dimension, dimension> SmallMatrix;
typedef Function FunctionType; typedef Function FunctionType;
SampleFunctional(SmallMatrix A, SmallVector b) : A_(A), b_(b), func_() {} SampleFunctional(SmallMatrix _A, SmallVector _b) : A(_A), b(_b), func_() {}
double operator()(const SmallVector v) const { double operator()(const SmallVector v) const {
SmallVector y; SmallVector y;
A_.mv(v, y); // y = Av A.mv(v, y); // y = Av
y /= 2; // y = 1/2 Av y /= 2; // y = 1/2 Av
y -= b_; // y = 1/2 Av - b y -= b; // y = 1/2 Av - b
return y * v + func_(v.two_norm()); // <1/2 Av - b,v> + H(|v|) return y * v + func_(v.two_norm()); // <1/2 Av - b,v> + H(|v|)
} }
...@@ -60,8 +60,8 @@ class SampleFunctional { ...@@ -60,8 +60,8 @@ class SampleFunctional {
return ret; return ret;
} }
SmallMatrix A_; SmallMatrix A;
SmallVector b_; SmallVector b;
private: private:
Function func_; Function func_;
...@@ -69,8 +69,8 @@ class SampleFunctional { ...@@ -69,8 +69,8 @@ class SampleFunctional {
// Gradient of the smooth part // Gradient of the smooth part
SmallVector SmoothGrad(const SmallVector x) const { SmallVector SmoothGrad(const SmallVector x) const {
SmallVector y; SmallVector y;
A_.mv(x, y); // y = Av A.mv(x, y); // y = Av
y -= b_; // y = Av - b y -= b; // y = Av - b
return y; return y;
} }
...@@ -112,11 +112,11 @@ typename Functional::SmallVector minimise( ...@@ -112,11 +112,11 @@ typename Functional::SmallVector minimise(
*/ */
typename Functional::SmallVector tmp; typename Functional::SmallVector tmp;
J.A_.mv(descDir, tmp); // Av J.A.mv(descDir, tmp); // Av
double const rest_A = tmp * descDir; // <Av,v> double const rest_A = tmp * descDir; // <Av,v>
J.A_.mv(x, tmp); // Au J.A.mv(x, tmp); // Au
double const rest_b = (J.b_ - tmp) * descDir; // <b-Au,v> double const rest_b = (J.b - tmp) * descDir; // <b-Au,v>
typedef MyNonlinearity<Functional::SmallVector::dimension, typedef MyNonlinearity<Functional::SmallVector::dimension,
typename Functional::FunctionType> MyNonlinearityType; typename Functional::FunctionType> MyNonlinearityType;
......
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