171 double sa = half * (o->
b.
d - o->
a.
d);
172 return o->
a.
d + sa * (o->
ud(o) + o->
ud(o));
184 double zero = 0.0, one = 1.0, two = 2.0, half = .5;
185 double mm = half*(o->
b.
d - o->
a.
d),
187 xx = sa * (x - o->
a.
d);
189 if (xx <= zero || xx >= two) {
191 }
else if (xx <= one) {
194 return sa * (two - xx);
207 double zero = 0.0, one = 1.0, two = 2.0, half = .5;
208 double mm = half*(o->
b.
d - o->
a.
d),
210 xx = sa * (x - o->
a.
d);
214 }
else if (xx >= two) {
218 return half * xx * xx;
220 return xx * (two - half * xx) - one;
236 float sa = half * (o->
b.
f - o->
a.
f);
237 return o->
a.
f + sa * (o->
uf(o) + o->
uf(o));
249 float zero = 0.0, one = 1.0, two = 2.0, half = .5;
250 float mm = half*(o->
b.
f - o->
a.
f),
252 xx = sa * (x - o->
a.
f);
254 if (xx <= zero || xx >= two) {
256 }
else if (xx <= one) {
259 return sa * (two - xx);
272 float zero = 0.0, one = 1.0, two = 2.0, half = .5;
273 float mm = half*(o->
b.
f - o->
a.
f),
275 xx = sa * (x - o->
a.
f);
279 }
else if (xx >= two) {
283 return half * xx * xx;
285 return xx * (two - half * xx) - one;
292 int gscdfn4[5][5] = {
300 int gscdfd4[5][5] = {
308 int gspdfn4[5][5] = {
316 int gspdfd4[5][5] = {
325 double gspdf4d[5][5] = {
329 double gscdf4d[5][5] = {
333 float gspdf4f[5][5] = {
337 float gscdf4f[5][5] = {
343 for (
int i = 0; i < 5; i++) {
344 for (
int j = 0; j < 5; j++) {
345 gspdf4d[i][j] = ((double) gspdfn4[i][j])
346 / ((double) gspdfd4[i][j]);
347 gscdf4d[i][j] = ((double) gscdfn4[i][j])
348 / ((double) gscdfd4[i][j]);
354 for (
int i = 0; i < 5; i++) {
355 for (
int j = 0; j < 5; j++) {
356 gspdf4f[i][j] = ((float) gspdfn4[i][j])
357 / ((float) gspdfd4[i][j]);
358 gscdf4f[i][j] = ((float) gscdfn4[i][j])
359 / ((float) gscdfd4[i][j]);
375 double sa = fourth * (o->
b.
d - o->
a.
d);
377 return o->
a.
d + sa * (o->
ud(o) + o->
ud(o) + o->
ud(o) + o->
ud(o));
389 double zero = 0.0, one = 1.0, two = 2.0, four = 4.0;
390 double mm = o->
b.
d - o->
a.
d,
392 xx = sa * (x - o->
a.
d) - two;
394 if (isnan(gspdf4d[0][0])) gs4initd();
396 if (xx <= -two || xx >= two) {
400 double xt = xx + two - i;
401 double r = gspdf4d[i][4];
403 for (
int j = 3; j >= 0; j--) {
404 r = (gspdf4d[i][j] + xt*r);
419 double zero = 0.0, one = 1.0, two = 2.0, four = 4.0;
420 double mm = o->
b.
d - o->
a.
d,
422 xx = sa * (x - o->
a.
d) - two;
424 if (isnan(gscdf4d[0][0])) gs4initd();
428 }
else if (xx >= two) {
432 double xt = xx + two - i;
433 double r = gscdf4d[i][4];
435 for (
int j = 3; j >= 0; j--) {
436 r = (gscdf4d[i][j] + xt*r);
453 float sa = fourth * (o->
b.
f - o->
a.
f);
455 return o->
a.
f + sa * (o->
uf(o) + o->
uf(o) + o->
uf(o) + o->
uf(o));
467 float zero = 0.0, one = 1.0, two = 2.0, four = 4.0;
468 float mm = o->
b.
f - o->
a.
f,
470 xx = sa * (x - o->
a.
f) - two;
472 if (isnan(gspdf4f[0][0])) gs4initf();
474 if (xx <= -two || xx >= two) {
478 float xt = xx + two - i;
479 float r = gspdf4f[i][4];
481 for (
int j = 3; j >= 0; j--) {
482 r = (gspdf4f[i][j] + xt*r);
497 float zero = 0.0, one = 1.0, two = 2.0, four = 4.0;
498 float mm = o->
b.
f - o->
a.
f,
500 xx = sa * (x - o->
a.
f) - two;
502 if (isnan(gspdf4f[0][0])) gs4initf();
506 }
else if (xx >= two) {
510 float xt = xx + two - i;
511 float r = gscdf4f[i][4];
513 for (
int j = 3; j >= 0; j--) {
514 r = (gscdf4f[i][j] + xt*r);
521 long gscdfn12[13][13] = {
522 {0l,0l,0l,0l,0l,0l,0l,0l,0l,0l,0l,0l,1l},
523 {1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,-1l},
524 {1021l,509l,253l,25l,61l,29l,13l,1l,1l,-1l,-1l,-1l,1l},
525 {397l,50879l,5203l,907l,79l,239l,1l,-1l,-1l,-1l,1l,1l,-1l},
526 {29639l,1093l,16973l,31l,29l,-17l,-1l,0l,1l,1l,-1l,-1l,1l},
527 {12831419l,1623019l,6787l,-1l,-443l,-43l,167l,11l,-1l,-1l,1l,1l,-1l},
528 {1l,655177l,0l,-809l,0l,31l,0l,-23l,0l,1l,0l,-1l,1l},
529 {67002181l,1623019l,-6787l,-1l,443l,-43l,-167l,11l,1l,-1l,-1l,1l,-1l},
530 {1300921l,1093l,-16973l,31l,-29l,-17l,1l,0l,-1l,1l,1l,-1l,1l},
531 {393843l,50879l,-5203l,907l,-79l,239l,-1l,-1l,1l,-1l,-1l,1l,-1l},
532 {119749379l,509l,-253l,25l,-61l,29l,-13l,1l,-1l,-1l,1l,-1l,1l},
533 {479001599l,1l,-1l,1l,-1l,1l,-1l,1l,-1l,1l,-1l,1l,-1l},
534 {1l,0l,0l,0l,0l,0l,0l,0l,0l,0l,0l,0l,0l}
538 long gscdfd12[13][13] = {
539 {1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,479001600l},
540 {479001600l,39916800l,7257600l,2177280l,967680l,604800l,518400l,604800l,967680l,2177280l,7257600l,39916800l,43545600l},
541 {119750400l,9979200l,1814400l,108864l,241920l,151200l,129600l,30240l,241920l,544320l,907200l,3991680l,8709120l},
542 {394240l,13305600l,806400l,145152l,21504l,201600l,19200l,8064l,21504l,725760l,268800l,887040l,2903040l},
543 {1330560l,19800l,302400l,1134l,8064l,6300l,800l,1l,8064l,45360l,151200l,332640l,1451520l},
544 {79833600l,6652800l,57600l,384l,23040l,14400l,86400l,20160l,7680l,17280l,172800l,190080l,1036800l},
545 {2l,1663200l,1l,12960l,1l,3600l,1l,25200l,1l,12960l,1l,158400l,1036800l},
546 {79833600l,6652800l,57600l,384l,23040l,14400l,86400l,20160l,7680l,17280l,172800l,190080l,1451520l},
547 {1330560l,19800l,302400l,1134l,8064l,6300l,800l,1l,8064l,45360l,151200l,332640l,2903040l},
548 {394240l,13305600l,806400l,145152l,21504l,201600l,19200l,8064l,21504l,725760l,268800l,887040l,8709120l},
549 {119750400l,9979200l,1814400l,108864l,241920l,151200l,129600l,30240l,241920l,544320l,907200l,3991680l,43545600l},
550 {479001600l,39916800l,7257600l,2177280l,967680l,604800l,518400l,604800l,967680l,2177280l,7257600l,39916800l,479001600l},
551 {1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,1l}
555 long gspdfn12[13][13] = {
556 {0l,0l,0l,0l,0l,0l,0l,0l,0l,0l,0l,1l,0l},
557 {1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,-1l,0l},
558 {509l,253l,25l,61l,29l,13l,1l,1l,-1l,-1l,-1l,1l,0l},
559 {50879l,5203l,907l,79l,239l,1l,-1l,-1l,-1l,1l,1l,-1l,0l},
560 {1093l,16973l,31l,29l,-17l,-3l,0l,1l,1l,-1l,-1l,1l,0l},
561 {1623019l,6787l,-1l,-443l,-43l,167l,11l,-1l,-1l,1l,1l,-1l,0l},
562 {655177l,0l,-809l,0l,31l,0l,-23l,0l,1l,0l,-1l,1l,0l},
563 {1623019l,-6787l,-1l,443l,-43l,-167l,11l,1l,-1l,-1l,1l,-1l,0l},
564 {1093l,-16973l,31l,-29l,-17l,3l,0l,-1l,1l,1l,-1l,1l,0l},
565 {50879l,-5203l,907l,-79l,239l,-1l,-1l,1l,-1l,-1l,1l,-1l,0l},
566 {509l,-253l,25l,-61l,29l,-13l,1l,-1l,-1l,1l,-1l,1l,0l},
567 {1l,-1l,1l,-1l,1l,-1l,1l,-1l,1l,-1l,1l,-1l,0l},
568 {0l,0l,0l,0l,0l,0l,0l,0l,0l,0l,0l,0l,0l}
572 long gspdfd12[13][13] = {
573 {1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,39916800l,1l},
574 {39916800l,3628800l,725760l,241920l,120960l,86400l,86400l,120960l,241920l,725760l,3628800l,3628800l,1l},
575 {9979200l,907200l,36288l,60480l,30240l,21600l,4320l,30240l,60480l,90720l,362880l,725760l,1l},
576 {13305600l,403200l,48384l,5376l,40320l,3200l,1152l,2688l,80640l,26880l,80640l,241920l,1l},
577 {19800l,151200l,378l,2016l,1260l,400l,1l,1008l,5040l,15120l,30240l,120960l,1l},
578 {6652800l,28800l,128l,5760l,2880l,14400l,2880l,960l,1920l,17280l,17280l,86400l,1l},
579 {1663200l,1l,4320l,1l,720l,1l,3600l,1l,1440l,1l,14400l,86400l,1l},
580 {6652800l,28800l,128l,5760l,2880l,14400l,2880l,960l,1920l,17280l,17280l,120960l,1l},
581 {19800l,151200l,378l,2016l,1260l,400l,1l,1008l,5040l,15120l,30240l,241920l,1l},
582 {13305600l,403200l,48384l,5376l,40320l,3200l,1152l,2688l,80640l,26880l,80640l,725760l,1l},
583 {9979200l,907200l,36288l,60480l,30240l,21600l,4320l,30240l,60480l,90720l,362880l,3628800l,1l},
584 {39916800l,3628800l,725760l,241920l,120960l,86400l,86400l,120960l,241920l,725760l,3628800l,39916800l,1l},
585 {1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,1l,1l}
590 double gspdf12d[13][13] = {
594 double gscdf12d[13][13] = {
598 float gspdf12f[13][13] = {
602 float gscdf12f[13][13] = {
607 int gs12initd(
void) {
608 for (
int i = 0; i < 13; i++) {
609 for (
int j = 0; j < 13; j++) {
610 gspdf12d[i][j] = ((double) gspdfn12[i][j])
611 / ((double) gspdfd12[i][j]);
612 gscdf12d[i][j] = ((double) gscdfn12[i][j])
613 / ((double) gscdfd12[i][j]);
618 int gs12initf(
void) {
619 for (
int i = 0; i < 13; i++) {
620 for (
int j = 0; j < 13; j++) {
621 gspdf12f[i][j] = ((float) gspdfn12[i][j])
622 / ((float) gspdfd12[i][j]);
623 gscdf12f[i][j] = ((float) gscdfn12[i][j])
624 / ((float) gscdfd12[i][j]);
643 return o->
m.
d + o->
s.
d * (
644 o->
ud(o) + o->
ud(o) + o->
ud(o) + o->
ud(o)
645 + o->
ud(o) + o->
ud(o) + o->
ud(o) + o->
ud(o)
646 + o->
ud(o) + o->
ud(o) + o->
ud(o) + o->
ud(o)
660 double zero = 0.0, one = 1.0, six = 6.0;
661 double sa = one/o->
s.
d,
662 xx = sa * (x - o->
m.
d);
664 if (isnan(gspdf12d[0][0])) gs12initd();
666 if (xx <= -six || xx >= six) {
670 double xt = xx + six - i;
671 double r = gspdf12d[i][12];
673 for (
int j = 11; j >= 0; j--) {
674 r = (gspdf12d[i][j] + xt*r);
689 double zero = 0.0, one = 1.0, six = 6.0;
690 double sa = one/o->
s.
d,
691 xx = sa * (x - o->
m.
d);
693 if (isnan(gscdf12d[0][0])) gs12initd();
697 }
else if (xx >= six) {
701 double xt = xx + six - i;
702 double r = gscdf12d[i][12];
704 for (
int j = 11; j >= 0; j--) {
705 r = (gscdf12d[i][j] + xt*r);
725 return o->
m.
f + o->
s.
f * (
726 o->
uf(o) + o->
uf(o) + o->
uf(o) + o->
uf(o)
727 + o->
uf(o) + o->
uf(o) + o->
uf(o) + o->
uf(o)
728 + o->
uf(o) + o->
uf(o) + o->
uf(o) + o->
uf(o)
742 float zero = 0.0, one = 1.0, six = 6.0;
743 float sa = one/o->
s.
f,
744 xx = sa * (x - o->
m.
f);
746 if (isnan(gspdf12f[0][0])) gs12initf();
748 if (xx <= -six || xx >= six) {
752 float xt = xx + six - i;
753 float r = gspdf12f[i][12];
755 for (
int j = 11; j >= 0; j--) {
756 r = (gspdf12f[i][j] + xt*r);
771 float zero = 0.0, one = 1.0, six = 6.0;
772 float sa = one/o->
s.
f,
773 xx = sa * (x - o->
m.
f);
775 if (isnan(gspdf12f[0][0])) gs12initf();
779 }
else if (xx >= six) {
783 float xt = xx + six - i;
784 float r = gscdf12f[i][12];
786 for (
int j = 11; j >= 0; j--) {
787 r = (gscdf12f[i][j] + xt*r);
double LRd_gsn12_RAN(LR_obj *o)
LRd_gsn12_RAN(LR_obj *o) - double random g12 gaussian-like distribution closely matches a Gaussian/No...
float LRf_gsn2_CDF(LR_obj *o, float x)
LRf_gsn2_CDF(LR_obj *o, float x) - float gaussian-like (saw tooth) cumulative distribution function...
double LRd_gsn4_PDF(LR_obj *o, double x)
LRd_gsn4_PDF(LR_obj *o, double x) - double gaussian-like (simple bell curve) probablity distribution ...
float LRf_gsn4_PDF(LR_obj *o, float x)
LRf_gsn4_PDF(LR_obj *o, float x) - float gaussian-like (simple bell curve) probablity distribution fu...
float LRf_gsn12_RAN(LR_obj *o)
LRf_gsn12_RAN(LR_obj *o) - float random g12 gaussian-like distribution closely matches a Gaussian/Nor...
float LRf_gsn2_RAN(LR_obj *o)
LRf_gsn2_RAN(LR_obj *o) - float random g2 gaussian-like (saw tooth) distribution. ...
double LRd_gsn2_RAN(LR_obj *o)
LRd_gsn2_RAN(LR_obj *o) - double random g2 gaussian-like (saw tooth) distribution.
float LRf_gsn12_CDF(LR_obj *o, float x)
LRf_gsn12_CDF(LR_obj *o, float x) - float gaussian-like (simple bell curve) cumulative distribution f...
double LRd_gsn2_PDF(LR_obj *o, double x)
LRd_gsn2_PDF(LR_obj *o, double x) - double gaussian-like (saw tooth) probablity distribution function...
double LRd_gsn12_PDF(LR_obj *o, double x)
LRd_gsn12_PDF(LR_obj *o, double x) - double gaussian-like (simple bell curve) probablity distribution...
double LRd_gsn2_CDF(LR_obj *o, double x)
LRd_gsn2_CDF(LR_obj *o, double x) - double gaussian-like (saw tooth) cumulative distribution function...
double LRd_gsn4_RAN(LR_obj *o)
LRd_gsn4_RAN(LR_obj *o) - double random g4 gaussian-like (simple bell curve) distribution.
float LRf_gsn2_PDF(LR_obj *o, float x)
LRf_gsn2_PDF(LR_obj *o, float x) - float gaussian-like (saw tooth) probablity distribution function...
float LRf_gsn4_CDF(LR_obj *o, float x)
LRf_gsn4_CDF(LR_obj *o, float x) - float gaussian-like (saw tooth) cumulative distribution function...
The LibRan common header file.
double LRd_gsn4_CDF(LR_obj *o, double x)
LRd_gsn4_CDF(LR_obj *o, double x) - double gaussian-like (saw tooth) cumulative distribution function...
the fundamental LibRan random variate distribution object
float LRf_gsn12_PDF(LR_obj *o, float x)
LRf_gsn12_PDF(LR_obj *o, float x) - float gaussian-like (simple bell curve) probablity distribution f...
float LRf_gsn4_RAN(LR_obj *o)
LRf_gsn4_RAN(LR_obj *o) - float random g4 gaussian-like (simple bell curve) distribution.
double LRd_gsn12_CDF(LR_obj *o, double x)
LRd_gsn12_CDF(LR_obj *o, double x) - double gaussian-like (simple bell curve) cumulative distribution...