9 double begin = 0.5, incr;
11 float x, pdf, cdf, xcdf[nint];
18 printf(
"check r = %d\n", r);
20 printf(
" k PDF CDF\n");
22 for (
int i = 0; i <= nint; i++) {
25 printf(
"% 3d %7.4f %7.4f\n", i,pdf,cdf);
28 for (
int i = 0; i < nint; i++) {
33 xcdf[nint] = tot * (1.0 -
LRi_CDF(o, nint-1));
35 for (
int i = 0; i < tot; i++) {
38 printf(
"%.3f %d\n", x, r);
41 printf(
" i bin cdf bin/cdf diff\n");
42 for (
int i = 0; i <= nint; i++) {
43 printf(
"% 3d %8ld % 9.2f % 8.2f % 8.2f\n",
44 i, b->
bins[i], xcdf[i],
45 b->
bins[i]/xcdf[i], b->
bins[i] - xcdf[i]);
50 printf(
"%ld\n",
sizeof(o));
LR_bin * LR_bin_new(int n)
LR_bin_new(LR_data_type d, int n) - create new binning object.
float LRi_CDF(LR_obj *o, int x)
LRi_CDF(LR_obj *o, int x) - cumulative distribution function.
int LRi_RAN(LR_obj *o)
LRi_RAN(LR_obj *o) - random variate generator.
int LR_check(LR_obj *o)
LR_check(LR_obj *o) - check and fix the LR object parameters if possible.
LR_obj * LR_new(LR_type t, LR_data_type d)
LR_new(LR_type t, LR_data_type d) - create the LR object and preset some default parameter values...
the binning object - for tallying results
int LR_bin_set(LR_bin *b, double x)
LR_bin_set(LR_bin *b, double x) - add bin boundary.
int LR_rm(LR_obj **o)
LR_rm(LR_obj **o) - destroy the LR object and release allocated memory.
int LR_bin_add(LR_bin *b, double x)
LR_bin_add(LR_bin *b, double x) - collect value to be binned.
int LR_set_all(LR_obj *o, char *x,...)
LR_set_all(LR_obj *o, char *x, ...) - set all given LR object parameters.
The LibRan common header file.
the fundamental LibRan random variate distribution object
float LRi_PDF(LR_obj *o, int x)
LRi_PDF(LR_obj *o, int x) - probability distribution function.