>OK, I'm trying to do some work with matrices that involves transformations
>based on local properties of a matrix (neighbouring elements).
As Henry Rich pointed out: the real solution will go via ;.3 tessalations.
Have a look at those.
Without those ;.3 cuts, the classic approach is this:
A little to the left
Right down the middle
A little to the right,
X marks the spot
[Godley & Creme, This Sporting Life, 1978]
Solve the torus first:
use |. to wiggle m up & down (and center),
use |."1 to wiggle those matrices left & right (and center)
ending up with 9 matrices, the original one and eight shifted ones, where
the neighbours get shifted to "the original" position. +/+/, and subtract
the original matrix agin if you want to sum up neighbours only, and you are
done.
You'll need to use "l r a lot to make this work, left as an healthy
exercise for you.
For the non-torus problem:
Pad m with borders of zeroes (easy with , and ,.),
do the torus sums,
throw away the borders of the sums.
Martin
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm