[Bug ?] repeated wedge product causes weird out of bounds error
TsurHerman opened this issue · comments
Tsur commented
using Grassmann
using LinearAlgebra
@basis "1,1,1,0"
#plane in PGA3D
p(a,b,c,d) = a*v1+b*v2+c*v3+d*v4
p(rand(4)...) ∧ p(rand(4)...) ∧ p(rand(4)...)
ERROR: BoundsError: attempt to access (0.056553186254344245, 0.1745024077597439, 0.18635761649535065, 0.2928144966538575)
at index [5]
Tsur commented
probably related to some terms ending really close to zero but not exactly zero
Dream Scatter commented
Fixed the error just now on my laptop, but need to sort through some other uncommitted changes before I make a new commit.
Tsur commented
Another thing to consider is forcing exact zero on + and - operations even if it is approximately zero.
something along the lines of
-(A,B) = isapproax(A,B) ? 0 : A-B
to avoid numeric noise
Dream Scatter commented
The issue is now resolved in the newly released Grassmann
v0.7
julia> p(rand(4)...) ∧ p(rand(4)...) ∧ p(rand(4)...)
-0.15962007097893383v₁₂₃ + 0.42424099192478193v₁₂₄ - 0.039856749816011006v₁₃₄ - 0.598826026062381v₂₃₄