diff options
author | Arun Isaac | 2021-02-23 16:18:55 +0530 |
---|---|---|
committer | Arun Isaac | 2021-02-23 16:18:55 +0530 |
commit | aa8f62acf46a3b9d05ca675044edac15213b7095 (patch) | |
tree | fdc1bc99c5d61e87e52c1011bbe938226d5672c9 /src | |
parent | e30062aa1be751db14fb986b4f1a941c90f9ad37 (diff) | |
download | nsmc-aa8f62acf46a3b9d05ca675044edac15213b7095.tar.gz nsmc-aa8f62acf46a3b9d05ca675044edac15213b7095.tar.lz nsmc-aa8f62acf46a3b9d05ca675044edac15213b7095.zip |
Implement uniform-true-volume without log.
Logarithmic functions trip up when their parameter is 0.
* src/oracles.sc (uniform-true-volume): Implement without log.
Diffstat (limited to 'src')
-rw-r--r-- | src/oracles.sc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/oracles.sc b/src/oracles.sc index 173ac75..4182683 100644 --- a/src/oracles.sc +++ b/src/oracles.sc @@ -24,13 +24,12 @@ ;; TODO: Verify the accuracy of this function for non-trivial a, b. (define (uniform-true-volume dimension -params) (double (unsigned int) void*) - (let* ((params (const uniform-params*) (convert-type -params uniform-params*))) - (return (- (exp (+ (ln-volume-of-ball dimension) - (* dimension (log (: params b))) - (- (log (+ dimension 1))))) - (exp (+ (ln-volume-of-ball dimension) - (* dimension (log (: params a))) - (- (log (+ dimension 1))))))))) + (let* ((params uniform-params* (convert-type -params uniform-params*))) + (return (* (volume-of-ball dimension) + (- (/ (gsl-pow-uint (: params b) (+ dimension 1)) + (+ dimension 1)) + (/ (gsl-pow-uint (: params a) (+ dimension 1)) + (+ dimension 1))))))) (define (beta-extent-oracle r x -params) (double (const gsl-rng*) (const gsl-vector*) void*) (let* ((params (const beta-params*) (convert-type -params beta-params*))) |