reduce num samples, start README

This commit is contained in:
NunoSempere 2023-07-16 21:52:24 +02:00
parent f5af776eb3
commit ea80c930e6
8 changed files with 42 additions and 19 deletions

38
README.md Normal file
View File

@ -0,0 +1,38 @@
# Squiggle.c
## Why C?
- Because it is fast
- Because it can be made faster if need be, e.g., with a multi-threading library like OpenMP
- Because if you can implement something in C, you can implement it anywhere else
- Because it will last long
- Because the language is honest
- Because I enjoy it
## To do list
- [ ] Have some more complicated & realistic example
- [ ] Add summarization functions, like mean, std, 90% ci (or all c.i.?)
- [ ] Add README
- Schema: a function which takes a sample and manipulates it,
- and at the end, an array of samples.
- Explain boxes
- Explain individual examples
- Explain nested functions
- [ ] Publish online
## Done
- [x] Add example for only one sample
- [x] Add example for many samples
- ~~[ ] Add a custom preprocessor to allow simple nested functions that don't rely on local scope?~~
- [x] Use gcc extension to define functions nested inside main.
- [x] Chain various mixture functions
- [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~~
- [x] Add function to get sample when given a cdf
- [x] Don't have a single header file.
- [x] Structure project a bit better

View File

@ -5,7 +5,7 @@
#include <stdlib.h>
#include <time.h>
#define NUM_SAMPLES 1000000
#define NUM_SAMPLES 10000
// Example cdf
float cdf_uniform_0_1(float x)

View File

@ -5,7 +5,7 @@
#include <stdlib.h>
#include <time.h>
#define NUM_SAMPLES 1000000
#define NUM_SAMPLES 10000
#define STOP_BETA 1.0e-8
#define TINY_BETA 1.0e-30

View File

@ -5,7 +5,7 @@
# make run
# Compiler
CC=gcc # required for nested functions
# CC=gcc # required for nested functions
# CC=tcc # <= faster compilation
# Main file

View File

@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define EXIT_ON_ERROR 0
#define MAX_ERROR_LENGTH 500
#define PROCESS_ERROR(...) \

View File

@ -1,16 +0,0 @@
- [x] Add example for only one sample
- [x] Add example for many samples
- ~~[ ] Add a custom preprocessor to allow simple nested functions that don't rely on local scope?~~
- [x] Use gcc extension to define functions nested inside main.
- [x] Chain various mixture functions
- [ ] Have some more complicated & realistic example
- [ ] Add summarization functions, like mean, std, 90% ci (or all c.i.?)
- [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
- [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