[l-math-devel] thanks for the package and am I doing something wrong?
Mirko Vukovic
mirko.vukovic at gmail.com
Thu May 20 23:18:07 UTC 2010
On Thu, May 20, 2010 at 5:37 PM, Rudy Neeser <rudy.neeser at gmail.com> wrote:
> 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.
I also have SBCL on another machine, but I like to use CLISP too
(don't know why). Anyways, this is not the first time that running on
clisp found `errors' in code. Something like this happened with GSLL
as well.
>
> 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.
Can you put out an announcement when the 0.3.2 comes out. I will
check it out then.
>
> Thank you very much for pointing this out!
>
Hey, thank *you* for the package :-) Saved me some time and coding.
> Best,
> Rudy
>
Mirko
>
>
> 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
>
More information about the l-math-devel
mailing list