Thank you very much for your replies. I will definitely take a look at core.matrix. I really hate the fact that I had to use Java arrays to make it fast. I'll take a look at transducers as well.
Kind regards, Jose. On Monday, December 22, 2014 7:09:27 PM UTC-5, Christopher Small wrote: > > I'll second the use of core.matrix. It's a wonderful, idiomatic, fast > library, and I hope to see folks continue to rally around it. > > > On Monday, December 22, 2014 3:47:59 AM UTC-7, Mikera wrote: >> >> For most array operations (e.g. dot products on vectors), I strongly >> recommend trying out the recent core.matrix implementations. We've put a >> lot of effort into fast implementations and a nice clean Clojure API so I'd >> love to see them used where it makes sense! >> >> For example vectorz-clj can be over 100x faster than a naive map / reduce >> implementation: >> >> (let [a (vec (range 10000)) >> b (vec (range 10000))] >> (time (dotimes [i 100] (reduce + (map * a b))))) >> "Elapsed time: 364.590211 msecs" >> >> (let [a (array :vectorz (range 10000)) >> b (array :vectorz (range 10000))] >> (time (dotimes [i 100] (dot a b)))) >> "Elapsed time: 3.358484 msecs" >> >> On Monday, 22 December 2014 17:31:41 UTC+8, Henrik Eneroth wrote: >>> >>> Interesting read Jose, thanks! >>> >>> It might be interesting to try a transducer on >>> >>> (defn dot-prod >>> "Returns the dot product of two vectors" >>> [v1 v2] >>> (reduce + (map * v1 v2))) >>> >>> if you can get your hands on the 1.7 alpha and the time and inclination >>> to do it. Transducers have shown to be faster than running functions in >>> sequence. Although I don't know how likely they are to beat native arrays, >>> probably not very much. >>> >> -- 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/d/optout.