Skip to content

Commit fcaddee

Browse files
committed
Add native implementions for Poisson's cdf-like functions
1 parent eb980aa commit fcaddee

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/distrs/pois.jl

+13-6
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,25 @@
33
import .RFunctions:
44
# poispdf,
55
# poislogpdf,
6-
poiscdf,
7-
poisccdf,
8-
poislogcdf,
9-
poislogccdf,
6+
# poiscdf,
7+
# poisccdf,
8+
# poislogcdf,
9+
# poislogccdf,
1010
poisinvcdf,
1111
poisinvccdf,
1212
poisinvlogcdf,
1313
poisinvlogccdf
1414

15-
# generic versions
1615
poispdf::Real, x::Real) = exp(poislogpdf(λ, x))
1716

1817
poislogpdf::T, x::T) where {T <: Real} = xlogy(x, λ) - λ - loggamma(x + 1)
19-
2018
poislogpdf::Real, x::Real) = poislogpdf(promote(float(λ), x)...)
19+
20+
# Just use the Gamma definitions
21+
poiscdf::Real, x::Real) = gammaccdf(floor(x + 1), 1, λ)
22+
23+
poisccdf::Real, x::Real) = gammacdf(floor(x + 1), 1, λ)
24+
25+
poislogcdf::Real, x::Real) = gammalogccdf(floor(x + 1), 1, λ)
26+
27+
poislogccdf::Real, x::Real) = gammalogcdf(floor(x + 1), 1, λ)

0 commit comments

Comments
 (0)