Hi all!
There is a keyword :cl-array for the gsll:make-marray function. Can I use it to convert native lisp array into marray? I'm trying to do this: (defparameter *m* (make-array '(3 3) :element-type 'single-float :initial-contents '((1.0 2.0 3.0) (4.0 5.0 6.0) (7.0 8.0 9.0)))) (gsll:make-marray 'single-float :dimensions '(3 3) :cl-array *m*) leads to error "Invalid initialization argument: :cl-array". (sbcl, of course) Am I right, using :cl-array in such a way? I have searched for examples with thes key, but found nothing.
Also, if I use :data key instead of :cl-array, it works, but tue resulting marray couldn't be used in common routines, such as matrix multiplication, because it isn't simple-array.
To generalize the problem - Is it possible to convert lisp array to gsll marray without copying data?
Thanks
No, not really. :cl-array was put in for internal use, and I tried after you posted to comp.lang.lisp (I'm assuming you are allchemist) and it doesn't work. I'll need to clean that up. I think your use of :data is on the right track but you'll have to make your array with c-array:make-ffa if you want to use it in GSL.
In general I think it would be a good idea to be able easily go back and forth between CL and marrays. I'm not sure the best way to do that at present and what changes need to be made. I'll have to think about it. Unfortunately I won't be able to get to this for a while.
Liam
On Wed, Apr 14, 2010 at 4:26 PM, ivan hohlov hohlovivan@gmail.com wrote:
Hi all!
There is a keyword :cl-array for the gsll:make-marray function. Can I use it to convert native lisp array into marray? I'm trying to do this: (defparameter *m* (make-array '(3 3) :element-type 'single-float :initial-contents '((1.0 2.0 3.0) (4.0 5.0 6.0) (7.0 8.0 9.0)))) (gsll:make-marray 'single-float :dimensions '(3 3) :cl-array *m*) leads to error "Invalid initialization argument: :cl-array". (sbcl, of course) Am I right, using :cl-array in such a way? I have searched for examples with thes key, but found nothing.
Also, if I use :data key instead of :cl-array, it works, but tue resulting marray couldn't be used in common routines, such as matrix multiplication, because it isn't simple-array.
To generalize the problem - Is it possible to convert lisp array to gsll marray without copying data?
Thanks
On Thu, Apr 15, 2010 at 10:13 PM, Liam Healy lhealy@common-lisp.net wrote:
No, not really. :cl-array was put in for internal use, and I tried after you posted to comp.lang.lisp (I'm assuming you are allchemist) and it doesn't work. I'll need to clean that up. I think your use of :data is on the right track but you'll have to make your array with c-array:make-ffa if you want to use it in GSL.
In general I think it would be a good idea to be able easily go back and forth between CL and marrays.
1+ (or equivalently (incf *interested-in-this-issue*))
I'm not sure the best way to do that at present and what changes need to be made. I'll have to think about it. Unfortunately I won't be able to get to this for a while.
Liam
On Wed, Apr 14, 2010 at 4:26 PM, ivan hohlov hohlovivan@gmail.com wrote:
Hi all!
There is a keyword :cl-array for the gsll:make-marray function. Can I use it to convert native lisp array into marray? I'm trying to do this: (defparameter *m* (make-array '(3 3) :element-type 'single-float :initial-contents '((1.0 2.0 3.0) (4.0 5.0 6.0) (7.0 8.0 9.0)))) (gsll:make-marray 'single-float :dimensions '(3 3) :cl-array *m*) leads to error "Invalid initialization argument: :cl-array". (sbcl, of course) Am I right, using :cl-array in such a way? I have searched for examples with thes key, but found nothing.
Also, if I use :data key instead of :cl-array, it works, but tue resulting marray couldn't be used in common routines, such as matrix multiplication, because it isn't simple-array.
To generalize the problem - Is it possible to convert lisp array to gsll marray without copying data?
Thanks
Gsll-devel mailing list Gsll-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/gsll-devel
OK I "fixed" this problem by removing the :cl-array keyword to make-marray, which was obsolete. The :data keyword does work; the argument should be made by make-ffa, e.g. (make-marray 'double-float :data (c-array:make-ffa 'double-float :initial-contents '(1.0d0 2.0d0))) However this isn't really intended for users; I am working on a better user interface.
Liam
On Wed, Apr 14, 2010 at 4:26 PM, ivan hohlov hohlovivan@gmail.com wrote:
Hi all!
There is a keyword :cl-array for the gsll:make-marray function. Can I use it to convert native lisp array into marray? I'm trying to do this: (defparameter *m* (make-array '(3 3) :element-type 'single-float :initial-contents '((1.0 2.0 3.0) (4.0 5.0 6.0) (7.0 8.0 9.0)))) (gsll:make-marray 'single-float :dimensions '(3 3) :cl-array *m*) leads to error "Invalid initialization argument: :cl-array". (sbcl, of course) Am I right, using :cl-array in such a way? I have searched for examples with thes key, but found nothing.
Also, if I use :data key instead of :cl-array, it works, but tue resulting marray couldn't be used in common routines, such as matrix multiplication, because it isn't simple-array.
To generalize the problem - Is it possible to convert lisp array to gsll marray without copying data?
Thanks
Gsll-devel mailing list Gsll-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/gsll-devel