91         if (!(ptr->
bdrs = (
double *) calloc(n, 
sizeof(
double))))
    94         if (!(ptr->
c = (
double *) calloc(n, 
sizeof(
double))))
    97         if (!(ptr->
sc = (
double *) calloc(n + 1, 
sizeof(
double))))
   103         free((
void *) ptr->
sc);
   106         free((
void *) ptr->
c);
   109         free((
void *) ptr->
bdrs);
   127                 free((
void *) aux->
bdrs);
   128                 free((
void *) aux->
c);
   129                 free((
void *) aux->
sc);
   162         if (aux->
n < aux->
nn + 1) {
   171                 if (x < o->a.d || x > o->
b.
d)
   175                 if (x < o->a.f || x > o->
b.
f)
   181         for (
int i = 0, i1 = 1; i <= aux->
nn; i++,i1++) {
   221         double zero = 0.0, one = 1.0, delta = .000001;
   226         for (
int i = aux->
nn - 1, i1 = aux->
nn - 2; i >= 1; i--, i1--) {
   228                 aux->
c[i] = aux->
c[i1];
   235                 aux->
bdrs[0] = (double) o->
a.
f;
   236                 aux->
bdrs[aux->
nn] = (
double) o->
b.
f;
   237                 aux->
c[0] = (double) o->
x.
f;
   242         for (
int i = 0, i1 = 1; i < aux->
nn; i++, i1++) {
   244                 aux->
sc[i] = aux->
c[i] * (aux->
bdrs[i1] - aux->
bdrs[i]);
   249         for (
int i = 0; i < aux->
nn; i++) {
   251                 aux->
sc[i] = v * aux->
norm;
   254         if (aux->
sc[aux->
nn-1] < one - delta
   255         ||  one + delta < aux->sc[aux->
nn-1]) {
   259         for (
int i = aux->
nn-1; i > 0; i--) {
   260                 aux->
sc[i] = aux->
sc[i-1];
   263         aux->
sc[aux->
nn] = one;
   279         double x, dx, zero = 0.0;
   290         while (x > aux->
sc[i])  i++;
   292         if (aux->
c[i-1] == zero)        
return aux->
bdrs[i-1];
   294         dx = (x - aux->
sc[i-1]) / (aux->
c[i-1] * aux->
norm);
   295         return aux->
bdrs[i-1] + dx;
   315         if (x <= o->a.d || x > o->
b.
d) {
   320                 while (x > aux->
bdrs[i])        i++;
   321                 return aux->
c[i-1] * aux->
norm;
   334         double zero = 0.0, one = 1.0;
   344         } 
else if (x >= o->
b.
d) {
   349                 while (x > aux->
bdrs[i])        i++;
   350                 return aux->
sc[i-1] + aux->
c[i-1]*aux->
norm*(x-aux->
bdrs[i-1]);
   362         float x, dx, zero = 0.0;
   373         while (x > aux->
sc[i])  i++;
   375         if (aux->
c[i-1] == zero)        
return aux->
bdrs[i-1];
   377         dx = (x - aux->
sc[i-1]) / (aux->
c[i-1] * aux->
norm);
   378         return aux->
bdrs[i-1] + dx;
   398         if (x <= o->a.f || x > o->
b.
f) {
   403                 while (x > aux->
bdrs[i])        i++;
   404                 return aux->
c[i-1] * aux->
norm;
   417         float zero = 0.0, one = 1.0;
   427         } 
else if (x >= o->
b.
f) {
   432                 while (x > aux->
bdrs[i])        i++;
   433                 return aux->
sc[i-1] + aux->
c[i-1]*aux->
norm*(x-aux->
bdrs[i-1]);
 
#define LRerr_SuspiciousValues
#define LRerr_TooManyValues
int LR_pcs_rm(LR_obj *o)
LR_pcs_rm(LR_obj *o) - strip out the LR_pcs object part of LR_obj. 
int LR_pcs_set(LR_obj *o, double x, double p)
LR_pcs_set(LR_obj *o, double x) - add interval boundary (will order internally). 
A special object for defining some of the random variate distributions. 
float LRf_piece_PDF(LR_obj *o, float x)
LRf_piece_PDF(LR_obj *o, float x) - float piecewise uniform probablity distribution function...
int LR_pcs_new(LR_obj *o, int n)
LR_pcs_new(LR_obj *o, int n) - create a new piecewise uniform object set of segments. 
#define LRerr_InvalidRange
double LRd_piece_CDF(LR_obj *o, double x)
LRd_piece_CDF(LR_obj *o, double x) - double piecewise uniform cumulative distribution function...
#define LRerr_NoAuxNormalizeDone
float LRf_piece_RAN(LR_obj *o)
LRf_piece_RAN(LR_obj *o) - float random piecewise uniform distribution. 
int LR_pcs_norm(LR_obj *o)
LR_pcs_norm(LR_obj *o) - normalize the interval scale factors. 
float LRf_piece_CDF(LR_obj *o, float x)
LRf_piece_CDF(LR_obj *o, float x) - float piecewise uniform cumulative distribution function...
double LRd_piece_RAN(LR_obj *o)
LRd_piece_RAN(LR_obj *o) - double random piecewise uniform distribution random variate. 
The LibRan common header file. 
#define LRerr_Unspecified
#define LRerr_InvalidInputValue
double LRd_piece_PDF(LR_obj *o, double x)
LRd_piece_PDF(LR_obj *o, double x) - double piecewise uniform probablity distribution function...
the fundamental LibRan random variate distribution object