README tweaks, free seed in examples

This commit is contained in:
NunoSempere 2023-07-23 10:09:34 +02:00
parent 08eb790a6d
commit 2131524017
10 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# Squiggle.c
A self-contained C99 library that provides a subset of [Squiggle](https://www.squiggle-language.com/)'s functionality in C.
A self-contained C99 library that provides a subset of [Squiggle](https://www.squiggle-language.com/)'s functionality in C. It should be fast, but at the margin, simplicity of implementation wins over speed.
## Why C?
@ -79,6 +79,8 @@ Behaviour on error can be toggled by the `EXIT_ON_ERROR` variable. This library
## To do list
- [ ] Explain correlated samples
- [ ] Add tests in Stan?
- [ ] Have some more complicated & realistic example
- [ ] Add summarization functions: 90% ci (or all c.i.?)
- [ ] Systematize references

Binary file not shown.

View File

@ -39,6 +39,7 @@ int main(){
float result_one = sample_mixture(samplers, weights, n_dists, seed);
printf("result_one: %f\n", result_one);
free(seed);
}
/*

Binary file not shown.

View File

@ -48,6 +48,7 @@ int main(){
printf("%.2f, ", result_many[i]);
}
printf("]\n");
free(seed);
}
/*

View File

@ -33,5 +33,6 @@ int main(){
printf("%.2f, ", result_many[i]);
}
printf("]\n");
free(seed);
}

View File

@ -17,6 +17,9 @@ float sample_normal(float mean, float sigma, uint32_t* seed);
float sample_lognormal(float logmean, float logsigma, uint32_t* seed);
float sample_to(float low, float high, uint32_t* seed);
float sample_gamma(float alpha, uint32_t* seed);
float sample_beta(float a, float b, uint32_t* seed);
// Array helpers
float array_sum(float* array, int length);
void array_cumsum(float* array_to_sum, float* array_cumsummed, int length);