X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/3675da388f7ca12cdc6d93f4a8b94ef4bdd96b19..2a77bf6d539b1750d194de21ed287a958609693a:/obstat.hpp?ds=inline diff --git a/obstat.hpp b/obstat.hpp index 6818792..57a3431 100644 --- a/obstat.hpp +++ b/obstat.hpp @@ -19,7 +19,7 @@ public: int computeJack(restype (*func)(vector< vector > *vals, void *para), void *para=NULL); int computeJack(void (*preMeasFunc)(vector< vector > *allVals, vector *preCalculated, void *para), - restype (*measFunc)(vector *preCalculated, vector *excludedmeas, void *para), void *para=NULL); + restype (*measFunc)(vector *preCalculated, vector *excludedmeas, int nmeas, void *para), void *para=NULL); restype getMean(int compid) { return computations[compid].val; } restype getErr(int compid) { return computations[compid].err; } @@ -87,7 +87,7 @@ template int obstat::computeJack(restype (*func)(vector< vector > *vals, void *para), void *para) { int nmeas=measurements.size(); - restype manymeans[nmeas]; + restype *manymeans = new restype[nmeas]; result jackres; jackres.val = 0; @@ -116,15 +116,17 @@ int obstat::computeJack(restype (*func)(vector< vector int obstat::computeJack(void (*preMeasFunc)(vector< vector > *allVals, vector *preCalculated, void *para), - restype (*measFunc)(vector *preCalculated, vector *excludedmeas, void *para), + restype (*measFunc)(vector *preCalculated, vector *excludedmeas, int nmeas, void *para), void *para) { int nmeas=measurements.size(); - restype manymeans[nmeas]; + restype *manymeans = new restype[nmeas]; result jackres; vector preCalculated; @@ -135,7 +137,7 @@ int obstat::computeJack(void (*preMeasFunc)(vector< vector >::iterator removedIt = measurements.begin(); removedIt != measurements.end(); ++removedIt, imeas++) { - manymeans[imeas] = measFunc(&preCalculated, &(*removedIt), para); + manymeans[imeas] = measFunc(&preCalculated, &(*removedIt), measurements.size(), para); jackres.val += manymeans[imeas]; } jackres.val /= nmeas; @@ -147,6 +149,8 @@ int obstat::computeJack(void (*preMeasFunc)(vector< vector