squiggle.c/CUDA/squiggle_more.h

43 lines
1.1 KiB
C
Raw Permalink Normal View History

2023-11-18 20:25:12 +00:00
#ifndef SQUIGGLE_C_EXTRA
#define SQUIGGLE_C_EXTRA
2023-11-18 20:25:12 +00:00
/* Parallel sampling */
void sampler_parallel(double (*sampler)(uint64_t* seed), double* results, int n_threads, int n_samples);
2023-11-18 20:25:12 +00:00
2024-02-02 14:51:17 +00:00
/* Stats */
2024-01-30 12:27:54 +00:00
double array_get_median(double xs[], int n);
2023-11-18 20:25:12 +00:00
typedef struct ci_t {
double low;
double high;
2023-11-18 20:25:12 +00:00
} ci;
ci array_get_ci(ci interval, double* xs, int n);
ci array_get_90_ci(double xs[], int n);
2024-01-30 12:27:54 +00:00
void array_print_stats(double xs[], int n);
2024-01-30 15:24:56 +00:00
void array_print_histogram(double* xs, int n_samples, int n_bins);
void array_print_90_ci_histogram(double* xs, int n, int n_bins);
2024-01-30 12:27:54 +00:00
/* Algebra manipulations */
2023-11-18 20:25:12 +00:00
typedef struct normal_params_t {
double mean;
double std;
} normal_params;
normal_params algebra_sum_normals(normal_params a, normal_params b);
typedef struct lognormal_params_t {
double logmean;
double logstd;
} lognormal_params;
lognormal_params algebra_product_lognormals(lognormal_params a, lognormal_params b);
lognormal_params convert_ci_to_lognormal_params(ci x);
ci convert_lognormal_params_to_ci(lognormal_params y);
2023-11-18 20:25:12 +00:00
/* Utilities */
#define THOUSAND 1000
#define MILLION 1000000
2023-11-19 15:50:21 +00:00
2023-11-18 20:25:12 +00:00
#endif