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 { ...@@ -58,12 +58,7 @@ template <int dimension> class SampleFunctional {
SmallVector const mg = lowerGradient(x); SmallVector const mg = lowerGradient(x);
double const pgx = pg * x; double const pgx = pg * x;
double const mgx = mg * x; double const mgx = mg * x;
// TODO: collinearity checks suck if (pgx >= 0 && mgx >= 0) {
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) {
ret = pg; ret = pg;
dverb << "## Directional derivative (as per scalar product w/ " dverb << "## Directional derivative (as per scalar product w/ "
"semigradient): " << -(ret * mg) "semigradient): " << -(ret * mg)
...@@ -74,6 +69,8 @@ template <int dimension> class SampleFunctional { ...@@ -74,6 +69,8 @@ template <int dimension> class SampleFunctional {
"semigradient): " << -(ret * pg) "semigradient): " << -(ret * pg)
<< " (coordinates of the restriction)" << std::endl; << " (coordinates of the restriction)" << std::endl;
} else { } 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); ret = negative_projection(smoothGradient(x), x);
dverb << "## Directional derivative (as per scalar product w/ " dverb << "## Directional derivative (as per scalar product w/ "
"semigradient): " << -(ret * ret) "semigradient): " << -(ret * ret)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment