This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns test.hbase | |
(:require (cascalog [workflow :as w] | |
[ops :as c] | |
[vars :as v])) | |
(:import (org.apache.hadoop.hbase.util Bytes) | |
(com.twitter.maple.hbase HBaseTap HBaseScheme) | |
(cascading.hbase ByteHolder))) | |
(use '[cascalog api playground]) | |
(bootstrap-emacs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)])))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn clob-to-string [clob] | |
"Turn an Oracle Clob into a String" | |
(with-open [rdr (java.io.BufferedReader. (.getCharacterStream clob))] | |
(apply str (line-seq rdr)))) | |
(with-connection mydb | |
(transaction | |
(with-query-results rs ["select documentation from station"] | |
; rs will be a sequence of maps, | |
; one for each record in the result set. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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" |