commit d670b89c4d942c584b4730ab99fe6f3eb6b78b1a
parent 071bf00d7ab69fca045fbc7494c5d973f687fc6f
Author: NunoSempere <nuno.sempere@protonmail.com>
Date: Thu, 1 Dec 2022 23:57:45 +0000
tweak: cleanup.
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/C/samples/samples.c b/C/samples/samples.c
@@ -74,7 +74,7 @@ void mixture(gsl_rng * r, double *dists[], double *weights, int n, double *resul
double cummulative_weights[n];
cumsum(normalized_weights, cummulative_weights, n);
- /* Get N uniformly distributed vars */
+ /* Get N samples, drawn from the different distributions in proportion to their weights. */
for(int i=0; i<N; i++){
double p_1 = gsl_rng_uniform(r);
double p_2 = gsl_rng_uniform(r);
@@ -98,8 +98,6 @@ void mixture(gsl_rng * r, double *dists[], double *weights, int n, double *resul
results[i] = dists[index_counter][sample_index];
}
}
-
-
}
/* Main */
@@ -128,7 +126,7 @@ int main(void){
/* Generate mixture */
int n = 4;
- double weights[] = { 1 - p_c, p_c/2, p_c/4, p_c/4};
+ double weights[] = { 1 - p_c, p_c/2, p_c/4, p_c/4 };
double *dists[] = { dist_none, dist_one, dist_few, dist_many };
mixture(r, dists, weights, n, dist_mixture);
diff --git a/README.md b/README.md
@@ -39,6 +39,9 @@ I was very surprised that Node/Squiggle code was almost as fast as the raw C cod
The future of this project is uncertain. In most words, I simply forget about this repository.
+To do:
+- [ ] Check whether the Squiggle code is producing 1M samples.
+
## Other similar projects
- Squigglepy: <https://github.com/rethinkpriorities/squigglepy>