bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Select from a two-dimensional array


From: Elias Mårtenson
Subject: Re: [Bug-apl] Select from a two-dimensional array
Date: Sun, 3 Aug 2014 14:01:06 +0800

Thanks! I ended up doing that. I'm almost glad to learn that there was no secret feature that I didn't know about. :-)

Regards,
Elias

On 3 Aug 2014 12:37, "David B. Lamkins" <address@hidden> wrote:
Assuming you want a ravel of the elements under the mask:

      a←2 3⍴1 2 3 4 1 2
      b←2 3⍴0 0 1 0 0 0
      a
1 2 3
4 1 2
      b
0 0 1
0 0 0
      (,b)/,a
3


On Sun, 2014-08-03 at 00:12 +0800, Elias Mårtenson wrote:
> Here's a problem I've had on multiple occasions, and I have yet to
> figure out a nice generic way of dealing with it.
>
>
> For a one-dimensional array, I can easily select elements based on a
> bitmap:
>
>
>       0 0 1 0 0 0/⍳6
> 3
>
>
> Sometimes I want to do the same from a two (or more) dimensional
> array:
>
>
>       a
> 1 2 3
> 4 1 2
>       b
> 0 0 1
> 0 0 0
>       b/a
> RANK ERROR
>       b/a
>       ^ ^
>
>
> How to do this?
>
>
> Regards,
> Elias



reply via email to

[Prev in Thread] Current Thread [Next in Thread]