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

Make phi visible to the outside

parent 2b2fd146
No related branches found
No related tags found
No related merge requests found
...@@ -26,10 +26,10 @@ class SampleFunctional { ...@@ -26,10 +26,10 @@ class SampleFunctional {
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 + phi_(v); // <1/2 Av - b,v> + H(|v|) return y * v + phi(v); // <1/2 Av - b,v> + H(|v|)
} }
void descentDirection(const SmallVector x, SmallVector &ret) const { void descentDirection(const SmallVector x, SmallVector &ret) const {
...@@ -38,7 +38,7 @@ class SampleFunctional { ...@@ -38,7 +38,7 @@ class SampleFunctional {
SmallVector const d = smoothGradient(x); SmallVector const d = smoothGradient(x);
Interval<double> D; Interval<double> D;
phi_.directionalSubDiff(x, d, D); phi.directionalSubDiff(x, d, D);
double const nonlinearDecline = D[1]; double const nonlinearDecline = D[1];
double const smoothDecline = -(d * d); double const smoothDecline = -(d * d);
double const combinedDecline = smoothDecline + nonlinearDecline; double const combinedDecline = smoothDecline + nonlinearDecline;
...@@ -82,10 +82,9 @@ class SampleFunctional { ...@@ -82,10 +82,9 @@ class SampleFunctional {
SmallMatrix A; SmallMatrix A;
SmallVector b; SmallVector b;
NonlinearityType phi;
private: private:
NonlinearityType phi_;
// Gradient of the smooth part // Gradient of the smooth part
SmallVector smoothGradient(const SmallVector x) const { SmallVector smoothGradient(const SmallVector x) const {
SmallVector y; SmallVector y;
...@@ -96,14 +95,14 @@ class SampleFunctional { ...@@ -96,14 +95,14 @@ class SampleFunctional {
SmallVector upperGradient(const SmallVector x) const { SmallVector upperGradient(const SmallVector x) const {
SmallVector y; SmallVector y;
phi_.upperGradient(x, y); phi.upperGradient(x, y);
y += smoothGradient(x); y += smoothGradient(x);
return y; return y;
} }
SmallVector lowerGradient(const SmallVector x) const { SmallVector lowerGradient(const SmallVector x) const {
SmallVector y; SmallVector y;
phi_.lowerGradient(x, y); phi.lowerGradient(x, y);
y += smoothGradient(x); y += smoothGradient(x);
return y; return y;
} }
......
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