diff --git a/scratchpad/scratchpad b/scratchpad/scratchpad index b1224e6..57601d6 100755 Binary files a/scratchpad/scratchpad and b/scratchpad/scratchpad differ diff --git a/scratchpad/scratchpad.c b/scratchpad/scratchpad.c index 238b8cc..d49fe56 100644 --- a/scratchpad/scratchpad.c +++ b/scratchpad/scratchpad.c @@ -21,7 +21,7 @@ return error; \ } \ } while (0) -#define NUM_SAMPLES 10 +#define NUM_SAMPLES 1000000 struct box { int empty; @@ -399,7 +399,7 @@ void test_and_time_sampler_float(char* cdf_name, float cdf_float(float), uint32_ if (sample.empty) { printf("Error in sampler function for %s", cdf_name); } else { - printf("%f\n", sample.content); + // printf("%f\n", sample.content); } } clock_t end = clock(); @@ -416,7 +416,7 @@ void test_and_time_sampler_box(char* cdf_name, struct box cdf_box(float), uint32 if (sample.empty) { printf("Error in sampler function for %s", cdf_name); } else { - printf("%f\n", sample.content); + // printf("%f\n", sample.content); } } clock_t end = clock(); @@ -451,7 +451,7 @@ int main() for (int i = 0; i < NUM_SAMPLES; i++) { float normal_sample = sampler_normal_0_1(seed); - printf("%f\n", normal_sample); + // printf("%f\n", normal_sample); } clock_t end_2 = clock(); @@ -460,6 +460,11 @@ int main() // Test box sampler test_and_time_sampler_box("cdf_beta", cdf_beta, seed); + // Ok, this is slower than python!! + // Partly this is because I am using a more general algorithm, + // which applies to any cdf + // But I am also using really anal convergence conditions. + // This could be optimized. free(seed); return 0; diff --git a/to-do.md b/to-do.md index 02b71ee..2eb1eb1 100644 --- a/to-do.md +++ b/to-do.md @@ -6,6 +6,11 @@ - [x] Chain various mixture functions - [ ] Have some more complicated & realistic example - [ ] Add summarization functions, like mean, std, 90% ci (or all c.i.?) -- [ ] Add beta distribution +- [x] Add beta distribution + - See for a faster method. - [ ] Use OpenMP for acceleration -- [ ] Add function to get sample when given a cdf +- [x] Add function to get sample when given a cdf +- [ ] Don't have a single header file. +- [ ] Structure project a bit better +- [ ] Add README +- [ ] Publish