I messed operator precedence, and so result looks silly and not trustworthy
Oh, no worries - that happens. (I know ;-)
For me, irrespective of the values assigned in the script, both gsl-2.6 and gsl-2.7.1 produce the same results.
That would suggest that the problem lies with the recent versions of the gsl library.
But, of course, the way I built Math-GSL-0.43 against gsl-2.7.1 (along with the test failures) doesn't inspire complete confidence in it ;-(
Playing around with it a bit, I find there's something (very strangely) buggy for the index 1 + (1 << 32), with both gsl-2.6 and gsl-2.7.1.
Have a fiddle with this, and you'll see what I mean:
use strict;
use warnings;
use feature 'say';
use Alien::GSL;
use Math::GSL;
use Math::GSL::SparseMatrix ':all';
my $m = gsl_spmatrix_alloc( 1, 1 );
my $v;
#$v = 3 + (1 << 32); # no problem with this value
#$v = 2 + (1 << 32); # no problem with this value
#$v = 0 + (1 << 32); # no problem with this value
$v = 1 + (1 << 32); # blows up, but only if
# gsl_spmatrix_get($m, $v, 0)
# is called.
die if gsl_spmatrix_set( $m, 1, 0, 1.5 );
say gsl_spmatrix_get($m, 1, 0);
say gsl_spmatrix_nnz( $m );
die if gsl_spmatrix_set( $m, $v, 0, 1.75 );
say gsl_spmatrix_get($m, $v, 0); # comment out to avoid blow up
# when $v is 1 + (1 << 32).
# But still gives wrong result
# (for that value only).
say gsl_spmatrix_nnz( $m );
The first thing to try is to run that as a C program and see if the same issue arises.
If not, then it's an issue with Math::GSL.
It's getting late over here ... something for tomorrow.
Cheers,
Rob
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.