Reduce.pm (PDL-2.074) | : | Reduce.pm (PDL-2.075) | ||
---|---|---|---|---|
skipping to change at line 86 | skipping to change at line 86 | |||
=for example | =for example | |||
$x = sequence 5,5; | $x = sequence 5,5; | |||
# reduce by adding all | # reduce by adding all | |||
# elements along 2nd dimension | # elements along 2nd dimension | |||
$y = $x->reduce('add',1); | $y = $x->reduce('add',1); | |||
$y = $x->reduce('plus',1); | $y = $x->reduce('plus',1); | |||
$y = $x->reduce('+',1); # three ways to do the same thing | $y = $x->reduce('+',1); # three ways to do the same thing | |||
[ As an aside: if you are familiar with threading you will see that | [ As an aside: if you are familiar with broadcasting you will see that | |||
this is actually the same as | this is actually the same as | |||
$y = $x->mv(1,0)->sumover | $y = $x->mv(1,0)->sumover | |||
] | ] | |||
NOTE: You should quote the name of the operation (1st arg) that | NOTE: You should quote the name of the operation (1st arg) that | |||
you want C<reduce> to perform. This is important since some of the | you want C<reduce> to perform. This is important since some of the | |||
names are identical to the names of the actual PDL functions | names are identical to the names of the actual PDL functions | |||
which might be imported into your namespace. And you definitely | which might be imported into your namespace. And you definitely | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |