It's possible to convert depths to parent indices without boxes, by
sorting a depth list with twice the input size. The idea is to list each
depth twice, with the first instance representing it as a child entry,
and the second, which is increased by one, representing it as a parent
entry. After sor
Good algorithm!
Consider
'p g' =. |: 0 2 #: g2 =. ...
for the first 2 lines. (0,2^n) #: y avoids the divide and remainder.
Henry Rich
On 5/29/2021 11:50 AM, Marshall Lochbaum wrote:
It's possible to convert depths to parent indices without boxes, by
sorting a depth list with twice the i
Marshall, BQN is really interesting! I'll definitely study it (and maybe
steal 1-2 things along the way ;-).
Your function makes for a ~25% faster computation on my preliminary
testing, albeit at the price of ~3x the space. I'll have to think more
about it to understand the complexity of your expre
Looking at the summing code in these benchmarks, I see that there is a
"sumloop" written in a very loopy, non-J fashion and a "sumj" which looks
like at attempt to accomplish the same thing in a more J-like fashion like
this: sumj =: 13 : '+/ y$1' NB. sum consecutive integers as in J
Of course thi
Benchmarks such as these are hard to make meaningful and easy to misuse,
perhaps maliciously.
In any benchmark set there will be some that don't map to efficient
primitives. The benchmark will have to loop, and performance will
suffer. Opponents will trumpet the poor results.
Perhaps we sh