« first day (2192 days earlier)      last day (455 days later) » 

2:31 AM
Is there a ready-made tool like cmpx to get a flamegraph or similar for functions? I'd like to perf this slow function I've got.
 
 
2 hours later…
4:46 AM
@B.Wilson look at ]profile
 
5:06 AM
@Adám Perrrfect!
 
 
3 hours later…
7:42 AM
Dang. Excluding 5 elements from a ~1m element array is costing the bulk of time!
Guess that ⍺~⍵ is O(n) in ?
s/~1m element array/~1m element integer vector/
 
 
4 hours later…
12:01 PM
@B.Wilson yes
if you post your code here someone might be able to find a better approach, but I don't think 1500⌶ works with ~ so the actual ~ operation probably can't get any faster
 
12:48 PM
@rak1507 Actually, now I'm wondering if it's really O(n×m) in ⍺ and ⍵, respectively.
Cheers. There's a pretty obvious fix in the code I'm toying on.
 
@B.Wilson in principle, yes, but hashing might speed things up if there are duplicates.
Interesting:
      a←?1e6⍴100
      b←?1e6⍴50
      cmpx 'a~b' 'a~∪b'
  a~b  → 6.7E¯2 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  a~∪b → 2.3E¯2 | -66% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
And then:
      a←1500⌶a
      cmpx 'a~b' 'a~∪b'
  a~b  → 5.1E¯3 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  a~∪b → 4.7E¯3 | -7% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
@rak1507 Seems it does ↑
 
Dang! That speedup on the non-hashed version is way smaller than O(m×n) would lead one to naively believe.
      a←⍳1e6 ⋄ aa←1500⌶a ⋄ b←1000 20000 300000
      cmpx 'a~b' 'aa~b'
  a~b  → 2.5E¯3 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  aa~b → 2.5E¯3 | -1% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
Duplicates Matter™
Last night in bed, I was wondering about the possibility of writing constant-time algorithms in APL. Are there any cryptographic libraries written in Dyalog APL? I'd assume that GC especially would do Bad Things™ for side-channel attacks.
Maybe yet another place for Co-dfns to potentially shine?
 
The DCL (Dyalog Cryptographic Library) is just an interface to a dll.
Crypto is loopy, which is bad in vanilla APL, but yes, maybe Co-dfns can do it well.
 
1:08 PM
      cmpx 'a~b' '(~a∊b)/a'
  a~b      → 5.5E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (~a∊b)/a → 3.9E¯3 | -30% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
18.0 was much faster than 18.2 here.
      cmpx 'a~b' '(~a∊b)/a'
  a~b      → 1.1E¯3 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (~a∊b)/a → 1.1E¯3 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
Dyalog wouldn't be suitable for constant-time code at all. It decides the storage type of a numeric array based on what numbers it contains, and can switch algorithms based on the data it sees too.
 
Ha! I had the same suspicion about and ran almost that exact test :P Interesting that the "obvious" correspondence wasn't baked in until 18.0!
 
 
2 hours later…
3:06 PM
hi, is there a way to use monadic iota(index generator) over complex numbers?
 
3:31 PM
Announcement: BAA Vector webinar (open session) in 30 minutes: Zoom 858 532 665, passcode: ⎕←×/1920 12 17
 
@Adám 391680
 
One thing that I could think of was doing {⍵}1J1+⍳100 but not with the complex side of it.
 
@sloorush You can look at iotag from the dfns workspace:
      iotag 3j4
0.6J0.8 1.2J1.6 1.8J2.4 2.4J3.2 3J4
 
@Adám oooh, thank you!
I'll check it out
 
3:51 PM
@sloorush What result are you trying to achieve?
 
(BAA meetup beginning now — we'll show of an early prototype of an APL learning game!)
 
@Adám ah, cool, I tested it with 1(1500⌶) and the result was unhashed apparently
 
4:11 PM
@sloorush Depending on your goals, maybe it'd be enough to simply transform ⍳Y into whatever set of points you want? 0J1×⍳5 gets you points on the imaginary line. (÷2*0.5)×+⌿1 0J1∘.×⍳5 gets you the same but rotated clockwise by 45 degrees. *(0J1×○2)×(÷5)×⍳5 should get you 5 points on the unit circle. Etc.
 
@B.Wilson I basically want a big array of a lot of complex numbers (big, small, only imaginary component etc.)
 
What about something like ⊃+/1 0J1×?1e6∘⍴¨100 100?
 
@B.Wilson I took a simpler approach {⍵,-⍵}(0J1×⍳1000)+⌽⍳1000
but yours gives a lot more numbers to play with
 
There you go. If that suffices for your needs, it's certainly prettier!
BTW, it's easy enough to tacitify that dfns: (⊢,-)
Man J's generalization of scalar extension is really quite nice, applying even to higher ranked arrays as long as the shape of one argument is exactly some prefix of the shape of the other argument.
So you can write the equivalent of 1 0J1×2 3⍴⍳6 and get 2 3⍴1 2 3 0J4 0J5 0J6
 
4:38 PM
@B.Wilson ooh, that's cool
I'll probably go with your implementation, that gives me a lot of numbers to play with
 
Even more generally, you could think about extension as long as one shape is a sub-sequence of the other's, but then you'd have to make a choice in ambiguous cases.
Maybe it's sufficient to just take the convention that the "left-most" subsequence always wins.
 

« first day (2192 days earlier)      last day (455 days later) »