Skip to content
Snippets Groups Projects
Commit f9c9e264 authored by Sander, Oliver's avatar Sander, Oliver
Browse files

Move norm computation out of a loop

parent 7584df4c
No related branches found
No related tags found
No related merge requests found
......@@ -413,10 +413,13 @@ public:
static DerivativeOfProjection derivativeOfProjection(const Dune::FieldVector<T,N>& p)
{
auto normSquared = p.two_norm2();
auto norm = std::sqrt(normSquared);
Dune::FieldMatrix<T,N,N> result;
for (int i=0; i<N; i++)
for (int j=0; j<N; j++)
result[i][j] = ( (i==j) - p[i]*p[j] / p.two_norm2() ) / p.two_norm();
result[i][j] = ( (i==j) - p[i]*p[j] / normSquared ) / norm;
return result;
}
......
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