I tried with vectorz here: https://github.com/malloc82/imaging/blob/45475b99f564b1ac77e668e04b91cb9c01a096d7/src/imaging/dicom.clj#L130-L161 and I'm really impressed with it's performance. The performance is shown here:
imaging.dicom> (def data3 (timer "total: " (load-txt-image_matrix "resources/PCT/CTP404_merged/x_11.txt"))) ==> timing: loading txt data 728.267621 ms ==> timing: max 25.00652 ms ==> timing: min 25.575979 ms ==> timing: update pixel values 111.647122 ms ==> timing: total: 926.00495 ms Just wondering though, is there a faster way to load an array than this way? https://github.com/malloc82/imaging/blob/45475b99f564b1ac77e668e04b91cb9c01a096d7/src/imaging/dicom.clj#L138 the data file I'm trying to read from contains text based pixel values. Thanks. On Wednesday, June 10, 2015 at 5:01:25 PM UTC-5, Mikera wrote: > > Consider using core.matrix with vectorz-clj for operations on large > numerical arrays / vectors of doubles. It is a *lot* faster than using > Clojure vectors for this kind of scenario, plus it has a lot of helpful > array operations already defined. > > (use 'clojure.core.matrix) > (def v (array :vectorz (range 1280000))) > > (time (emax v)) > => 1279999.0 > "Elapsed time: 1.179533 msecs" > > > On Wednesday, 10 June 2015 21:07:09 UTC+1, Ritchie Cai wrote: >> >> I'm working on a java array of double with 1280000 elements. I need the >> max and min values of the array. So I initially tried areduce and loop, >> both gives runs around 20 seconds. But when try (apply max (vec array)) I >> get result under 90 ms. >> Can anyone explain why there is such a big difference? >> Also if want to iterate large java array like this to do some other >> operations, e.g. convolution, what's the best way to go? Is there another >> fast way to iterate through array or do I need to convert array into vector? >> >> Thanks >> Ritchie >> >> -- 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.