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

Ignore the nonlinearity in CircularConvexFunctions

parent 65f4e7bd
No related branches found
No related tags found
No related merge requests found
...@@ -5,17 +5,12 @@ ...@@ -5,17 +5,12 @@
#include <dune/fufem/interval.hh> #include <dune/fufem/interval.hh>
namespace Dune { namespace Dune {
template <class NonlinearityType> class CircularConvexFunction { template <class MatrixType, class VectorType> class CircularConvexFunction {
typedef typename NonlinearityType::VectorType VectorType;
typedef typename NonlinearityType::MatrixType MatrixType;
public: public:
CircularConvexFunction(MatrixType const &A, VectorType const &b, CircularConvexFunction(MatrixType const &A, VectorType const &b,
NonlinearityType const &phi, VectorType const &x, VectorType const &x, VectorType const &dir)
VectorType const &dir)
: A(A), : A(A),
b(b), b(b),
phi(phi),
x(x), x(x),
dir(dir), dir(dir),
xnorm(x.two_norm()), xnorm(x.two_norm()),
...@@ -31,14 +26,11 @@ template <class NonlinearityType> class CircularConvexFunction { ...@@ -31,14 +26,11 @@ template <class NonlinearityType> class CircularConvexFunction {
VectorType t; VectorType t;
tangent(m, t); tangent(m, t);
phi.directionalSubDiff(x, t, D);
VectorType tmp; VectorType tmp;
A.mv(x, tmp); // Ax A.mv(x, tmp); // Ax
tmp -= b; // Ax - b tmp -= b; // Ax - b
double const dotp = tmp * t; // <Ax - b,t> double const dotp = tmp * t; // <Ax - b,t>
D[0] += dotp; D[0] = D[1] = dotp;
D[1] += dotp;
} }
void domain(Interval<double> &domain) const { void domain(Interval<double> &domain) const {
...@@ -55,7 +47,6 @@ template <class NonlinearityType> class CircularConvexFunction { ...@@ -55,7 +47,6 @@ template <class NonlinearityType> class CircularConvexFunction {
private: private:
MatrixType const &A; MatrixType const &A;
VectorType const &b; VectorType const &b;
NonlinearityType const &phi;
VectorType const &x; VectorType const &x;
VectorType const &dir; VectorType const &dir;
......
...@@ -196,11 +196,13 @@ void tangentialMinimisation(Functional const &J, ...@@ -196,11 +196,13 @@ void tangentialMinimisation(Functional const &J,
typename Functional::SmallVector &x, typename Functional::SmallVector &x,
typename Functional::SmallVector const &descDir, typename Functional::SmallVector const &descDir,
Bisection const &bisection) { Bisection const &bisection) {
typedef typename Functional::NonlinearityType LocalNonlinearityType; typedef typename Functional::SmallMatrix SmallMatrix;
typedef typename Functional::SmallVector SmallVector; typedef typename Functional::SmallVector SmallVector;
CircularConvexFunction<LocalNonlinearityType> const JRest(J.A, J.b, *J.phi, x, // We completely ignore the nonlinearity here -- when restricted
descDir); // to a circle, it just enters as a constant!
CircularConvexFunction<SmallMatrix, SmallVector> const JRest(J.A, J.b, x,
descDir);
int count; int count;
double const stepsize = bisection.minimize(JRest, 0.0, 1.0, count); double const stepsize = bisection.minimize(JRest, 0.0, 1.0, count);
......
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