8#ifndef TOR_PROB_DISTR_H
9#define TOR_PROB_DISTR_H
42#define DIST_BASE(OPS) { .ops = (OPS) }
57#define TYPE_CHECK_OBJ(OPS, OBJ, TYPE) 0
59#define TYPE_CHECK_OBJ(OPS, OBJ, TYPE) \
60 (0*sizeof(&(OBJ) - (const TYPE *)&(OBJ)))
108#define DIST_BASE_TYPED(OPS, OBJ, TYPE) \
109 DIST_BASE((OPS) + TYPE_CHECK_OBJ(OPS,OBJ,TYPE))
117double dist_sample(
const struct dist_t *);
130 double (*sample)(
const struct dist_t *);
131 double (*cdf)(
const struct dist_t *,
double x);
132 double (*sf)(
const struct dist_t *,
double x);
133 double (*icdf)(
const struct dist_t *,
double p);
134 double (*isf)(
const struct dist_t *,
double p);
146#define GEOMETRIC(OBJ) \
147 DIST_BASE_TYPED(&geometric_ops, OBJ, struct geometric_t)
160#define GENPARETO(OBJ) \
161 DIST_BASE_TYPED(&genpareto_ops, OBJ, struct genpareto_t)
173#define WEIBULL(OBJ) \
174 DIST_BASE_TYPED(&weibull_ops, OBJ, struct weibull_t)
184extern const struct dist_ops_t log_logistic_ops;
186#define LOG_LOGISTIC(OBJ) \
187 DIST_BASE_TYPED(&log_logistic_ops, OBJ, struct log_logistic_t)
199#define LOGISTIC(OBJ) \
200 DIST_BASE_TYPED(&logistic_ops, OBJ, struct logistic_t)
212#define UNIFORM(OBJ) \
213 DIST_BASE_TYPED(&uniform_ops, OBJ, struct uniform_t)
217#ifdef PROB_DISTR_PRIVATE
Utility macros to handle different features and behavior in different compilers.
STATIC double icdf_log_logistic(double p, double alpha, double beta)
STATIC double cdf_weibull(double x, double lambda, double k)
STATIC double sample_genpareto(uint32_t s, double p0, double xi)
STATIC double random_uniform_01(void)
STATIC double cdf_log_logistic(double x, double alpha, double beta)
STATIC double sf_weibull(double x, double lambda, double k)
STATIC double cdf_logistic(double x, double mu, double sigma)
STATIC double sf_log_logistic(double x, double alpha, double beta)
STATIC double isf_weibull(double p, double lambda, double k)
STATIC double isf_logistic(double p, double mu, double sigma)
STATIC double sf_logistic(double x, double mu, double sigma)
STATIC double logithalf(double p0)
STATIC double isf_genpareto(double p, double mu, double sigma, double xi)
STATIC double icdf_weibull(double p, double lambda, double k)
STATIC double sample_logistic(uint32_t s, double t, double p0)
STATIC double sample_weibull(uint32_t s, double p0, double lambda, double k)
STATIC double logistic(double x)
STATIC double sample_log_logistic(uint32_t s, double p0)
STATIC double icdf_logistic(double p, double mu, double sigma)
STATIC double cdf_genpareto(double x, double mu, double sigma, double xi)
STATIC double icdf_genpareto(double p, double mu, double sigma, double xi)
STATIC double logit(double p)
STATIC double sample_uniform_interval(double p0, double a, double b)
STATIC double isf_log_logistic(double p, double alpha, double beta)
STATIC double sf_genpareto(double x, double mu, double sigma, double xi)
double dist_cdf(const struct dist_t *, double x)
double dist_sf(const struct dist_t *, double x)
double dist_isf(const struct dist_t *, double p)
double dist_icdf(const struct dist_t *, double p)
const char * dist_name(const struct dist_t *)
Macros to implement mocking and selective exposure for the test code.
Integer definitions used throughout Tor.