MultivariateStats.jl icon indicating copy to clipboard operation
MultivariateStats.jl copied to clipboard

ArgumentError: principal variance cannot exceed total variance. NaN > NaN

Open oxinabox opened this issue 8 years ago • 1 comments

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.

oxinabox avatar May 23 '16 04:05 oxinabox

Showing the values would be helpful. It would great if you could open a PR with your change.

andreasnoack avatar May 23 '16 23:05 andreasnoack