You can use the 1$.y verb: ] i=: 3 2$0 0 1 1 2 1 0 0 1 1 2 1 ] s=: 1 (<"1 i)}1$.3 3;0 1;0 0 0 | 1 1 1 | 1 2 1 | 1
Using 1$.y is required if the dense matrix would have been too big. For example: ] s1=: 1 (<"1 i)}1$.123456789 213456789;0 1;0 0 0 | 1 1 1 | 1 2 1 | 1 $s1 123456789 213456789 ----- Original Message ----- From: June Kim <[EMAIL PROTECTED]> Date: Saturday, February 3, 2007 4:16 am Subject: [Jprogramming] Spare Matrix from Index Matrix > ]m=: 1 0 0, 0 1 0,: 0 1 0 > 1 0 0 > 0 1 0 > 0 1 0 > ]i=:4$.$. m > 0 0 > 1 1 > 2 1 > ]m2=:1 (<"1 i)} 3 3$0 > 1 0 0 > 0 1 0 > 0 1 0 > ]s=:$.m2 > 0 0 │ 1 > 1 1 │ 1 > 2 1 │ 1 > > Can I get s from i without going through the dense matrix form? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
