dfm / c3k

1 stars 0 forks source link

bad denominator #1

Open davidwhogg opened 10 years ago

davidwhogg commented 10 years ago

What happens if

 m = 1. / (4 * a * b - c*c)

at https://github.com/dfm/c3k/blob/master/c3k.py#L20 gets really really large? That shit can happen.

davidwhogg commented 10 years ago

also why 4 and not 4.?

dfm commented 10 years ago

For part (a)... I'm not sure... thoughts?

For (b), there are 3 reasons: (1) it doesn't matter either way because we from __future__ import division, (2) as long as theres a 1. in the numerator, the denominator is always be cast up to a float, and (3) a, b, c, etc. will always be floats after the Cholesky solve.

davidwhogg commented 10 years ago

In principle you should check that (4. * a * b - c * c) is significantly different from zero. In practice, that costs 6 ** 3 time plus some shit. So I am not sure what to do. One option is to fail if the centroid ends up outside some "trust region" which could be

dx * dx + dy * dy < 1.