max_diagonal function

Maximum diagonal element of a matrix