Closed caetanotc closed 3 years ago
In the documentation, it says that both options can be used. Any ideas on why this is happening?
Both options can be used, but a tuple allows Julia's compiler to infer the length, whereas a vector does not. Internally, HCubature uses StaticArrays.jl for speed, but that means that a separate version of hcubature
is compiled for different dimensionalities of the integral, and using a non-inferable length means that dynamic dispatch is required.
There's nothing wrong with dynamic dispatch — since multidimensional integration is typically expensive, the overhead of dynamically determining the dimensionality and dispatching to the appropriate compiled version is probably low.
Hi, I noticed that I was getting a type instability when using
hcubature()
inside a function I created. I did some tests and that just happens when I use a vector fora
andb
, the same didn't happen with a tuple.Here is what I get from
@code_warntype
:In the documentation, it says that both options can be used. Any ideas on why this is happening?