 #?(:clj (do (set! *warn-on-reflection* true)
             (set! *unchecked-math* :warn-on-boxed)))
 
-
-#?(:clj (defn timestamp [] (System/nanoTime))
-   :cljs (defn timestamp [] (.getTime (js/Date.))))
-
-(def EMPTY-VECTOR (m/new-array [0]))
-
-#?(:clj
-    (do
-      (def ^Random RAND-GENERATOR (Random.))
-
-      (defn rand-normal ^double []
-        (.nextDouble RAND-GENERATOR))
-
-      (defn rand-gaussian ^double []
-        (.nextGaussian RAND-GENERATOR)))
-    :cljs
-    (do
-      (defn rand-gaussian* [mu sigma]
-        ; This function implements the Kinderman-Monahan ratio method:
-        ;  A.J. Kinderman & J.F. Monahan
-        ;  Computer Generation of Random Variables Using the Ratio of Uniform Deviates
-        ;  ACM Transactions on Mathematical Software 3(3) 257-260, 1977
-        (let [u1  (rand)
-              u2* (rand)
-              u2 (- 1. u2*)
-              s (* 4 (/ (Math/exp (- 0.5)) (Math/sqrt 2.)))
-              z (* s (/ (- u1 0.5) u2))
-              zz (+ (* 0.25 z z) (Math/log u2))]
-          (if (> zz 0)
-            (recur mu sigma)
-            (+ mu (* sigma z)))))
-
-      (defn rand-normal []
-        (rand))
-
-      (defn rand-gaussian []
-        (rand-gaussian* 0 1.0))))
-
-(defn ms-elapsed
-  ([start]
-    (ms-elapsed start (timestamp)))
-  ([start end]
-    (let [start (double start)
-          end (double end)]
-      #?(:clj  (/ (- end start) 1000000.0))
-         :cljs (- end start))))
+;;;; Mathematics
 
 (defn tanh'
   "Compute the derivative of the tanh function for a given output.  Works on any array shape.

  [y]
  (m/emul y (m/sub 1.0 y)))

(defn weight-matrix
  "Creates a randomised weight matrix.


          relative-error))
      (range (m/column-count input)))))

(defn estimate-gradient
  "Computes a numerical approximation of the derivative of the function f at with respectr to input x"
  ([f x]
   (let [x+dx (m/add )])))
