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