http://www.perlmonks.org?node_id=11144491


in reply to Re: How does Math::GSL accept data?
in thread How does Math::GSL accept data?

I didn't investigate what's wrong with OP's code and how to use Math::GSL for the task, but

I would have expected either PDL::Basic's hist or PDL::NDBin to accommodate user-provided ranges, in line with your requirement, but it seems neither of them do.

I think you are wrong here, see Variable-width bins

pdl> p$data = pdl qw/ 1 3 25 1 5 1 3 1 2 2 3 3 3 25 1 1 5 2 4500 1 1 1 + 1 5 5 8 000 1 1 5 500 1 1 1 5 2 1 1 1000 1000 1000 1000 5000 1 25 60 +00 500 25 25 9000 1 1 5 1000 6000 25 10 5 5 5 5 1000 9540 1000 5 1 5 +500 2500 2 5 5 5/ [1 3 25 1 5 1 3 1 2 2 3 3 3 25 1 1 5 2 4500 1 1 1 1 5 5 8000 1 1 5 500 + 1 1 1 5 2 1 1 1000 1000 1000 1000 5000 1 25 6000 500 25 25 9000 1 1 +5 1000 6000 25 10 5 5 5 5 1000 9540 1000 5 1 5 500 2500 2 5 5 5] pdl> $binner = PDL::NDBin->new(axes=>[[x => grid => 10 ** sequence 6]] +) pdl> $binner->feed(x => $data) pdl> $binner->process pdl> p $binner->output->{histogram} [47 7 3 15 0] pdl>

Replies are listed 'Best First'.
Re^3: How does Math::GSL accept data?
by Anonymous Monk on Jun 07, 2022 at 22:15 UTC