?

Log in

No account? Create an account
patrickwonders
patrickwonders

Vector math optimization continues...

So, I had this function going on (after macro expansion and some type substitution) to scale a vector by a constant:

(deftype float-type  () 'double-float)
(deftype vector-type () '(vector float-type))
(defun vs (scale vec)
    (declare (type float-type  scale))
    (declare (type vector-type vec))
    (declare (optimize (speed 3) (safety 0)))
    (map vector-type
	#'(lambda (x) (declare (type float-type x))
			(the float-type (* x scale)))
	vec)))
In case you aren't reading your friends list for the Lisp...Collapse )
Tags: