Skip to content

Sparse version of the sampler #23

@ameligrana

Description

@ameligrana

Our sampler doesn't support sparse indices

julia> using DynamicDiscreteSamplers

julia> ds = DynamicDiscreteSampler();

julia> push!(ds, 10^10, 1.0)
ERROR: OutOfMemoryError()
Stacktrace:
 [1] GenericMemory
   @ ./boot.jl:516 [inlined]
 [2] array_new_memory
   @ ./array.jl:1058 [inlined]
 [3] (::Base.var"#133#134"{Vector{Tuple{}}, Int64, Int64, Int64, Int64, Int64, Memory{Tuple{}}, MemoryRef{Tuple{}}})()
   @ Base ./array.jl:1129
 [4] _growend!
   @ ./array.jl:1116 [inlined]
 [5] resize!
   @ ./array.jl:1450 [inlined]
 [6] push!(ns::DynamicDiscreteSamplers.NestedSampler5{64}, i::Int64, x::Float64)
   @ DynamicDiscreteSamplers ~/.julia/dev/DynamicDiscreteSamplers/src/DynamicDiscreteSamplers.jl:407
 [7] top-level scope
   @ REPL[3]:1
Some type information was truncated. Use `show(err)` to see complete types.

I propose to add it with a keyword, like DynamicDiscreteSampler(; sparse=false/true) because supporting it by default would cause overhead

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions