In addition to the diagonal expressions in the phrases,
http://www.jsoftware.com/docs/help701/phrases/special_matrices.htm
is a hook for diagonal.

   rank =: #@:$
   diagonal =: |:~ <@:i.@:rank
   diagonal i. 3 3
0 4 8
   diagonal i. 3 3 3
0 13 26
   diagonal i.3 3 3 3
0 40 80

> Date: Tue, 5 Mar 2013 21:12:02 -0600
> From: "Tom Arneson" <[email protected]>
> To: <[email protected]>
> Subject: [Jprogramming] extacting the main diagonal of a square matrix
> Message-ID: <[email protected]>
> Content-Type: text/plain;       charset="us-ascii"
> 
> I want to create a list containing the main diagonal elements of a
square
> matrix. Any suggestions?
> 
> Thanks.
> 

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

Reply via email to