[Jprogramming] Spare Matrix from Index Matrix
ramacd
ramacd at nbnet.nb.ca
Sat Feb 3 22:07:06 HKT 2007
It seems Roger is a mortal;
s=: ?4 4$2
(4&$.)^:_1 (4 $. s)
|domain error
(4&$.)^:_1(4 $.s)
...or is my copy of J too old?
------------------------------------------------------------------------
|\/| Randy A MacDonald | APL: If you can say it, it's done.. (ram)
|/\| ramacd at nbnet.nb.ca |
|\ | | The only real problem with APL is that
BSc(Math) UNBF'83 | it is "still ahead of its time."
Sapere Aude | - Morten Kromberg
Natural Born APL'er | Demo website: http://156.34.82.188/
-----------------------------------------------------(INTP)----{ gnat }-
----- Original Message -----
From: "June Kim" <juneaftn at gmail.com>
To: "Programming forum" <programming at jsoftware.com>
Sent: Saturday, February 03, 2007 8: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
More information about the Programming
mailing list