Open yurivish opened 3 years ago
Are there any uses of inbounds left after this PR, @itsdebartha?
@ParadaCarleton Yes, there are still some uses of inbounds in categorical
, discretenonparametric
and poissonbinomial
for the univariates
. They are a bit tricky to tackle...
There are many incorrect uses of
@inbounds
in this package, leading to incorrect results when fitting distributions and doing other calculations on arrays with offset axes.I came across this issue previously with
DiscreteUniform
but did not realize how widespread the problem was until I ran a search for@inbounds
across the code in this package.Many uses of
@inbounds
in this package are in functions that accept arbitrary abstract vectors, matrices, or arrays, then disable bounds checks and index into the array with unsafe one-based indices.One example is fitting a Normal distribution:
https://github.com/JuliaStats/Distributions.jl/blob/863844c88e4153af13996f571fcc612d159de542/src/univariate/continuous/normal.jl#L254-L271