                  (< tries 50))
       this-p
       (let [[h this-p] (hbeta d-i (calc-beta))]
-        (recur (m/sub h log-u)
+        (recur nil
+               (m/sub h log-u)
                this-p
-               (inc tries)))))
-  )
+               (inc tries))))))
 
 (defn x2p
   "Performs a binary search to get P-values in such a way that each conditional Gaussian has the same perplexity."

                 sum-x)
        p (m/zero-matrix nr nr)
        beta (one-matrix nr 1)
        log-u (i.core/log perplexity)]

    ))

(defn p-values
  [^Matrix matrix perplexity]

  ;88             (H, thisP) = Hbeta(Di, beta[i]);
  ;89             Hdiff = H - logU;
  ;90             tries = tries + 1;
  (loop [d-i nil
         h-diff h-diff
         this-p (i.core/matrix [] [])
         tries 0]
    ;71         while Math.abs(Hdiff) > tol and tries < 50:
