anchor.diff:  (defpackage "XECTO-LOOP-NEST"
     (:use "CL")
     (:shadow "OPTIMIZE")
  -  (:export "OPTIMIZE"))
  +  (:export "OPTIMIZE" "*MINIMAL-INNER-TRIP-COUNT*"))
  +
  +;;; Optimize perfect constant loop nests.
  +;;; Input: (offset . shape)+
  +;;;  offset: initial offset of index,
  +;;;  shape: simple-vector of (trip-count . stride)
  +;;;
  +;;; All the shapes must be compatible: trip count is the
  +;;; same at each nesting depth, and total depth is the same.
  +;;;
  +;;; Optimize will reorder the nesting to have lower strides
  +;;; at the bottom, merge outer loops that can be expressed
  +;;; as additional iterations of an inner one, and reorder the
  +;;; nesting again to ensure a *minimal-inner-trip-count*, as
  +;;; much as possible.
  +;;;
  +;;; The output is (offsets . loops), where offsets is a
  +;;; (simple-array index 1) of initial offsets, and loops
  +;;; a simple-vector of (trip-count . strides), where strides
  +;;; is a (simple-array fixnum 1).
   
   (in-package "XECTO-LOOP-NEST")
   
  
positive.code:           (setf pattern new-pattern)
            (return pattern)))))
  
  (defun optimize (offset-and-shape &rest offsets-and-shapes)
    (let* ((data    (cons offset-and-shape offsets-and-shapes))
           (offsets (map '(simple-array index 1) #'car data))
  
negative.code:     (cons offsets
            (if (zerop (length pattern))
                (make-array 1 :initial-element
                              (cons 1 (make-array (length data)
                                                  :element-type 'fixnum
                                                  :initial-element 0)))
                (ensure-minimal-trip-count (merge-pattern pattern))))))
  