Hello everyone,
This is my first post so apologies in advance for any mistakes in the question format.
I have been trying to calculate an integral of two variables using dblquad. The function to be integrated contains units from Unitful and errors from MonteCarloMeasurements.
The following function:
using MultiQuad
using Unitful
using MonteCarloMeasurements
f(y, x) = y*x * (0.5 Β± 0.0001)
res = dblquad((y,x) -> f(y,x), 2u"MeV", 3u"MeV", 30u"eV", 50u"eV")
is an example which however generates the same error as my actual function:
ERROR: LoadError: setindex!() with non-isbitstype eltype is not supported by StaticArrays. Consider using SizedArray.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] setindex!(v::MVector{2, Particles{Float64, 2000}}, val::Particles{Float64, 2000}, i::Int64)
@ StaticArrays ~/.julia/packages/StaticArrays/oOCPP/src/MArray.jl:39
[3] (::HCubature.GenzMalik{2, Float64})(f::MultiQuad.var"#integrand#39"{MultiQuad.var"#arg2#38"{Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(MeV,), π^2 π π^-2, nothing}}, Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(MeV,), π^2 π π^-2, nothing}}, MultiQuad.var"#arg1#37"{var"#50#51", Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(eV,), π^2 π π^-2, nothing}}, Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(eV,), π^2 π π^-2, nothing}}}, Unitful.FreeUnits{(eV^2, MeV^2), π^8 π^4 π^-8, nothing}}}, a::SVector{2, Float64}, b::SVector{2, Float64}, norm::typeof(norm))
@ HCubature ~/.julia/packages/HCubature/ZIutt/src/genz-malik.jl:137
[4] hcubature_(f::MultiQuad.var"#integrand#39"{MultiQuad.var"#arg2#38"{Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(MeV,), π^2 π π^-2, nothing}}, Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(MeV,), π^2 π π^-2, nothing}}, MultiQuad.var"#arg1#37"{var"#50#51", Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(eV,), π^2 π π^-2, nothing}}, Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(eV,), π^2 π π^-2, nothing}}}, Unitful.FreeUnits{(eV^2, MeV^2), π^8 π^4 π^-8, nothing}}}, a::SVector{2, Float64}, b::SVector{2, Float64}, norm::typeof(norm), rtol_::Int64, atol::Int64, maxevals::Int64, initdiv::Int64, buf::Nothing)
@ HCubature ~/.julia/packages/HCubature/ZIutt/src/HCubature.jl:110
[5] hcubature_(f::Function, a::Vector{Int64}, b::Vector{Int64}, norm::Function, rtol::Int64, atol::Int64, maxevals::Int64, initdiv::Int64, buf::Nothing)
@ HCubature ~/.julia/packages/HCubature/ZIutt/src/HCubature.jl:179
[6] #hcubature#4
@ ~/.julia/packages/HCubature/ZIutt/src/HCubature.jl:235 [inlined]
[7] hcubature
@ ~/.julia/packages/HCubature/ZIutt/src/HCubature.jl:235 [inlined]
[8] _hcubature_wrapper_2D(arg::var"#50#51", x1::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(MeV,), π^2 π π^-2, nothing}}, x2::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(MeV,), π^2 π π^-2, nothing}}, y1::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(eV,), π^2 π π^-2, nothing}}, y2::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(eV,), π^2 π π^-2, nothing}}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ MultiQuad ~/.julia/packages/MultiQuad/IdgOj/src/MultiQuad.jl:380
[9] _hcubature_wrapper_2D(arg::Function, x1::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(MeV,), π^2 π π^-2, nothing}}, x2::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(MeV,), π^2 π π^-2, nothing}}, y1::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(eV,), π^2 π π^-2, nothing}}, y2::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(eV,), π^2 π π^-2, nothing}})
@ MultiQuad ~/.julia/packages/MultiQuad/IdgOj/src/MultiQuad.jl:366
[10] dblquad(arg::Function, x1::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(MeV,), π^2 π π^-2, nothing}}, x2::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(MeV,), π^2 π π^-2, nothing}}, y1::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(eV,), π^2 π π^-2, nothing}}, y2::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(eV,), π^2 π π^-2, nothing}}; method::Symbol, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ MultiQuad ~/.julia/packages/MultiQuad/IdgOj/src/MultiQuad.jl:453
[11] dblquad(arg::Function, x1::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(MeV,), π^2 π π^-2, nothing}}, x2::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(MeV,), π^2 π π^-2, nothing}}, y1::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(eV,), π^2 π π^-2, nothing}}, y2::Quantity{Int64, π^2 π π^-2, Unitful.FreeUnits{(eV,), π^2 π π^-2, nothing}})
@ MultiQuad ~/.julia/packages/MultiQuad/IdgOj/src/MultiQuad.jl:440
[12] top-level scope
@ ~/postdoc/G3/MC_CEvNS/scripts/reactor_cevns_events/reactor_cevns_events_v3.jl:139
[13] include(fname::String)
@ Base.MainInclude ./client.jl:478
[14] top-level scope
@ REPL[11]:1
Do you know if itβs possible to overcome this problem?
Thanks in advance