Leigh J. Halliwell wrote:
> But if I want to set the values of the main diagonal is there
> a similar shortcut?

Well... one way is:

setDiag=: [`([EMAIL PROTECTED] <"[EMAIL PROTECTED]: (<0 1) |: [EMAIL 
PROTECTED]@])`]}

   1 2 3 4 setDiag 4 4$0
1 0 0 0
0 2 0 0
0 0 3 0
0 0 0 4

This might be a bit more than you need (I've
made it so it will set the diagonal even on
non-square matrices):

   _ setDiag i. 3 4
_ 1 2  3
4 _ 6  7
8 9 _ 11

-- 
Raul

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

Reply via email to