Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
cs-401r:assignment-7 [2014/12/04 14:35]
ringger [Drawing from a Dirichlet]
cs-401r:assignment-7 [2014/12/04 14:55] (current)
cs401rpml [Multivariate Beta Function]
Line 93: Line 93:
 The multivariate beta function can be implemented according to its definition using the gamma function. ​ The gamma function is implemented in Apache commons (http://​commons.apache.org/​proper/​commons-math/​userguide/​special.html ) The multivariate beta function can be implemented according to its definition using the gamma function. ​ The gamma function is implemented in Apache commons (http://​commons.apache.org/​proper/​commons-math/​userguide/​special.html )
  
 +<​code>​ 
 +public static double logBeta(double[] alpha) { 
 + double sum = Gamma.logGamma(alpha[0]);​ 
 + for (int i = 1; i < alpha.length;​ i++) { 
 + sum += Gamma.logGamma(alpha[i]);​ 
 +
 + return sum - Gamma.logGamma(DoubleArrays.sum(alpha));​ 
 +
 +</​code>​
cs-401r/assignment-7.txt · Last modified: 2014/12/04 14:55 by cs401rpml
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0