« first day (1727 days earlier)      last day (913 days later) » 

3:16 AM
in The Nineteenth Byte, 2 hours ago, by caird coinheringaahing
@Bubbler Given the post about Glenn Randers-Pehrson, a Rest In Piece post might very well be on topic for meta
 
 
2 hours later…
5:34 AM
That’s terrible news to wake up to.
 
 
1 hour later…
6:46 AM
@user eh i would guess humanity would survive for another 100000 years, well who knows \o/
 
 
2 hours later…
8:30 AM
hi hi
so i wrote a blog post about a problem and my solution to it in APL:
https://palaiologos.rocks/posts/matrix-rearrangements/
 f←{
     m←⌈/⍵⋄k←∨⌿0≠⍵⋄v←+/m-⍨+/⍵
     q←,↑∘.,/↓(⍺↑⍋)⍤1⊢⍉⍵-⍨⍺/⍪m
     p←q/⍨⍺≠≢∘∪¨q⋄0=⍴p:v
     v+⌊/+/k/↑⍵∘{m[⍵]-1 1⍉⍺[⍵;]}¨p
 }
i'm a bit proud of it because it's idiomatic APL to some extent
i was looking into ways of improving it, namely possibly somehow getting rid of the guard or tweaking the last line to get rid of a dfn in a somewhat elegant way
but neither of my attempts to do so were elegant and didn't provide a performance boost
 
9:09 AM
I think the execution time is dominated by ∘.,/
 
@KamilaSzewczyk "if we pick 3 from 1st column and 4 from 3rd column" - shouldn't those say rows?
 
yes, my fault
 
(and "1 from the 3rd column")
 
@Bubbler depends on the value of alpha; for alpha=4 and a dummy matrix i had on myself it's 2 5 8 11 1 4 7 10 3 6 9 12 2 5 8 11 passed to the outer product
i wonder if i could somehow improve the performance of it given q doesn't occur anywhere but in the formula for p, which filters out elements with all-unique contents
that said i'm somewhat disappointed, because it seemed like a perfect problem for APL which is outperformed even by a Python solution
 
9:37 AM
i mean, you are generating an n^n item long array, each with n items, which ends up being a long list of small lists, which is the thing that APL is worst at
 
i don't think it's too impactful for n<5
 
well, for n<5 you practically have scalar code, which is the other thing (Dyalog) APL is bad at
 
,↑∘.,/↓ is the only point where lists pop up
(⍺↑⍋)⍤1⊢⍉⍵-⍨⍺/⍪m is idiomatic APL, or so i think
 
(⍺↑⍋)⍤1 also is forced to make intermediate vectors
 
but it's not lists, right?
it should be fast with arrays.
 
9:42 AM
vector ≡ list
 
how would you make this code fast then
oh, that's not what i'm used to
 
it's not a list containing lists that's slow, it's having many small lists/arrays in any form at any time that's slow
 
so... what am i supposed to do?
can i even do anything about it
 
and ∘.,/ is for n≡4 is still 256 vectors each of 4 items
 
9:58 AM
this doesn't seem to be much faster :/
1 1⍉⍺[⍵;] is also fairly inefficient, multiplying that n^n by n*n (minus unique, but that doesn't seem too big of a proportion) for n^(n+2)
I've long wanted some efficient ways to do that
dzaima/APL ⎕VI←1 has this
changing that 1 1⍉⍺[⍵;] to ⍺[⍵,¨⍳≢⍵] makes the thing 30-80% slower, so there's that
 
10:17 AM
uhh magic that makes it 5x faster for a 6x6 input
sad that you have to resort to a flat array and manual index calculation to get good performance
 
10:37 AM
News about Dyalog: Roger Hui
 

« first day (1727 days earlier)      last day (913 days later) »