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

Do away with the collinearity check

parent d7fe70e4
No related branches found
No related tags found
No related merge requests found
......@@ -58,12 +58,7 @@ template <int dimension> class SampleFunctional {
SmallVector const mg = lowerGradient(x);
double const pgx = pg * x;
double const mgx = mg * x;
// TODO: collinearity checks suck
if (pgx == pg.two_norm() * x.two_norm() &&
-mgx == mg.two_norm() * x.two_norm()) {
ret = SmallVector(0.0);
return;
} else if (pgx >= 0 && mgx >= 0) {
if (pgx >= 0 && mgx >= 0) {
ret = pg;
dverb << "## Directional derivative (as per scalar product w/ "
"semigradient): " << -(ret * mg)
......@@ -74,6 +69,8 @@ template <int dimension> class SampleFunctional {
"semigradient): " << -(ret * pg)
<< " (coordinates of the restriction)" << std::endl;
} else {
// Includes the case that pg points in direction x and mg
// points in direction -x. The projection will then be zero.
ret = negative_projection(smoothGradient(x), x);
dverb << "## Directional derivative (as per scalar product w/ "
"semigradient): " << -(ret * ret)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment