Default matrix is column-oriented. If you need row-orientation, call trans, which transposes it without cost.
Of course, you can take cols as a sequence and call sum or asum on each col, and it might even be faster on matrices with small number of columns...
So, you'd need to try.
@adebesin In this case, probably something like:
(def a (sge 3 2 (range 6)))
(def x (sv [1 1 1]))
(def col-sums (sv 2))
(mv! (trans a) x col-sums)
if you want the sums of rows, do not transpose a
Of course, you do not have to use mv!, you con get by with mv, depending on the actual use case.
You also do not have to provide [1 1 1] explicitly. For large matrices, it is much fastser to use (entry! (sv 10000) 1.0)
There are many more subtle helpers that can help you with low-level optimizations
OK cool.. I would want it to perform well on large matrices
@blueberry are you talking at Clojure Conj? or Euro Clojure..? I heard on the defn podcast 🙂
EuroClojure 🙂
Cool! looking forward to it
I'll see, maybe I'll submit a talk to Clojure/West
You are coming to Bratislava?
Unfortunately not I cant get time off work at the moment.. sucks 😞
yep, a couple of days there would be a nice mini vacation. Bratislava is rather cute.
But, ok, there is ClojureTV, at least you'll be able to hear the talk
Yes I am really looking forward to it as your project is fantastic
Thank you very much 🙂 Please do not hesitate to write about that, share examples, etc...
I will 🙂 and good luck at EuroClojure
Thanks. BTW, have you tried GPU, or you are just using the CPU engine?
and what is your OS? Did you have any issues installing neanderthal?
Just the CPU at the minute.. no I use a Mac so generally things work. I havent tried it on Linux yet. I dont use Windows.. but lets not go there lol. I am just getting into GPU programming atm. It is really interesting.
OK. If you need any help with that, please ask
Cool thanks 🙂