Fork me on GitHub
#uncomplicate
<
2016-08-29
>
blueberry16:08:54

Default matrix is column-oriented. If you need row-orientation, call trans, which transposes it without cost.

blueberry16:08:19

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...

blueberry16:08:26

So, you'd need to try.

blueberry16:08:55

@adebesin In this case, probably something like:

blueberry16:08:32

(def a (sge 3 2 (range 6)))

blueberry16:08:47

(def x (sv [1 1 1]))

blueberry16:08:02

(def col-sums (sv 2))

blueberry16:08:21

(mv! (trans a) x col-sums)

blueberry16:08:44

if you want the sums of rows, do not transpose a

blueberry16:08:35

Of course, you do not have to use mv!, you con get by with mv, depending on the actual use case.

blueberry16:08:29

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)

blueberry16:08:22

There are many more subtle helpers that can help you with low-level optimizations

kazuwal16:08:52

OK cool.. I would want it to perform well on large matrices

kazuwal16:08:06

@blueberry are you talking at Clojure Conj? or Euro Clojure..? I heard on the defn podcast 🙂

blueberry16:08:21

EuroClojure 🙂

kazuwal16:08:37

Cool! looking forward to it

blueberry16:08:45

I'll see, maybe I'll submit a talk to Clojure/West

blueberry16:08:56

You are coming to Bratislava?

kazuwal16:08:34

Unfortunately not I cant get time off work at the moment.. sucks 😞

blueberry16:08:29

yep, a couple of days there would be a nice mini vacation. Bratislava is rather cute.

blueberry16:08:47

But, ok, there is ClojureTV, at least you'll be able to hear the talk

kazuwal16:08:51

Yes I am really looking forward to it as your project is fantastic

blueberry17:08:13

Thank you very much 🙂 Please do not hesitate to write about that, share examples, etc...

kazuwal17:08:10

I will 🙂 and good luck at EuroClojure

blueberry17:08:45

Thanks. BTW, have you tried GPU, or you are just using the CPU engine?

blueberry17:08:42

and what is your OS? Did you have any issues installing neanderthal?

kazuwal17:08:02

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.

blueberry17:08:06

OK. If you need any help with that, please ask

kazuwal17:08:27

Cool thanks 🙂