import mir.test: shouldApprox; 2.0.gammaLPDF(3.0).shouldApprox == -1.306853; 2.0.gammaLPDF(3.0, 4.0).shouldApprox == -3.965736; // Calling with `size_t` uses log factorial function instead of log gamma, // but produces same results 2.0.gammaLPDF(3).shouldApprox == 2.0.gammaLPDF(3.0); 2.0.gammaLPDF(3, 4.0).shouldApprox == 2.0.gammaLPDF(3.0, 4.0);
Computes the gamma log probability density function (LPDF).
shape values less than 1 are supported when it is a floating point type.
If shape is passed as a size_t type (or a type convertible to that), then the LPDF is calculated using the relationship with the poisson distribution (i.e. replacing the logGamma function with the logFactorial).