From 29b23acf1f940c51765e421357343b549b0dc4c7 Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Thu, 14 Oct 2010 13:10:43 +0000 Subject: [PATCH] add mixed derivatives of the squared distance [[Imported from SVN: r6426]] --- dune/gfe/realtuple.hh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dune/gfe/realtuple.hh b/dune/gfe/realtuple.hh index c4abeed2..fc426780 100644 --- a/dune/gfe/realtuple.hh +++ b/dune/gfe/realtuple.hh @@ -86,6 +86,28 @@ public: return result; } + /** \brief Compute the mixed second derivate \partial d^2 / \partial da db + + Unlike the distance itself the squared distance is differentiable at zero + */ + static Dune::FieldMatrix<double,N,N> secondDerivativeOfDistanceSquaredWRTFirstAndSecondArgument(const RealTuple& a, const RealTuple& b) { + + Dune::FieldMatrix<double,N,N> result; + for (int i=0; i<N; i++) + for (int j=0; j<N; j++) + result[i][j] = -2*(i==j); + + return result; + } + + /** \brief Compute the mixed third derivative \partial d^3 / \partial da db^2 + + The result is the constant zero-tensor. + */ + static Tensor3<double,N,N,N> thirdDerivativeOfDistanceSquaredWRTFirst1AndSecond2Argument(const RealTuple& a, const RealTuple& b) { + return Tensor3<double,N,N,N>(0); + } + /** \brief Project tangent vector of R^n onto the tangent space */ EmbeddedTangentVector projectOntoTangentSpace(const EmbeddedTangentVector& v) const { return v; -- GitLab