-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
Description
This function seems to modify the table variable while using it for lookup:
void HHGate::tabFill(vector<double>& table, unsigned int newXdivs,
double newXmin, double newXmax)
{
if(newXdivs < 3) {
cout << "Error: tabFill: # divs must be >= 3. Not filling table.\n";
return;
}
vector<double> old = table;
double newDx = (newXmax - newXmin) / newXdivs;
table.resize(newXdivs + 1);
bool origLookupMode = lookupByInterpolation_;
lookupByInterpolation_ = 1;
for(unsigned int i = 0; i <= newXdivs; ++i) {
table[i] = lookupTable(table, newXmin + i * newDx);
}
lookupByInterpolation_ = origLookupMode;
}
The call to lookupTable inside the last for loop is using the same table that it is trying to update. I am wondering if it should be passed the old table instead (which is defined but never used).