Skip to content

User option to set type parameter of LogBinner #6

@carstenbauer

Description

@carstenbauer

Currently we use a heuristic to select an appropriate type. In case this isn't what the user wants, he should be able to set the type manually.

Heuristic:
"If I get a type <: Real then make x_sum etc. take Float64 and if I get <: Complex then make x_sum store ComplexF64 values. Although not strictly valid it should handle most practical cases."

Why is it necessary? (taken from old issue)

Try creating a binner with zero(Int64) and add more than one element. This will fail because the averaging of the first compressor, 0.5 * (C.value + value), will produce a Float64 and there is no method push! for Float64 for this binner.

Maybe check in push! whether one is pushing to the first level. If yes, only allow values of type T, otherwise allow any type. We should be the only ones pushing to higher levels anyway, so probably we should rename push! (with a level argument) to _push! to avoid exporting it.

However, this won't solve it fully, as the problem propagates: from level 2 on, x_sum and x2_sum will get Float64s which they can't handle as they have eltype(x_sum) == Int64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions