Skip to content

Instantly share code, notes, and snippets.

View simonholgate's full-sized avatar

Simon Holgate simonholgate

View GitHub Profile
(ns testincanter.core
(:import (cern.colt.matrix.tdouble DoubleFactory2D DoubleMatrix2D)
(cern.jet.random.tdouble.engine DRand)
(cern.jet.math.tdouble DoubleFunctions)
(java.util Date)))
(defn test-multi [n]
(let [xs (.assign (.make DoubleFactory2D/dense n 23) (DRand. (Date.)))]
(time (let [result (.zMult xs xs nil 1 0 true false)]
[(.columns result) (.rows result)]))))
@simonholgate
simonholgate / matrix.py
Created January 18, 2012 09:44 — forked from sritchie/matrix.py
timing matrix multiplication
(defn feature-vec [n]
(map (partial cons 1)
(for [x (range n)]
(take 22 (repeatedly rand)))))
(defn dot-product [x y]
(reduce + (map * x y)))
(defn transpose
"returns the transposition of a `coll` of vectors"