Reject non-invertible volume affines - #445
Conversation
|
Hi @yinkev I am not really sure I understand the problem here. Can you help me understand it? It has been a while since I learnt linear algebra, so I might be wrong in parts of the following. I understand that the scale factors should be finite, and that is not currently checked for. However, I think a scale factor of 0.0 in any column would be caught by the current orthogonality check anyway so a further check for zero scale factors seems unnecessary (am I wrong about this?). This leaves only the infinite scale factor case, which is an unlikely situation to encounter in real code, though it may make sense to add a check for it. But couldn't it more easily be checked for by checking that all elements in the input matrix are finite? The rank-deficient part escapes me. I'm fairly sure a rank-deficient square matrix is always non-orthogonal, and we are already testing the matrix for non-orthogonality. If that test is functioning correctly, I don't see any need to add a further test for rank deficiency. Are you saying that the existing non-orthogonality test (in What am I missing? |
|
I went back through the exact call path. You're right that the fix belongs in The key detail is that I agree the extra rank and inverse checks around Thanks for catching the design issue. |
Signed-off-by: kyinhub <kevinpyin@gmail.com>
a14b4b4 to
b6e6917
Compare
|
Updated this to fix |
|
Thank you @yinkev for your help finding and fixing this and the other recent bugs I will put out a patch release (v0.28.1) with all these fixes |
Closes #440.
Summary
_is_matrix_orthogonal()helperVolumeandVolumeGeometryRoot cause
When
require_unit=False,_is_matrix_orthogonal()compared the unnormalized Gram matrix against the diagonal matrix of squared column norms using an absolute tolerance. A zero column passed exactly, while a sufficiently small dependent column passed because its off-diagonal dot product fell below that tolerance.The fix normalizes each nonzero finite column before comparing directions. This removes the scale dependence without adding separate rank or inverse checks in
_VolumeBase.Validation
upstream/master: 4 failed, 3 passedtests/test_spatial.pyandtests/test_volume.py: 252 passedgit diff --check