Complex types are specified as (complex double-float), (complex single-float), etc. These work:
(map-grid :source #1m(-1d0 -2d0 -3d0) :element-function #'sqrt :destination-specification '((foreign-array 3) (complex double-float))) #2m(#C(0.0d0 1.0d0) #C(0.0d0 1.4142135623730951d0) #C(0.0d0 1.7320508075688772d0))
(make-instance 'vector-complex-double-float :dimensions '(3) :element-type '(complex double-float)) #2m(#C(0.0d0 0.0d0) #C(0.0d0 0.0d0) #C(0.0d0 0.0d0))
Note: you need to pull the latest version of GSD for the first case to work, 307ba9efba fixes a bug in using the type specification.
Liam
On Fri, Nov 19, 2010 at 4:04 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
Hi,
I am reporting this in case it is a gsd bug (it must be a bug somewhere: in my head, my setup, or gsd)
Mapping the `sqrt' function over a vector of negative numbers as follows:
grid> (map-grid :source #1m(-1d0 -2d0 -3d0) :element-function #'sqrt :destination-specification '((foreign-array 3) complex-double-float))
gives an error:
Element type COMPLEX-DOUBLE-FLOAT not permitted. [Condition of type SIMPLE-ERROR]
I traced it to a `make-instance' statement.
I also tried to instantiate a vector-complex-double-float object
grid> (make-instance 'vector-complex-double-float :dimensions '(3) :element-type 'complex-double-float)
that resulted in the same error message.
Mirko
GSLL-devel mailing list GSLL-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/gsll-devel