quil-lang/magicl

FROM-ARRAY infers the type of an array incorrectly

colescott opened this issue · 1 comments

When running
CL-USER> (magicl:from-array (make-array '(3) :initial-contents '(3d0 3d0 3d0)) '(3))
I get an error of
no compatible tensor constructor for type T

This is because FROM-ARRAY by default specializes the tensor on the ARRAY-ELEMENT-TYPE of the input array when TYPE is not specified. This should be changed to inspect the first element in the case that ARRAY-ELEMENT-TYPE is T.

I have been encountering this error on the current master branch regardless of the dimensions of the array, including if it is a simple vector. from-list works fine, however.

(if relevant, I'm on a windows computer with SBCL)