README tweaks, free seed in examples
This commit is contained in:
parent
08eb790a6d
commit
2131524017
|
@ -1,6 +1,6 @@
|
||||||
# Squiggle.c
|
# 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?
|
## Why C?
|
||||||
|
|
||||||
|
@ -79,6 +79,8 @@ Behaviour on error can be toggled by the `EXIT_ON_ERROR` variable. This library
|
||||||
|
|
||||||
## To do list
|
## To do list
|
||||||
|
|
||||||
|
- [ ] Explain correlated samples
|
||||||
|
- [ ] Add tests in Stan?
|
||||||
- [ ] Have some more complicated & realistic example
|
- [ ] Have some more complicated & realistic example
|
||||||
- [ ] Add summarization functions: 90% ci (or all c.i.?)
|
- [ ] Add summarization functions: 90% ci (or all c.i.?)
|
||||||
- [ ] Systematize references
|
- [ ] Systematize references
|
||||||
|
|
Binary file not shown.
|
@ -39,6 +39,7 @@ int main(){
|
||||||
|
|
||||||
float result_one = sample_mixture(samplers, weights, n_dists, seed);
|
float result_one = sample_mixture(samplers, weights, n_dists, seed);
|
||||||
printf("result_one: %f\n", result_one);
|
printf("result_one: %f\n", result_one);
|
||||||
|
free(seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Binary file not shown.
|
@ -48,6 +48,7 @@ int main(){
|
||||||
printf("%.2f, ", result_many[i]);
|
printf("%.2f, ", result_many[i]);
|
||||||
}
|
}
|
||||||
printf("]\n");
|
printf("]\n");
|
||||||
|
free(seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Binary file not shown.
|
@ -33,5 +33,6 @@ int main(){
|
||||||
printf("%.2f, ", result_many[i]);
|
printf("%.2f, ", result_many[i]);
|
||||||
}
|
}
|
||||||
printf("]\n");
|
printf("]\n");
|
||||||
|
free(seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -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_lognormal(float logmean, float logsigma, uint32_t* seed);
|
||||||
float sample_to(float low, float high, 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
|
// Array helpers
|
||||||
float array_sum(float* array, int length);
|
float array_sum(float* array, int length);
|
||||||
void array_cumsum(float* array_to_sum, float* array_cumsummed, int length);
|
void array_cumsum(float* array_to_sum, float* array_cumsummed, int length);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user