Ah - that is expected behaviour because you are using the specialised 
vector-only operators in "mikera.vectorz.core". These are fast type-hinted 
versions of functions (that only work on vectors).

If you want to use the broadcasting operations that work with different 
types, you need to use the operators in "clojure.core.matrix.operators". In 
general, it is usually better to use the core.matrix API as it provides 
more capabilities and flexibility.

It would be nice if one version could do everything, however currently 
Clojure doesn't allow overloading functions on type, so we need to have the 
different namespaces.

On Thursday, 11 July 2013 14:37:06 UTC+1, P Martin wrote:
>
> I am having a similar error, but it is happening for the vectors. I just 
> updated to the 0.11.0 version of vectorz. I have the following project file:
>
> [org.clojure/clojure "1.5.1"]
>
> [incanter/incanter-core "1.5.1"]
>
> [incanter/incanter-charts "1.5.1"]
>
> [net.mikera/vectorz-clj "0.11.0"]
>
>
> And I get an error when I try to add a scalar to a vector:
>
> (require '[mikera.vectorz.core :as vz])
>
> (vz/+ 5 (vec [1 2 3]))
>
>
> ClassCastException java.lang.Long cannot be cast to 
> mikera.vectorz.AVector  mikera.vectorz.core/clone (core.clj:38)
>
>
> Any suggestions? Is there anything else I need to do to my repl? Am I just 
> misusing the API?
>
> Patrick
>
> On Thursday, July 11, 2013 8:57:30 AM UTC-4, Mikera wrote:
>>
>> Hi Brian,
>>
>> I've released a new vectorz-clj version to Clojars which should fix the 
>> problem:
>>
>> [net.mikera/vectorz-clj "0.11.0"]
>>
>> Hopefully that works for you!
>>
>> On Thursday, 11 July 2013 00:44:46 UTC+1, Brian Craft wrote:
>>>
>>> Without vectorz:
>>>
>>> => (+ 5 (matrix [1 2 3]))
>>> [6 7 8]
>>>
>>> With vectorz:
>>>
>>> => (+ 5 (matrix [1 2 3]))
>>> ClassCastException java.lang.Double cannot be cast to 
>>> mikera.arrayz.INDArray  mikera.vectorz.matrix-api/eval12140/fn--12145 
>>> (matrix_api.clj:644)
>>>
>>>
>>>
>>>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to