5.14 find max element and position in matrix

Code from net by Carl Devore:

MMax:= proc(M::{Matrix,matrix}) 
   local C,r,c,mx,L,p; 
   C:= op(`if`(M::Matrix, [1,2], [2,2,2]), eval(M)); 
   L:= map(op, convert(M, listlist)); 
   mx:= max(L[]); 
   member(mx,L,'p'); 
   r:= iquo(p, C, 'c'); 
   mx, `if`(c=0, [r,C], [r+1,c]) 
end;
 

Code below from C W

A:=matrix(12,12,rand(100)); 
Ao:=array((proc(E) 
            local i; [seq(i=(rhs=lhs)(E[i]),i=1..nops(E))]end) 
            (sort(op(3,eval(A)),proc(E1,E2) if rhs(E1)>rhs(E2) 
             then 
                  true 
             else 
                  false 
             fi 
           end))); 
           Ao[1];