Help for this page
( 0 0 0 ...) ( -1 0 0 ...) ( 0 -1 0 ...) ( 0 0 -1 ...) ...
# 4 dimensions my $matrix = pdl([[0,0,0,0],[-1,0,0,0],[0,-1,0,0],[0,0,-1,0]]); ... my $pdl = pdl(...); my $diff = $pdl x $matrix; # not sure about whether to use left- or ri +ght-multiplication here my $res = $pdl + $diff;