add parallelism to sampling

This commit is contained in:
NunoSempere 2023-11-29 23:28:31 +00:00
parent 58a329bcc3
commit b22eb34835
17 changed files with 4 additions and 3 deletions

View File

@ -308,7 +308,7 @@ Overall, I'd describe the error handling capabilities of this library as pretty
## To do list
- [ ] Write better confidence interval code that:
- [x] Write better confidence interval code that:
- Gets number of samples as an input
- Gets either a sampler function or a list of samples
- is O(n), not O(nlog(n))

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -115,9 +115,10 @@ ci array_get_90_ci(double xs[], int n)
ci sampler_get_ci(ci interval, double (*sampler)(uint64_t*), int n, uint64_t* seed)
{
double* xs = malloc(n * sizeof(double));
for (int i = 0; i < n; i++) {
/*for (int i = 0; i < n; i++) {
xs[i] = sampler(seed);
}
}*/
sampler_parallel(sampler, xs, 16, n);
ci result = array_get_ci(interval, xs, n);
free(xs);
return result;