|
From: | Kacper Gutowski |
Subject: | Re: Potential problem in diadic iota (⍳) or in Pick (⊃) |
Date: | Fri, 7 Aug 2020 16:33:41 +0200 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |