int computeJack(restype (*func)(vector< vector <meastype> > *vals, void *para), void *para=NULL);
int computeJack(void (*preMeasFunc)(vector< vector <meastype> > *allVals, vector <meastype> *preCalculated, void *para),
- restype (*measFunc)(vector <meastype> *preCalculated, vector <meastype> *excludedmeas, void *para), void *para=NULL);
+ restype (*measFunc)(vector <meastype> *preCalculated, vector <meastype> *excludedmeas, int nmeas, void *para), void *para=NULL);
restype getMean(int compid) { return computations[compid].val; }
restype getErr(int compid) { return computations[compid].err; }
int obstat<meastype,restype>::computeJack(restype (*func)(vector< vector<meastype> > *vals, void *para), void *para)
{
int nmeas=measurements.size();
- restype manymeans[nmeas];
+ restype *manymeans = new restype[nmeas];
result jackres;
jackres.val = 0;
computations.push_back(jackres);
+ delete [] manymeans;
+
return computations.size()-1;
}
template <typename meastype, typename restype>
int obstat<meastype,restype>::computeJack(void (*preMeasFunc)(vector< vector <meastype> > *allVals, vector<meastype> *preCalculated, void *para),
- restype (*measFunc)(vector<meastype> *preCalculated, vector<meastype> *excludedmeas, void *para),
+ restype (*measFunc)(vector<meastype> *preCalculated, vector<meastype> *excludedmeas, int nmeas, void *para),
void *para) {
int nmeas=measurements.size();
- restype manymeans[nmeas];
+ restype *manymeans = new restype[nmeas];
result jackres;
vector<meastype> preCalculated;
int imeas=0;
for(typename vector< vector<meastype> >::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;
computations.push_back(jackres);
+ delete [] manymeans;
+
return computations.size()-1;
}