anchor.diff:    (:shadowing-import-from :petalisp :set-difference)
     (:use :cl :petalisp :named-readtables)
     (:export
  +   #:zeros
  +   #:eye
      #:transpose
      #:norm
      #:dot
  
positive.code: 
  (defun amax (x)
    (flet ((amax-fn (lmax lind rmax rind)
             (if (>= lmax rmax)
                 (values lmax lind)
                 (values rmax rind))))
      (let ((vector (coerce-to-matrix x)))
  
negative.code:         (values (coerce-to-scalar max)
                  (coerce-to-scalar index))))))
  
  (defun matmul (A B)
    (β #'+
       (α #'*
          (reshape (coerce-to-matrix A) (τ (m n) (n m 1)))
          (reshape (coerce-to-matrix B) (τ (n k) (n 1 k))))))
  
  #+nil
  (defun lu (A)
    (setf A (coerce-to-matrix A))
    (trivia:ematch (shape A)
      ((shape (range 1 m) (range 1 (= m)))
       (labels ((rec (i P L U)
                  (multiple-value-bind (pivot pivot-index)
                      (amax (reshape U)))))
         (rec 1 (eye m) (zeros m) A)))))
  