Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hcubature not type stable #42

Closed
sharanry opened this issue Jun 23, 2022 · 2 comments
Closed

hcubature not type stable #42

sharanry opened this issue Jun 23, 2022 · 2 comments

Comments

@sharanry
Copy link

Related: SciML/Integrals.jl#65

using HCubature, Distributions, Test

μ = [0.00 , 0.00]
Σ = [0.4 0.0 ; 0.00 0.4]
d = MvNormal(μ , Σ)
f = (x) -> pdf(d, x)
lb, ub = [-1 , -1] , [1 , 1]
@inferred hcubature(f, lb, ub;
            maxevals=typemax(Int))
ERROR: return type Tuple{Float64, Float64} does not match inferred return type Tuple{Any, Any}
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] top-level scope
   @ REPL[7]:1
@sharanry
Copy link
Author

Calling with StaticArrays is sufficient to make the function call type stable.

@stevengj
Copy link
Member

Yes, or a tuple should work too.

Converting from a generic Array to an SVector cannot be type-stable because the length is not part of the type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants