- or download this
use PDL:
sub p{$t=pdl+pop;$t=$t*(pdl$_)for@_;[list$t]}
- or download this
print join " ", @{p([1..5],[1..5])};
1 4 9 16 25
- or download this
sub p{my $t=pdl+pop;$t=$t*(pdl$_)for@_;[list$t]}
- or download this
A = p1'*p2;
product = crossdiags(A);
- or download this
sub p{$t=pdl+pop;for(@_){
my $a=outer$t,pdl+pop;
...
$t->slice("$_:".($_+$n))+=$a->slice("$_,:")for 0..$n;
}
[list$t]}