Intresting! I have learned much more from this topic than I have in the last year with J.
On Sun, Apr 5, 2015 at 8:12 PM, David Lambert <b49p23t...@gmail.com> wrote: > http://www.jsoftware.com/jwiki/Essays/Odometer > > Fastest of these is the sparse solution > (4 $. $.)@($&1) > > To fill your table assuming you've used c notation: > > odometer =: (4 $. $.)@($&1) > i=:{. > j=:1&{ > k=:{: > ($ ([: ((i*j) - (i*k) - (j*k))"1 odometer))2 3 4 > 0 0 0 0 > 0 1 2 3 > 0 2 4 6 > > 0 _1 _2 _3 > 1 1 1 1 > 2 3 4 5 > > Or > > 'I J K' =: ($"1 ([: |: odometer)) 2 3 4 > > (I * J) - (I * K) - (J * K) > 0 0 0 0 > 0 1 2 3 > 0 2 4 6 > > 0 _1 _2 _3 > 1 1 1 1 > 2 3 4 5 > > > ($"1 ([: |: odometer)) is the hook (u v) identify > $"1 as u > ([: |: odometer) as v, a fork. > In a hook v always evaluates as a monad. > > The capped fork (u v w) evaluates v as a monad on the result of w. > ($"1 ([: |: odometer)) independently reshapes the components of the > index matrix, increasing the rank by 1, and then > 'I J K' =: RHS assigns the items accordingly. > > Hi. >> >> How can someone create list of indexes of 3d table (N x M x K)? >> >> I have written this simple code: >> >> ind3d =: 3 : 0 >> 'n m k' =. y >> p0 =. k&| >> p1 =. (m&|)@:<.@:(%&k) >> p2 =. <.@:(%&(m*k)) >> (p2 , p1 , p0)"0 (i. (n*m*k)) >> ) >> >> but it's very very slow. Does any tacit solution for this problem exist? >> >> Another question is how to fill the table with values depending on indexes >> of cell? For example, F[i,j,k] = (i * j) - (i * k) + (j * k). >> >> > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm