add some thoughts to scratchpad and readme

This commit is contained in:
NunoSempere 2023-07-16 17:59:53 +02:00
parent 65756a359b
commit cd6eb5203c
3 changed files with 16 additions and 6 deletions

Binary file not shown.

View File

@ -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;

View File

@ -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 <https://stats.stackexchange.com/questions/502146/how-does-numpy-generate-samples-from-a-beta-distribution> 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