(<0 1)|:m


On Fri, Jan 6, 2012 at 12:47 PM, Alex Giannakopoulos <
aeg...@blueyonder.co.uk> wrote:

> Hi
>
> Is there a better (more efficient or whatever) way of getting the diagonal
> of a matrix than the simple multiplication I use below?
>
> Say,
>
>   randmat=. [: ? 0 $~,~
>   idmat =. [:=i.
>   randiag =. randmat * idmat
>
> Many Thanks
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to