2023-11-19 14:32:29 +00:00
|
|
|
#include "../../../squiggle.h"
|
2023-11-19 14:47:19 +00:00
|
|
|
#include "../../../squiggle_more.h"
|
2023-07-23 17:11:25 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
// Estimate functions
|
2024-02-01 19:54:52 +00:00
|
|
|
double sample_beta_3_2(uint64_t* seed)
|
2023-11-18 21:10:21 +00:00
|
|
|
{
|
2024-02-01 19:54:52 +00:00
|
|
|
return sample_beta(3.0, 2.0, seed);
|
2023-07-23 17:11:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
// set randomness seed
|
|
|
|
uint64_t* seed = malloc(sizeof(uint64_t));
|
|
|
|
*seed = 1000; // xorshift can't start with 0
|
|
|
|
|
2024-02-01 19:54:52 +00:00
|
|
|
int n_samples = 1 * MILLION;
|
|
|
|
double* xs = malloc(sizeof(double) * (size_t)n_samples);
|
2024-02-02 14:51:17 +00:00
|
|
|
sampler_parallel(sample_beta_3_2, xs, 16, n_samples);
|
2024-02-01 19:54:52 +00:00
|
|
|
|
|
|
|
printf("\n# Stats\n");
|
|
|
|
array_print_stats(xs, n_samples);
|
|
|
|
printf("\n# Histogram\n");
|
|
|
|
array_print_histogram(xs, n_samples, 23);
|
2023-11-18 21:10:21 +00:00
|
|
|
|
|
|
|
free(seed);
|
2023-07-23 17:11:25 +00:00
|
|
|
}
|