I am trying to use objective C and am using j to
develop some pieces. I have the verb `transposeSquare`
which transposes a square matrix's indices using indices and
reproduces j's Transpose. In C code the indices are named ii
and are being generated in a for loop as follows, where
width and height are actually both 13 but my j examples use
3 instead of 13.
for (int ii = 0 ; ii < width * height ; ++ii)
transposeSquare =: (] <.@% %:@#)+#| %:@# *]
transposeSquare i. 9
0 3 6 1 4 7 2 5 8
,|:i. 3 3 NB. this is the "J way"
0 3 6 1 4 7 2 5 8
Now with C code for loop in mind I need a verb which
first does what transposeSquare does and then reverses the
indices using the operators available to C so that the
result of the verb would be as follows.
,|.|:i. 3 3 NB. this is the "J way"
2 5 8 1 4 7 0 3 6
That is, I need a verb (say, reverseOfTranspose,
rOT), which gives the same result as ,|.|:i. 3 3 but with
the scalar argument 3 and is limited to C operators.
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm