Re: [Jprogramming] Advent of Code Day 24

2022-01-13 Thread Eugene Nonko
I did solve it, but I didn't use J for that one. I wrote a translator in Perl that converted their assembly into C. C, because it's easier to read, plus I thought that some brute forcing might be required and compiled C will run faster than interpreting their assembly. While studying that generat

[Jprogramming] Advent of Code Day 24

2022-01-13 Thread Raul Miller
https://adventofcode.com/2021/day/24 I have not completed the day 24 puzzle. The day 24 puzzle has a sequence of instructions representing a calculation to verify a model number (and conceptually enable features based on that model number -- though part A of the puzzle does not provide any detail

Re: [Jprogramming] Advent of Code Day 15

2022-01-13 Thread Jan-Pieter Jacobs
Thanks to Raul's very accurate observations, I patched two of my previously posted solutions (The array based tacit one and the explicit one). The approach based on :&max <.@:* <./@sh5)^:(max +./@:<: ,@])^:_ start was wrong because: it stops when no more maxes are present, i.e. does not consider pa

Re: [Jprogramming] Rank of an arbitrary matrix

2022-01-13 Thread John Randall
The rank of a matrix (in the linear algebra, not J sense) is tricky to determine numerically because of stability issues: an arbitrarily small perturbation may increase the rank. A good practical start is the singular value decomposition, available through the LAPACK extension. This reduces th

Re: [Jprogramming] Rank of an arbitrary matrix

2022-01-13 Thread Ric Sherlock
Not sure this is the preferable way but one solution might be: load 'math/misc/matfacto' matrixrank=: #@(] -. 0 #~ #)@(1 {:: lud) matrixrank _3 ]\ 1 2 3 5 4 6 9 7 8 3 matrixrank _3 ]\ 1 2 3 2 4 6 9 7 8 2 Note that "rank" has lots of alternative meanings in J other than calculating the

Re: [Jprogramming] Rank of an arbitrary matrix

2022-01-13 Thread Devon McCormick
#$m On Thu, Jan 13, 2022 at 2:51 PM Pawel Jakubas wrote: > Dear J enthusiasts, > > I am wondering what is the preferable way to determine the rank of a matrix > in J. > I would expect here below > >]m=: 3 3 $ 1 2 3 5 4 6 9 7 8 > 1 2 3 > 5 4 6 > 9 7 8 > rank m > 3 > >]m=: 3 3 $ 1 2 3 2

[Jprogramming] Rank of an arbitrary matrix

2022-01-13 Thread Pawel Jakubas
Dear J enthusiasts, I am wondering what is the preferable way to determine the rank of a matrix in J. I would expect here below ]m=: 3 3 $ 1 2 3 5 4 6 9 7 8 1 2 3 5 4 6 9 7 8 rank m 3 ]m=: 3 3 $ 1 2 3 2 4 6 9 7 8 1 2 3 2 4 6 9 7 8 rank m 2 Thanks and cheers Pawel Jakubas -

Re: [Jprogramming] Advent of Code Day 22

2022-01-13 Thread 'Michael Day' via Programming
This seems not to have appeared in the forum,  so I'm sending again. Apologies if it turns out to be a duplicate. I've now modified reboot2a - it's now reboot2b (!) - to accumulate volumes of repeated intersection cuboids. It performs significantly better than reboot2a,  whose time & space I r