squiggle.c

Self-contained Monte Carlo estimation in C99
Log | Files | Refs | README

commit f5af776eb360503e038df733a00a400703e33ae5
parent 7a2015e3e0b21813debbd6752ce2a77bd370b4ec
Author: NunoSempere <nuno.sempere@protonmail.com>
Date:   Sun, 16 Jul 2023 21:37:43 +0200

formatting pass.

Diffstat:
Mexamples/04_sample_from_cdf_simple/example.c | 2+-
Mexamples/05_sample_from_cdf_beta/example.c | 2+-
Msquiggle.c | 7+++----
Msquiggle.h | 1-
4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/examples/04_sample_from_cdf_simple/example.c b/examples/04_sample_from_cdf_simple/example.c @@ -1,9 +1,9 @@ +#include "../../squiggle.h" #include <math.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <time.h> -#include "../../squiggle.h" #define NUM_SAMPLES 1000000 diff --git a/examples/05_sample_from_cdf_beta/example.c b/examples/05_sample_from_cdf_beta/example.c @@ -1,9 +1,9 @@ +#include "../../squiggle.h" #include <math.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <time.h> -#include "../../squiggle.h" #define NUM_SAMPLES 1000000 #define STOP_BETA 1.0e-8 diff --git a/squiggle.c b/squiggle.c @@ -1,11 +1,10 @@ +#include <float.h> +#include <limits.h> #include <math.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> -#include <float.h> -#include <limits.h> #include <time.h> -// #include <sys/types.h> #define EXIT_ON_ERROR 0 #define MAX_ERROR_LENGTH 500 #define PROCESS_ERROR(...) \ @@ -132,7 +131,7 @@ float mixture(float (*samplers[])(uint32_t*), float* weights, int n_dists, uint3 return result; } -// Sample from an arbitrary cdf +// Sample from an arbitrary cdf struct box { int empty; float content; diff --git a/squiggle.h b/squiggle.h @@ -55,4 +55,3 @@ struct box sampler_box_cdf(struct box cdf(float), uint32_t* seed); struct box sampler_float_cdf(float cdf(float), uint32_t* seed); #endif -