in reply to PDL: efficient self-referencing math?
I haven't used PDL at all, but maybe you have enough dimensions in your piddle to make the following approach efficient:
The matrix would be (or, would be)
( 0 0 0 ...) ( -1 0 0 ...) ( 0 -1 0 ...) ( 0 0 -1 ...) ...
Reading from the PDL documentation, basically the following code should work (while PDL is installing):
# 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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: PDL: efficient self-referencing math?
by BrowserUk (Patriarch) on Sep 04, 2011 at 08:30 UTC |