Element types are dependent on the implementation. Some implementations 
support arbitrary (Object) data types - this includes the default 
implementation that supports Clojure persistent vectors, e.g. [1 nil :foo] 
is a valid vector. Mathematical operations on such vectors use standard 
functions e.g. clojure.core/+, so they will work on any numeric types 
(including rationals).

Other implementations are specialised to specific types, e.g. vectorz-clj 
supports primitive double types only. This means more performance at the 
expense of data type flexibility.

Also worth noting that Dmitry Groshev is working on a general purpose 
NDArray implementation for the 2013 Google Summer of Code project, which 
should support a wider variety of types.

On Wednesday, 10 July 2013 22:06:31 UTC+1, Brian Craft wrote:
>
> How are data types handled in core.matrix? I was surprised to see it 
> returning rationals rather than floats. I don't see a way to control this 
> in the api, e.g. like dtype in numpy.
>
> (element-type) is returning java.lang.Object for all inputs. Does this 
> mean I'm creating arrays of clojure's wrapped numerical types? Is this 
> because I haven't specified a non-default implementation?
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to