You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In many method definitions arguments are typed as Number. For example, in src/distrs/chisq.jl
# pdf for numbers with generic typesfunctionchisqpdf(k::Real, x::Number)
hk = k /2# half k1/ (2^(hk) *gamma(hk)) * x^(hk -1) *exp(-x /2)
end# logpdf for numbers with generic typesfunctionchisqlogpdf(k::Real, x::Number)
hk = k /2# half k-hk *log(oftype(hk, 2)) -lgamma(hk) + (hk -1) *log(x) - x /2end
It appears that the only difference between Number and Real is that Number includes Complex
julia>subtypes(Number)
2-element Array{Union{DataType, UnionAll},1}:
Complex
Real
I don't see the purpose in allowing complex numbers in these cases. Any objection to my changing these to Real?
The text was updated successfully, but these errors were encountered:
I think many of these were relaxed at a time when we discussed the proper location in the type tree for dual numbers. Initially, they were not Real so to allow for autodiff, we relaxed the methods here to Number. Eventually, it was concluded that it was easier to make dual numbers Real so we can probably restrict most of the signatures again. However, I there might be a few specificity issues. In https://github.com/JuliaStats/StatsFuns.jl/pull/35/files we actually defined the promotion method for Number to avoid ambiguity issues.
In many method definitions arguments are typed as
Number
. For example, insrc/distrs/chisq.jl
It appears that the only difference between
Number
andReal
is thatNumber
includesComplex
I don't see the purpose in allowing complex numbers in these cases. Any objection to my changing these to
Real
?The text was updated successfully, but these errors were encountered: