From mirko.vukovic at gmail.com Thu May 20 15:06:07 2010 From: mirko.vukovic at gmail.com (Mirko Vukovic) Date: Thu, 20 May 2010 11:06:07 -0400 Subject: [l-math-devel] thanks for the package and am I doing something wrong? Message-ID: 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 From rudy.neeser at gmail.com Thu May 20 21:37:44 2010 From: rudy.neeser at gmail.com (Rudy Neeser) Date: Thu, 20 May 2010 23:37:44 +0200 Subject: [l-math-devel] thanks for the package and am I doing something wrong? In-Reply-To: References: Message-ID: <1274391465.1722.9.camel@neverwhere> 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: -------------- 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: From mirko.vukovic at gmail.com Thu May 20 23:18:07 2010 From: mirko.vukovic at gmail.com (Mirko Vukovic) Date: Thu, 20 May 2010 19:18:07 -0400 Subject: [l-math-devel] thanks for the package and am I doing something wrong? In-Reply-To: <1274391465.1722.9.camel@neverwhere> References: <1274391465.1722.9.camel@neverwhere> Message-ID: On Thu, May 20, 2010 at 5:37 PM, Rudy Neeser 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 > From rudy.neeser at gmail.com Fri May 21 07:00:02 2010 From: rudy.neeser at gmail.com (Rudy Neeser) Date: Fri, 21 May 2010 09:00:02 +0200 Subject: [l-math-devel] thanks for the package and am I doing something wrong? In-Reply-To: References: <1274391465.1722.9.camel@neverwhere> Message-ID: <1274425202.1712.4.camel@neverwhere> Hi Mirko On Thu, 2010-05-20 at 19:18 -0400, Mirko Vukovic wrote: > Can you put out an announcement when the 0.3.2 comes out. I will > check it out then. 0.3.2 is now out ;) You can read a copy of the announcement here: https://launchpad.net/l-math/+announcement/5869 Best, Rudy -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- 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: