-----maxima-bounces at math.utexas.edu wrote: -----
>Perhaps,?a?user?not?working?in?an?statistical?context?would?expect?lmax
>to?return?the?maximum?element?of?the?matrix,?not?a?list?of?column?wise
>maxima,?which?is?what?we?are?looking?for.
>
>--
>Mario
I'd guess that users would sometimes assume that lmax on a matrix gives
the largest matrix entry. I suppose lmax and lmin could have optional
arguments that control all this, but I think it's more useful to unify
lmax with maxi. Plus, for matrices, we have the one and infinity norms
already.
Maybe something like (now that transpose is less spendy)
(defmacro opapply (op l)
`(simplify (cons (list ,op) ,l)))
(defun $lmax (x)
(cond ((or ($listp x) ($setp x)) (opapply '$max (margs x)))
(($matrixp x)
(opapply 'mlist (mapar #'(lambda (s) (opapply '$max s)) (transpose (mcx (margs x))))))
(t (merror "The argument to 'lmax' must be a list, set, or matrix."))))
(defun $lmin (x)
(cond ((or ($listp x) ($setp x)) (opapply '$min (margs x)))
(($matrixp x)
(opapply 'mlist (mapar #'(lambda (s) (opapply '$min s)) (transpose (mcx (margs x))))))
(t (merror "The argument to 'lmin' must be a list, set, or matrix."))))
--Barton