Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How does Math::GSL accept data?

by etj (Curate)
on Jun 03, 2022 at 21:52 UTC ( [id://11144375]=note: print w/replies, xml ) Need Help??


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

gsl_histogram is currently not part of the PDL GSL bindings. 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. Pull requests to rectify any or all of those would be most welcome!

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

    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>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11144375]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-06-13 14:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.