Nicolas Neuss <[EMAIL PROTECTED]> writes:

> (eval-when (:compile-toplevel :load-toplevel :execute)
>   (deftype uint () '(unsigned-byte 32))

Can (integer 0 max-positive-fixnum) be used instead for uint?

>   (deftype double-vec () '(simple-array double-float (*)))  
>   (deftype fixnum-vec () '(simple-array fixnum (*))))
> 
> (defun fixnum-vec (&rest args)
>   (map 'fixnum-vec #'identity args))
> 
> (defun make-fixnum-vec (dim &optional (init 0))
>   (make-array dim :element-type 'fixnum :initial-element init))
> (defun make-double-vec (dim &optional (init 0.0d0))
>   (make-array dim :element-type 'double-float :initial-element init))
> 
> (defun test ()
>  (let* ((dim 2) (n 100)  ; !! 1000
>       (dims (make-fixnum-vec dim n))
>       (offsets (fixnum-vec 1 n))
>       (entries (make-double-vec (expt n dim) 1.0d0))
>       (pos0 0))
>    (declare (optimize (speed 3) (safety 0) (debug 0)))
>    (declare (type fixnum pos0)
>           (type fixnum-vec dims offsets)
>           (type double-vec entries))
>    (loop with offset of-type uint = (aref offsets 0)
>        for pos1 of-type uint from (the uint (+ pos0 offset)) by offset
>        below (the uint (+ pos0 (the uint (* offset (the uint (- (aref dims 0) 1))))))

Does using DIM instead of (AREF DIMS 0) improve things?

>        do
>        (loop with offset of-type uint = (aref offsets 1)
>              for pos2 of-type uint from (the uint (+ pos1 offset)) by offset
>              below (the uint (+ pos1 (the uint (* offset (the uint (- (aref dims 1) 
>1))))))

Likewise in this loop...



Reply via email to