[l-math-devel] thanks for the package and am I doing something wrong?

Rudy Neeser rudy.neeser at gmail.com
Thu May 20 21:37:44 UTC 2010


Hi Mirko,

Thanks for the bug report. This is definitely a bug and not something
that you're doing wrong. The error doesn't occur in SBCL, which is why I
never noticed it. 

The patch you've given won't work in all cases: unfortunately when the
VECTOR and MATRIX classes initialise themselves, they never initialise
the values in their data arrays. So I've fixed their respective
INITIALISE-DATA methods to ensure that their data arrays are always
initialised.

I've put a fix in the 0.3 series repository, and I'm about to release
version 0.3.2 with the fix, which should be out later today or on
Friday. If the new version also gives you problems, let me know. 

Thank you very much for pointing this out!

Best,
Rudy



On Thu, 2010-05-20 at 11:06 -0400, Mirko Vukovic wrote:

> Hello,
> 
> First, thanks for the package.  Second, here is a little problem.  I
> fixed it, but I wonder if I am doing something wrong.
> 
> For starters, this is on clisp 2.47 running on cygwin/windows.
> 
> I am doing some vector rotations, and I was getting errors such as
> trying to add a number to NIL.
> 
> Consider the following:
> (let* ((vec (vector 1.0 0.0 0.0))
> 	   (mat (roll-matrix 3 (/ pi 2))))
>       (* mat vec))
> 
> I get the following error:
> 
> COMMON-LISP:+: NIL is not a number
>    [Condition of type SIMPLE-TYPE-ERROR]
> 
> I traced the error to the matrix being filled with nil's instead of zeros.
> 
> I did two modifications in the code, where I tagged the modifications
> as features
> 
> In operations.lisp,
> 
> (defmethod c* ((lhs matrix) (rhs vector))
>   (test-dimensions lhs rhs)
>   (let ((result
> 	 #-clisp (make-vector (matrix-rows lhs))
> 	 #+clisp (make-vector (matrix-rows lhs)
> 			     :initial-elements
> 			     (make-list (matrix-rows lhs)
> 					:initial-element 0.0))))
>     (do-each-matrix-element (el lhs i j)
>       (setf (elt result i)
> 	    (cl:+ (elt result i)
> 		  (cl:* el (elt rhs j)))))
>     result))
> 
> and in matrix.lisp
> 
> (defun make-identity (size)
>   "Creates an size x size identity matrix."
>   (let ((matrix
> 	 #-clisp (make-matrix size size)
> 	 #+clisp (make-matrix size size
> 			     :initial-elements
> 			     (make-list (* size size)
> 					:initial-element 0.0))))
>     (dotimes (i size matrix)
>       (setf (matrix-elt matrix i i) 1))))
> 
> Thanks,
> 
> Mirko
> 
> _______________________________________________
> l-math-devel mailing list
> l-math-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/l-math-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/l-math-devel/attachments/20100520/f0b57563/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/l-math-devel/attachments/20100520/f0b57563/attachment.sig>


More information about the l-math-devel mailing list