I wish I had translated your code properly. [Actually, I think the correct translation of i2 is i2=. (j*n)-(1+k)]. I am not sure I understand how you conclude there are 4 cycles, but I think I understand that swapping only in a certain order will get the correct result. In C I am working inside a loop that someone else has created and am trying not to alter his/her code if possilble. I am pretty sure that what I need is the transpose first, flip second result. I think I can do that in two steps with double indexed arrays outside of the loop which has a 13x13 array. But this is one of the most critical code steps and I was hoping to see if I could work complete inside the existing loop which goes from 0 to 168. Your warning about the importance of the sequence does not seem to apply if there are no swaps. But I have not thought of a way to do the flip and transpose with indices.
On Mon, Jan 28, 2013 at 3:48 PM, Raul Miller <[email protected]> wrote: > There are two problems here. > > One is that you did not translate my code properly. You should have used > i2=. (j*n)+n-(1+k) > > The other was that my code can't work right. To illustrate this: > > C.,|.|:i.3 3 > +-+-------+-------+ > |4|7 3 1 5|8 6 0 2| > +-+-------+-------+ > > Since we have length 4 cycles in this example, simple swaps can't do > the job properly. > > To fix this, I think the easiest approach would be to use two loops, > one to do the transpose and the other to do the flip. > > Do you feel comfortable doing that, or should I try my hand at this again? > > Thanks, > > -- > Raul > -- (B=) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
