pygeo icon indicating copy to clipboard operation
pygeo copied to clipboard

Colinearity and PlanarityConstraint derivatives incorrect for exactly zero input values

Open bbrelje opened this issue 5 years ago • 1 comments

Description

The way the Colinearity and PlanarityConstraints compute derivatives causes incorrect / spurious nonzero derivative values to appear if inputs (e.g. points, axes) contain true zero values.

The problem is this line which appears in two places in DVConstraints /(2.0*numpy.sqrt(tmpX[i]))

Steps to reproduce issue

Turn derivative checking back on in test_DVConstraints tests 9 and 13b. It is currently turned off in the baseline case because the derivatives will contain different values depending on whether pyspline is compiled using Intel or GCC (produces near-zero floats in different places which causes the derivatives to be different)

Proposed fix

Instead of checking whether tmpX is exactly zero, check if it is nearly zero to within some tol Or deprecate these constraints if nobody is using them.

bbrelje avatar Oct 25 '20 22:10 bbrelje

Tests 9 and 13b currently fail finite difference checks

bbrelje avatar Oct 27 '20 19:10 bbrelje