bug-apl
[Top][All Lists]
Advanced

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

Re: Potential problem in diadic iota (⍳) or in Pick (⊃)


From: Dr . Jürgen Sauermann
Subject: Re: Potential problem in diadic iota (⍳) or in Pick (⊃)
Date: Fri, 7 Aug 2020 19:47:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

Gentlemen,

thanks, fixed in SVN 1334.

Best Regards,
Jürgen


On 8/7/20 4:33 PM, Kacper Gutowski wrote:
On Thu, Aug 06, 2020 at 08:50:27PM -0400, Christian Robert wrote:
     ∇z←(F fasteach) A;shp;vec;nub;res;idx
shp←⍴A               ⍝ Shape and ...
vec←,A               ⍝ ... ravel of arg.
nub←∪ vec            ⍝ Vector of unique elements.
nub←∪ vec            ⍝ Vector of unique elements.
res←F¨nub            ⍝ Result for unique elts.
idx←nub ⍳ vec        ⍝ Indices of arg in nub ...
z←shp ⍴ idx ⊃¨⊂ res  ⍝ ... distribute result.


The problem is indeed in iota and it reminds me a similar problem we had with an unique before.  For sufficiently big arrays, a different algorithm is used where the left argument is sorted beforehand to speed up searching; and something goes wrong there.

Smaller reproducer:

      A←⌽⍳64
      B←⍳6
      B≡A[A⍳B]
0

Should be 1, of crouse.

-k



reply via email to

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