[Jprogramming] How to get array with indices of not-empty elements in sparse array?
'Sergey Kamenev' via Programming
programming at jsoftware.com
Mon Jan 20 04:49:04 UTC 2020
Hi!
] d=: (?. 3 4$2) * ?. 3 4$100
0 55 79 0
0 39 0 57
0 0 0 0
] s=: $. d convert d to sparse and assign to s
0 1 | 55
0 2 | 79 the display of s gives the indices of the
1 1 | 39 “non-zero” cells and the corresponding values
1 3 | 57
How I can get dense array with indices of not-empty elements?
0 1
0 2
1 1
1 3
Is there a solution without iterating over an dense array?
Nice day!
Sergey
More information about the Programming
mailing list