-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a single instance of the standard normal distribution
The distribution is immutable. The underlying computations use static methods and can be used across threads. Note: A micro-optimisation to eliminate the mean=0 and SD=1 from the computations used from NormalDistribution(0, 1) has not been performed to aid maintenance. It is presumed that multiplication by 1 or addition of 0 is insignificant compared to the calls to: - Math.exp (density) - Erf.value (cumulativeProbability) - InverseErf.value (inverseCumulativeProbability) Only the logDensity function would be expected to improve performance as it would eliminate 1 subtraction and 1 devision to leave the computation as 2 multiplications and a subtraction: return -0.5 * x * x - halfLog2Pi
- Loading branch information
Showing
1 changed file
with
12 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters