2 (in-package :lineal.overload
)
6 (elems nil
:type list
))
8 (defun over-dot-prod (a b
)
13 (defun over-cross-prod (a b
)
14 (if (and (= 3 (tuple-dim a
))
18 :elems
(tuple-cross3 (tuple-elems a
)
20 (throw 'over-ex
"cross products require 3-D vectors")))
22 ;V Projection of u onto v.V
23 (defun over-proj (u v
)
24 (let ((tdim (tuple-dim u
)))
25 (if (= tdim
(tuple-dim v
))
28 :elems
(tuple-proj (tuple-elems u
)
30 (throw 'over-ex
"proj requires vectors of same dimension"))))
32 ;V Orthogonal component of the V
33 ;V projection of u onto v. V
34 (defun over-orth (u v
)
35 (let ((tdim (tuple-dim u
)))
36 (if (= tdim
(tuple-dim v
))
39 :elems
(tuple-orth (tuple-elems u
)
41 (throw 'over-ex
"orth requires vectors of same dimension"))))
43 (defmethod add2n ((a tuple
) (b tuple
))
44 (if (= (tuple-dim a
) (tuple-dim b
))
47 :elems
(tuple-addn (tuple-elems a
) (tuple-elems b
)))
48 (throw 'over-ex
"don't add vectors of different dimension")))
50 (defmethod subtr2n ((a tuple
) (b tuple
))
51 (if (= (tuple-dim a
) (tuple-dim b
))
54 :elemes
(tuple-addn a b
))
55 (throw 'over-ex
"don't subtract vectors of different dimension")))
57 (defmethod mult2n ((k number
) (u tuple
))
58 (make-tuple :dim
(tuple-dim u
)
59 :elems
(scalar-tuple-multn
61 (defmethod mult2n ((u tuple
) (k number
))
62 (make-tuple :dim
(tuple-dim u
)
63 :elems
(scalar-tuple-multn
66 (defmethod divis2n ((u tuple
) (k number
))
67 (make-tuple :dim
(tuple-dim u
)
68 :elems
(tuple-scalar-divisn