« first day (2322 days earlier)      last day (325 days later) » 

6:37 AM
@Adám Shouldn't this give 1?
(2(⍱/∨⍥(0∘∊)⍱⌿)⊢) 3 3⍴ 0 0 1  1 1 1  1 1 1
@JoshD Actually I already have positions of zeroes and the dimension of the matrix shouldn't exceed something like 30, but I always thought that checking relative positions of zeroes in a matrix would be simpler or more efficient, at least
 
6:58 AM
Wait, I might have badly proposed what I was looking for.
f ← ⍉⍱⍥(∨/∘,0 0∘⍷)× ⍝ This is my correct (and unefficient solution)
It returns 0 if the matrix contains two consecutives 0s (It return 1 in this matrix 3 3⍴ 1 1 0 0 1 1 1 1)
@Adám Is something like this correct?
⍉⍱⍥(∨/⍤∊2⍱/⊢)⊢
 
@MasterQuiz Ah, you mean to say it should be (2(⍱/∨⍥(1∘∊)⍱⌿)⊢) — yes.
@MasterQuiz (just use multiple messages instead of a single multi-line message. They'll look like a single message)
@MasterQuiz The transpose is expensive. You don't need it.
 
@Adám Oh thanks, I was about to ask this
 
And a ravel (your ) has a cost too, as it needs to copy all the data. ∨/∊ and 1∊ are equivalent.
One thing I didn't do was make my solution work for non-Booleans, but of course, that's just 0∘≠
 
What about the difference between putting 0s in a matrix (that actually can be already a boolean one) and than use the function above and doing some calculations with the vector of positions?
 
I'll try it.
 
7:17 AM
Considering that, for the moment, I expect the matrix to have 12≥≢m so the positions will be around 24. (If the dimension of the vector can affect the efficiency of one method or the other one)
@Adám This is working (I think) but it seems a lot inefficient {(⊂0 1)(⊂1 0)⍱.∊⊂∘.-⍨⍵}
 
 
7 hours later…
2:05 PM
0
Q: Resuming execution after conditional breakpoint in Dyalog APL

xpqzIn a previous question I asked about how to set a conditional breakpoint in Dyalog RIDE, and the accepted answer works as advertised, by creating a guard statement with an empty function call as the body. Execution will be halted on the expected line when the condition is met. However, this being...

0
Q: Access same row/column in each array in nested arrays in Dyalog APL

xpqzIs there a way to multiply or add a scalar to the same row or column in each array of a nested array without a loop? For example I would like to multiply all the values in the 2nd column (or row) of each array by 2 for the sample nested array below. (4 3)(5 3)(3 3)⍴¨⊂⍳15 ┌────────┬────────┬...

 
 
2 hours later…
3:51 PM
@MasterQuiz 1∊∘.-⍨∊(0 1)(1 0)⍨ is probably as good as it gets, but right, O(n²) is probably not good unless there are very few 0s.
 

« first day (2322 days earlier)      last day (325 days later) »