[GSLL-devel] gsd/grid: cannot convert #(...doubles...) to #m(...doubles...)

Liam Healy lhealy at common-lisp.net
Tue Nov 16 20:56:29 UTC 2010


On Tue, Nov 16, 2010 at 2:23 PM, Mirko Vukovic <mirko.vukovic at 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.

>
> 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)

>
> There is no class named GRID::VECTOR-T.
>   [Condition of type SIMPLE-ERROR]
>
> Restarts:
>  0: [RETRY] Retry SLIME REPL evaluation request.
>  1: [*ABORT] Return to SLIME's top level.
>  2: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread"
> RUNNING {BD57319}>)
>
> Backtrace:
>  0: (SB-PCL::FIND-CLASS-FROM-CELL GRID::VECTOR-T NIL T)
>  1: ((SB-PCL::FAST-METHOD MAKE-INSTANCE (SYMBOL)) #<unavailable
> argument> #<unavailable argument> GRID::VECTOR-T)[:EXTERNAL]
>  2: ((SB-PCL::FAST-METHOD GRID::MAKE-GRID-DATA ((EQL
> 'GRID:FOREIGN-ARRAY) T T)) #<unavailable argument> #<unavailable
> argument> #<unavailable argument> (2) (T))[:EXTERNAL]
>  3: (GRID:MAP-N-GRIDS)[:EXTERNAL]
>  4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (GRID:COPY-TO #(1.0d0 2.0d0)
> 'GRID:FOREIGN-ARRAY) #<NULL-LEXENV>)
>
>
> I get the same results with the function `copy-to'
>
> I get the same problem if I am in the package :grid.
>
> From tracing the call tree, I think that the `T' vector-T stems from a
> call to `array-element-type' which under SBCL gives the following:
>
> GRID> (array-element-type #(1.0 2.0))
> T

Perhaps this error message should be improved.

>
> Thanks,
>
> Mirko
>




More information about the gsll-devel mailing list