Skip to content

pdf and rand do not work on Beta with Dual type parameters #541

Closed
@xukai92

Description

@xukai92

For example the following code fails:

using Distributions
using ForwardDiff: Dual
pdf(Beta(Dual(2.), Dual(2.)), 1)

Error:

ERROR: MethodError: `convert` has no method matching convert(::Type{Float64}, ::ForwardDiff.Dual{0,Float64})
This may have arisen from a call to the constructor Float64(...),
since type constructors fall back to convert methods.
Closest candidates are:
  call{T<:AbstractFloat}(::Type{T<:AbstractFloat}, ::Real, ::RoundingMode{T})
  call{T}(::Type{T}, ::Any)
  convert(::Type{Float64}, ::Int8)
  ...
 in pdf at /Users/kai/.julia/v0.4/Distributions/src/univariates.jl:320

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions