diff --git a/src/curve.cpp b/src/curve.cpp index 2ba4fdf27a831f7797246346ae5bd24d97d36f73..1a6edfc289cd9ecb3f00657dcb67dfdf9f1dd90f 100644 --- a/src/curve.cpp +++ b/src/curve.cpp @@ -709,6 +709,18 @@ namespace NCurveFile //! Calculate cumulative probability distribution on equidistant grid +/* Input: `dis(x)`, a probability distribution. + Output: `cum(r)`, the inverse of the cumulative probability distribution + based on `dis`. It is implicitely understood that the abscissa of `cum` + is an equidistant grid 2^m+1 points from 0 to 1. + + The resulting `cum` is used as follows. To draw random values x + that are distributed according to `dis`: + - Draw a random number r from a uniform distribution in the interval [0,1]. + - Calculate ilow=floor(r*2^m) and ihig = ilow+1. + - Obtain x = cum(ilow) + (cum(ihig)-cum(ilow))*(r-ilow/2^m). +*/ + void NCurveFile::CumulativeDistribution(void) { static int nb = 3; diff --git a/src/expr.cpp b/src/expr.cpp index 4c27413c56218ee419af92e50231352724a28785..21cfc36450eca5c897e1cd45c598790941b187ad 100644 --- a/src/expr.cpp +++ b/src/expr.cpp @@ -249,7 +249,7 @@ int CRef::ref_val( void *ret, const CContext *ctx ) const const COlc* fc; CurveRef *cr; if( (fd = dynamic_cast<const COld*>(f)) ){ - if (pointwise() && i<0 || i>=fd->VS[j].size()) { + if( pointwise() && (i<0 || i>=fd->VS[j].size()) ){ printf("! ref(point) out of range\n"); return -1; } diff --git a/src/scan.cpp b/src/scan.cpp index ad88fbe2bbfddd5ed364dc9af81a7a74d933df03..b8401fbcf850f61157f19107b3142e30a5c96531 100644 --- a/src/scan.cpp +++ b/src/scan.cpp @@ -47,7 +47,7 @@ void CScan::erase(const uint begin, const uint end) uint CScan::size() const { if (x.size()!=y.size()) { - printf("PROG ERR scan::size #x [%u] <> #y [%u]\n", + printf( "FATAL PROGRAM ERROR in scan::size: #x [%u] <> #y [%u]\n", x.size(), y.size()); return 0; }