Skip to content

Instantly share code, notes, and snippets.

@w01fe
Created July 10, 2013 06:57
Show Gist options
  • Save w01fe/5964019 to your computer and use it in GitHub Desktop.
Save w01fe/5964019 to your computer and use it in GitHub Desktop.
hiphip_mathy_ops.clj
(defn standard-deviation [xs]
(let [mean (dbl/amean xs)
mean-sq (/ (dbl/asum [x xs] (* x x))
(dbl/alength xs))]
(Math/sqrt (- mean-sq (* mean mean)))))
(= 1 (dbl/amax-index (double-array [1.0 3.0 2.0])))
(defn max-normalize [xs]
(let [m (dbl/amax xs)]
(afill! [x xs] (/ x m))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment