For example, let A be a rank-3 array.  (2;0 1)|:A will "run together" axes
0 and 1, in the sense that all atoms (<j,j,i){A, where the index in axis 0
and the index in axis 1 are the same, will be put into a new axis.



On Sun, Jan 8, 2012 at 5:08 PM, Marshall Lochbaum <mwlochb...@gmail.com>wrote:

> This never seemed intuitive to me either. I think it means that the indices
> are run together, i.e. in an ordinary table you have indices given by
> {@:(i.&.>)@:$
> like
> ┌───┬───┬───┬───┐
> │0 0│0 1│0 2│0 3│
> ├───┼───┼───┼───┤
> │1 0│1 1│1 2│1 3│
> ├───┼───┼───┼───┤
> │2 0│2 1│2 2│2 3│
> └───┴───┴───┴───┘
> And when you "run together" the indices for two dimensions you get
> ([: ,&.>&>/ ({.~&.> <./@:(#@>))) @: (i.&.>) @: $
> i.e. cut to the shorter of the lengths, then combine element by element,
> like
> ┌───┬───┬───┐
> │0 0│1 1│2 2│
> └───┴───┴───┘
>
> Marshall
>
> On Sun, Jan 8, 2012 at 4:38 PM, Patrick van Beek <patvanb...@gmail.com
> >wrote:
>
> > Hi Alex,
> >
> > I never quite understood what *run together* means or why  (<0
> > 1)|: produces the diagonals.  For me it was a case of experimenting with
> > the arguments and seeing what the result is rather than knowing if I
> > provide certain arguments I will get certain output - one of the few
> places
> > in the dictionary where the logic escapes me.
> >
> > Patrick
> >
> > On Sat, Jan 7, 2012 at 9:37 PM, Alex Giannakopoulos <
> > aeg...@blueyonder.co.uk
> > > wrote:
> >
> > > Yeah, great stuff that, Don, thanks.
> > > Could do with a fuller tutorial, though.
> > > Didn't find anything other than the 2 line description
> > > Might give it a go myself when I fully understand it.
> > >
> > > On 7 January 2012 13:28, Don Guinn <dongu...@gmail.com> wrote:
> > >
> > > >   i.3 3 3
> > > >  0  1  2
> > > >  3  4  5
> > > >  6  7  8
> > > >
> > > >  9 10 11
> > > > 12 13 14
> > > > 15 16 17
> > > >
> > > > 18 19 20
> > > > 21 22 23
> > > > 24 25 26
> > > >   (<0 1 2)|:i.3 3 3
> > > > 0 13 26
> > > >   (<0 1)|:i.3 3 3
> > > > 0 12 24
> > > > 1 13 25
> > > > 2 14 26
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to