Permalink
Browse files

assertion to ensure matching dimension in log-pdf-dirichlet

  • Loading branch information...
1 parent efcb676 commit 846342a9543e572e228b46726176e8466b6867ee Nils committed Feb 18, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/probabilistic_clojure/embedded/choice_points.clj
@@ -86,6 +86,8 @@ of probabilistic choice points."}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn log-pdf-dirichlet [ps alphas]
+ (assert (= (count ps) (count alphas))
+ "Dimension mismatch in log-pdf-dirichlet!")
(let [log-gamma (fn [x] (Gamma/logGamma x))
norm (- (reduce + (map log-gamma alphas))
(log-gamma (reduce + alphas)))]

0 comments on commit 846342a

Please sign in to comment.