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 matrix-comp.core) | |
(require '[clojure.math :refer (sqrt)]) | |
(require '[clojure.core.matrix :refer (matrix mget add mul inverse det set-current-implementation dot mmul eseq)]) | |
(require '[clojure.core.matrix.linear :refer (norm)]) | |
(require '[criterium.core :refer :all]) | |
(require '[fastmath.matrix :as fm]) | |
(require '[fastmath.vector :as fv]) | |
(import '[mikera.matrixx Matrix Matrixx]) | |
(import '[mikera.vectorz Vector]) |
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
;; | |
(setq gc-cons-threshold 10000000) | |
;; Restore after startup | |
(add-hook 'after-init-hook | |
(lambda () | |
(setq gc-cons-threshold 1000000) | |
(message "gc-cons-threshold restored to %S" | |
gc-cons-threshold))) |
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
;; | |
(setq gc-cons-threshold 10000000) | |
;; Restore after startup | |
(add-hook 'after-init-hook | |
(lambda () | |
(setq gc-cons-threshold 1000000) | |
(message "gc-cons-threshold restored to %S" | |
gc-cons-threshold))) |
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
(require '[clojure.set] | |
'[tablecloth.api :as api]) | |
(defprotocol IndexProto | |
(slice-idx [idx ks] [idx from to] [idx from from-inclusive? to to-inclusive?] | |
"Slice by keys or range") | |
(select-by-idx [idx ks] [idx from to] | |
"Select by keys or range")) | |
;; TreeMap as an index |
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 format-sequence | |
"Format sequence of doubles" | |
(:require [clojure.pprint :refer [cl-format]] | |
[clojure.test :refer [deftest is]])) | |
(set! *warn-on-reflection* true) | |
(set! *unchecked-math* :warn-on-boxed) | |
;; maximum double power for precise calculations | |
(def ^:private ^:const ^long kp-max 22) |
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
;; MOVED! https://github.com/genmeblog/techtest/blob/master/src/techtest/core.clj | |
(ns testing.dataset | |
(:require [tech.ml.dataset :as ds] | |
[tech.ml.dataset.column :as col] | |
[tech.v2.datatype.functional :as dfn])) | |
;; Working thrugh R `data.table` type and confronting with tech.ml.dataset | |
;; https://cran.r-project.org/web/packages/data.table/vignettes/datatable-intro.html |
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 tablesaw-test | |
(:import [tech.tablesaw.io.csv CsvReadOptions CsvReader])) | |
(def ^CsvReader csv-reader (CsvReader.)) | |
(defn load-csv-data | |
([file] (load-csv-data file nil)) | |
([^String file {:keys [separator line-ending header?] | |
:or {separator \, line-ending "\n" header? true}}] | |
(let [builder (doto (CsvReadOptions/builder file) |
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
;; Better interpolation functions for calculating temperature colors | |
;; Reference: http://www.zombieprototypes.com/?p=210 | |
;; Data: http://www.vendian.org/mncharity/dir3/blackbody/UnstableURLs/bbr_color.html | |
;; use fastmath and clojure2d libraries | |
(ns black-body.temperature | |
(:require [fastmath.core :as m] | |
[fastmath.interpolation :as i] |
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
int gffSize = 30; // field density | |
int rays = 150; | |
float rsteps = TWO_PI / rays; | |
float[][] gff; | |
void setup() { | |
size(800,800); | |
smooth(8); | |
noStroke(); | |
fill(235); |
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
ArrayList<PVector> points = new ArrayList<PVector>(); | |
float step = random(0.01, 0.05); // random step | |
Folds vector_field = new Folds(); // random vector field | |
float noise_scale = random(-2,2); // noise scaler | |
void setup() { | |
size(600, 600); | |
noStroke(); | |
smooth(8); |