1 ;;; -*- Mode: lisp; outline-regexp: ";;;;;*"; indent-tabs-mode: nil -*-;;;
3 ;;; file: defmatrix-subset-matrix.cl
4 ;;; author: cyrus harmon
9 (defmacro def-matrix-subset-matrix
(matrix-type)
10 (let ((element-type (element-type (find-class `,matrix-type
))))
12 (defmethod subset-matrix ((u matrix
) startr endr startc endc
)
13 (destructuring-bind (ur uc
) (dim u
)
15 ((and (<= startr endr ur
) (<= startc endc uc
))
16 (let* ((m (1+ (- endr startr
)))
17 (n (1+ (- endc startc
)))
18 (c (mat-copy-proto-dim u m n
)))
19 (with-matrix-vals (u ,element-type a
)
20 (with-matrix-vals (c ,element-type b
)
23 (setf (aref b i j
) (aref a
(+ i startr
) (+ j startc
)))))))
28 (macrolet ((frob (type-1)
29 `(def-matrix-subset-matrix ,type-1
)))
30 (frob double-float-matrix
))