>From that:

   btf1=: 3 : ',(i.-n)+/n*i.n=. %:#y'
   (btf -: btf1)"0 *:i.10
1 1 1 1 1 1 1 1 1 1

A simpler C implementation derives:

n=sqrt(m);
for(i=n-1;i>=0;--i) for(j=0;j<m;j+=n) *r++=i+j;




On Mon, Jan 28, 2013 at 3:47 PM, Brian Schott <[email protected]>wrote:

> I think I got it.
>
>    btf =: monad define   NB. Brians transpose flip
> n=. %:#y
> r=. i. 0
> for_j. i. n do.
> for_k. i. n do.
> r =. r, (_2*j)+(n-1)+j+n*k
> NB. smoutput i1
> end.
> end.
> r
> )
>
>    btf i. 9
> 2 5 8 1 4 7 0 3 6
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to