btf1=: 3 : ',(i.-n)+/n*i.n=. %:#y'
   btf2=: 13 : ',(i.-n)+/n*i.n=. %:#y'

I went back to look at the two definitions:

    btf1
3 : ',(i.-n)+/n*i.n=. %:#y'
   btf2
[: ([: , ([: i. -) +/ ] * i.) [: %: #
   

In the tacit definition of btf2,  n  is gone!  J is working harder all the
time!

Linda


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Linda Alvord
Sent: Tuesday, January 29, 2013 5:37 AM
To: [email protected]
Subject: Re: [Jprogramming] reverse table row indices using indices

This part I understand:

   btf1=: 3 : ',(i.-n)+/n*i.n=. %:#y'
   btf2=: 13 : ',(i.-n)+/n*i.n=. %:#y'
   (btf1 -: btf2)"0 *:i.10
1 1 1 1 1 1 1 1 1 1
   5!:4 <'btf1'
      -- 3                        
-- : -+- ,:',(i.-n)+/n*i.n=. %:#y'
   5!:4 <'btf2'
  -- [:                
  │    -- [:           
  │    +- ,            
  │    │          -- [:
  +----+    ------+- i.
  │    │    │     L- - 
  │    │    │          
--+    L----+- / --- +
  │         │          
  │         │     -- ] 
  │         L-----+- * 
  │               L- i.
  │    -- [:           
  L----+- %:           
       L- #            
   
   
  Roger, I don't understand what you are doing in this next section:

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

1 What is m?
2 What is for?
3 Is this C (I don't know C and it isn't J)

Linda

   
    

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Roger Hui
Sent: Monday, January 28, 2013 7:10 PM
To: Programming forum
Subject: Re: [Jprogramming] reverse table row indices using indices

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


On Mon, Jan 28, 2013 at 4:06 PM, Roger Hui <[email protected]>wrote:

> 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
----------------------------------------------------------------------
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