On Tue, Nov 16, 2010 at 3:56 PM, Liam Healy lhealy@common-lisp.net wrote:
On Tue, Nov 16, 2010 at 2:23 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
I can go from foreign arrays to cl-arrays:
(grid:copy-to #m(1.0d0 2.0d0) 'grid::array)
(although the use of the *internal* symbol `array' puzzles me)
So, why did you use it? (copy-to #m(1.0d0 2.0d0) 'array) #(1.0d0 2.0d0) works just fine.
Hmm, now it works here too :-(
CL-USER> (grid:copy-to #m(1d0 2d0) 'array) #(1.0d0 2.0d0)
but I cannot do the converse:
(grid:copy-to #(1.0d0 2.0d0) 'grid:foreign-array)
That's because #(1.0d0 2.0d0) makes a vector without a specific element type, which foreign-arrays require (type-of #(1.0d0 2.0d0)) (SIMPLE-VECTOR 2)
(type-of (make-array 2 :element-type 'double-float :initial-contents '(1.0d0 2.0d0))) (SIMPLE-ARRAY DOUBLE-FLOAT (2))
(copy-to (make-array 2 :element-type 'double-float :initial-contents '(1.0d0 2.0d0)) 'grid:foreign-array) #m(1.0d0 2.0d0)
Thanks,
Mirko