I can suggest a reason why PDL might not be performing well:
> # calc the value
> $b->slice('3,:') .= (($b->slice('0,:') ** 2) + ($b->slice('1,:') ** 2)) **
> 0.5;
This performs three for-loops internally, whereas any reasonable Perl
implementation will compute everything with one loop:
for (@$dat) {
push @$_, (($_->[0] ** 2) + ($_->[1] ** 2)) ** 0.5;
}
Lesson: Low-level optimization cannot compensate for using a crappy algorithm.
I cannot see any obvious way to do the single loop algorithm with PDL
other than using PDL::PP to write a custom function. But I'll bet
anything that if you implement Perl's algorithm with PDL::PP that will
give you the performance you hoped to see fro PDL.
Daniel.
--
No trees were killed in the generation of this message. A large number
of electrons were, however, severely inconvenienced.
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl