The system can change the sparse axes on its own. In this case the array is still sparse, but there are no sparse axes, so on in the output, on the left of | there is nothing (because there are no sparse axes), and on the right of | is the entire array. Thus:
x=: 1 (<0 1)} ($. 1 1 $ 0) ,"1 1 ,: 0 x │ 0 1 $.^:_1 x NB. dense version of x 0 1 $ x 1 2 x -: 1 2$0 1 1 2$.x NB. verify that x has no sparse axes (2;0 1)$.x NB. make axes 0 and 1 sparse 0 1 │ 1 (2;0)$.x NB. make axis 0 sparse 0 │ 0 1 A clearer(?) example: y=: (?.3$2) * ?. 3 4$3 y 0 0 0 0 2 0 2 1 1 2 0 2 s=: $. y NB. sparse version of y s 1 0 │ 2 1 2 │ 2 1 3 │ 1 2 0 │ 1 2 1 │ 2 2 3 │ 2 2$.s NB. the sparse axes of s should be 0 1 0 1 (2;0)$.s NB. make 0 the sparse axis 1 │ 2 0 2 1 2 │ 1 2 0 2 (2;1)$.s NB. make 1 the sparse axis 0 │ 0 2 1 1 │ 0 0 2 2 │ 0 2 0 3 │ 0 1 2 (2;i.0)$.s NB. make no axes sparse │ 0 0 0 0 │ 2 0 2 1 │ 1 2 0 2 ----- Original Message ----- From: Alexander Mikhailov <[email protected]> Date: Monday, October 4, 2010 21:06 Subject: [Jprogramming] sparse array question To: [email protected] > I've got strange behavior playing with sparse arrays: > > 1 (<0 1)} ($. 1 1 $ 0) ,"1 1 ,: 0 > | 0 1 > > I suspect that J decides to present the whole array - not an > item of it - in uncompressed form, so there is no element left > of |. I expected something like > > 0 1|1 > > so this output looks strange. When it's supposed to look like this? > > Alex ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
