...
and arithmetic is OK for most applications too
   dm=:[EMAIL PROTECTED]@#
   dm 4 5 6
4 0 0
0 5 0
0 0 6
   dm 4 5 6 _8
4 0 0  0
0 5 0  0
0 0 6  0
0 0 0 _8

   odm=:[EMAIL PROTECTED]@[EMAIL PROTECTED]
   odm i.4 4
 0  1  2  3
 4  0  6  7
 8  9  0 11
12 13 14  0
   sdm=: [EMAIL PROTECTED] + [EMAIL PROTECTED]
   (i.4 4) sdm _1 _2 _3 _4
_1  1  2  3
 4 _2  6  7
 8  9 _3 11
12 13 14 _4
but Raul's is more general and I suspect fater too
Best,
Cliff

Leigh J. Halliwell wrote:

Dear J Forum:
I know that (<0 1) |: takes the values of the main diagonal of a matrix.
But if I want to set the values of the main diagonal is there a similar
shortcut?  For now I'm using (1 1);(2 2); . ; (n n)}, but suspect that
there's a better way.  Thanks.
Sincerely,
Leigh
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--
Clifford A. Reiter
Mathematics Department, Lafayette College
Easton, PA 18042 USA,   610-330-5277
http://www.lafayette.edu/~reiterc

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to