​​Ben's approach using Sparse has a useful side:

    t

1 0 0 1 0 1

0 1 0 0 1 0

1 1 1 0 1 1

1 1 0 1 1 1


ix1 =: 4$.$.

NB. list indices only where there is a 1. Binary array input



ix1 t

0 0

0 3

0 5

1 1

1 4

2 0

2 1

2 2

2 4

2 5

3 0

3 1

3 3

3 4

3 5



Skip Cave

On Wed, Jan 11, 2017 at 9:44 AM, Raul Miller <[email protected]> wrote:

> Easy to fix, though:
>
>    4$.$. 1+i.3 4
>
> --
> Raul
>
>
> On Wed, Jan 11, 2017 at 7:06 AM, Ben Gorte - CITG
> <[email protected]> wrote:
> >
> >> Ben:
> >> 4$.$. i.3 4  NB. Unboxed using Sparse
> >
> > Btw, this produces indices for the non-zero elements of the array only,
> which is not according to your specs.
> > Sorry for that.
> >
> >
> > ----------------------------------------------------------------------
> > 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