commit c3de336a5b48ec471cd547a656ee43bf1f1c65d8
parent 95cedff3abccbeb27852109a2c87db5973799928
Author: NunoSempere <nuno.sempere@protonmail.com>
Date: Thu, 14 Dec 2023 12:37:12 +0000
rename sample_normal_from_90_ci and add to squiggle.h
Diffstat:
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/squiggle.c b/squiggle.c
@@ -70,7 +70,7 @@ double sample_lognormal(double logmean, double logstd, uint64_t* seed)
return exp(sample_normal(logmean, logstd, seed));
}
-inline double sample_normal_from_90_confidence_interval(double low, double high, uint64_t* seed)
+double sample_normal_from_90_ci(double low, double high, uint64_t* seed)
{
// Explanation of key idea:
// 1. We know that the 90% confidence interval of the unit normal is
@@ -101,10 +101,10 @@ double sample_to(double low, double high, uint64_t* seed)
// returns a sample from a lognorma with a matching 90% c.i.
// Key idea: If we want a lognormal with 90% confidence interval [a, b]
// we need but get a normal with 90% confidence interval [log(a), log(b)].
- // Then see code for sample_normal_from_90_confidence_interval
+ // Then see code for sample_normal_from_90_ci
double loglow = log(low);
double loghigh = log(high);
- return exp(sample_normal_from_90_confidence_interval(loglow, loghigh, seed));
+ return exp(sample_normal_from_90_ci(loglow, loghigh, seed));
}
double sample_gamma(double alpha, uint64_t* seed)
diff --git a/squiggle.h b/squiggle.h
@@ -15,6 +15,7 @@ double sample_unit_normal(uint64_t* seed);
double sample_uniform(double start, double end, uint64_t* seed);
double sample_normal(double mean, double sigma, uint64_t* seed);
double sample_lognormal(double logmean, double logsigma, uint64_t* seed);
+double sample_normal_from_90_ci(double low, double high, uint64_t* seed);
double sample_to(double low, double high, uint64_t* seed);
double sample_gamma(double alpha, uint64_t* seed);