Oh wise monks!
I am trying to use
Math::GSL::histogram to construct an histogram with logarithmic bins. What I want to do is to read the data from an array or a PDL piddle. However, Math::GSL seems to require a "stream", i.e. a file to read data from. I tried to save my data to a file in several formats but I could not manage to get Math::GSL to read it. I am obviously doing something wrong and I will appreciate any hint from you!
Here is my code, it terminates with segment fault:
my $fo = gsl_fopen('myfile', 'w'); # sets the output file
my $fi = gsl_fopen( $input_stream ); # here is where I can't understan
+d how it works
my $h = gsl_histogram_alloc (5);
gsl_histogram_fscanf($fi, $h);
my $range = [ 1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0 ];
gsl_histogram_set_ranges($h, $range, 4);
gsl_histogram_fprintf($fo, $h, "%g", "%g");
gsl_fclose($fi);
gsl_fclose($fo);
Thanks in advance!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.