]> git.treefish.org Git - phys/latlib.git/commitdiff
dynamically allocating manymeans in jackknife methods to allow for large number of...
authorAlex Schmidt <alex@treefish.org>
Wed, 11 Sep 2013 13:08:19 +0000 (15:08 +0200)
committerAlex Schmidt <alex@treefish.org>
Wed, 11 Sep 2013 13:08:19 +0000 (15:08 +0200)
obstat.hpp

index 2824e6925e958df2f803381b383bdb2c57ef6cc0..57a3431e6faa36078ecad0935256a6b8bc3e45d7 100644 (file)
@@ -87,7 +87,7 @@ template <typename meastype, typename restype>
 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;
@@ -116,6 +116,8 @@ int obstat<meastype,restype>::computeJack(restype (*func)(vector< vector<meastyp
 
   computations.push_back(jackres);
 
+  delete [] manymeans;
+
   return computations.size()-1;
 }
 
@@ -124,7 +126,7 @@ int obstat<meastype,restype>::computeJack(void (*preMeasFunc)(vector< vector <me
                                          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;
 
@@ -147,6 +149,8 @@ int obstat<meastype,restype>::computeJack(void (*preMeasFunc)(vector< vector <me
 
   computations.push_back(jackres);
 
+  delete [] manymeans;
+
   return computations.size()-1;
 }