New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SF#364 type promotion in whistogram is based upon the index, not the weight #45
Comments
The input was never an "index", it was just input data. The operation's "type-promotion" (really, determination) was never based on only the first parameter. The output's type is written "float+", which is what happened here (the output got promoted to float), which can be seen easily by using this updated code: use PDL;
srand(372);
my $wt = random( PDL::double, 1000 );
my $lidx = zeroes( PDL::long, 1000 );
my $fidx = zeroes( PDL::float, 1000 );
my $didx = zeroes( PDL::double, 1000 );
my $lh = whistogram( $lidx, $wt, 1, 0, 1 );
my $fh = whistogram( $fidx, $wt, 1, 0, 1 );
my $dh = whistogram( $didx, $wt, 1, 0, 1 );
my $exp = $wt->dsum;
print "$_->[0]=", $_->[1]->info, "\n" for ['lh',$lh], ['fh',$fh], ['dh',$dh], ['exp',$exp];
print "delta, long index: ", $lh - $exp, "\n";
print "delta, float index: ", $fh - $exp, "\n";
print "delta, double index: ", $dh - $exp, "\n"; You get an identical difference between a "long" input type, and a "float" input type. The difference between those and double is simply the result of the difference between single and double precision. There is no bug here. |
@djerius writes:
|
Looks quite a lot like an ndarray (not piddle) to me? |
You state:
The signature of
Now, a quote from https://metacpan.org/pod/PDL::PP#Type-conversions-and-the-signature (you did look in the docs?):
If you consider getting back a value that is less than double-precision a "catastrophic loss", then you'd better pass the |
From http://sourceforge.net/p/pdl/bugs/364 (from @djerius)
The text was updated successfully, but these errors were encountered: