2 ;V Just make the package exist here, V
3 ;V define its guts later in globals.lisp V
6 (defpackage :lineal.overload
8 (:export
*accep-table
* mtrix tuple
9 make-tuple tuple-dim tuple-elems
10 make-mtrix mtrix-dimdom mtrix-dimcodom mtrix-elems
12 addn subtrn multn divisn exptn
)
43 (in-package :lineal.overload
)
45 ;;; Multiplicative Inverse
46 (defgeneric over-multv-inverse
(a))
47 ;;; Concatenate Horizontally
48 (defgeneric cat2
(term1 term2
))
49 ;;; Concatenate Vertically (or vector-wise)
50 (defgeneric vcat2
(a b
))
52 (defgeneric over-crop
(a b
))
53 (defgeneric over-vcrop
(a b
))
55 (defgeneric over-transpose
(a))
56 (defmethod over-transpose (a)
58 "You can only tranpose vectors and matrices."))
61 ;;; Standard operations.
62 (defgeneric add2n
(a b
))
63 (defgeneric subtr2n
(a b
))
64 (defgeneric mult2n
(a b
))
65 (defgeneric divis2n
(a b
))
66 (defgeneric expt2n
(a b
))
68 (defun addn (&rest elems
)
69 (reduce #'add2n elems
))
71 (defun subtrn (&rest elems
)
73 (reduce #'subtr2n elems
)
74 ;V If only one element, follow V
75 ;V lisp style by negating it. V
76 (mult2n -
1 (car elems
))))
78 (defun multn (&rest elems
)
79 (reduce #'mult2n elems
))
81 (defun divisn (&rest elems
)
83 (reduce #'divis2n elems
)
84 (over-multv-inverse (car elems
))))
86 (defun exptn (&rest elems
)
87 (reduce #'expt2n elems
))