MultivariateStats.jl
MultivariateStats.jl copied to clipboard
ArgumentError: principal variance cannot exceed total variance. NaN > NaN
So I am debugging some mean code that seems to be sending values right to the exteme ends of the Float32 range.
I kept getting ArgumentError: principal variance cannot exceed total variance
on this line
So I enhanced it to be more informative on my local copy:
tpvar <= tvar || isapprox(tpvar,tvar) || throw(ArgumentError("principal variance cannot exceed total variance. $tpvar > $tvar"))
And I found out that both tpvar
and tvar
ended up at NaN.
Now how this happens is unknown to me (right now, but soon I will know, I hope).
But my point here is that this is the wrong error message. I suggest a NaN check should be added.
Showing the values would be helpful. It would great if you could open a PR with your change.