Commit c6b28459 authored by Martin Reinecke's avatar Martin Reinecke

remove another over-optimization

parent 632fa522
......@@ -1290,12 +1290,12 @@ template<typename Serv> void wminmax(const GridderConfig &gconf,
}
}
template<typename T> void update_idx(vector<T> &v, vector<T> &vold,
const vector<T> &add, const vector<T> &del)
template<typename T> void update_idx(vector<T> &v, const vector<T> &add,
const vector<T> &del)
{
myassert(v.size()>=del.size(), "must not happen");
vold.resize(0);
vold.reserve((v.size()+add.size())-del.size());
vector<T> res;
res.reserve((v.size()+add.size())-del.size());
auto iin=v.begin(), ein=v.end();
auto iadd=add.begin(), eadd=add.end();
auto irem=del.begin(), erem=del.end();
......@@ -1305,15 +1305,15 @@ template<typename T> void update_idx(vector<T> &v, vector<T> &vold,
if ((irem!=erem) && (*iin==*irem))
{ ++irem; ++iin; } // skip removed entry
else if ((iadd!=eadd) && (*iadd<*iin))
vold.push_back(*(iadd++)); // add new entry
res.push_back(*(iadd++)); // add new entry
else
vold.push_back(*(iin++));
res.push_back(*(iin++));
}
myassert(irem==erem, "must not happen");
while(iadd!=eadd)
vold.push_back(*(iadd++));
myassert(vold.size()==(v.size()+add.size())-del.size(), "must not happen");
v.swap(vold);
res.push_back(*(iadd++));
myassert(res.size()==(v.size()+add.size())-del.size(), "must not happen");
v.swap(res);
}
template<typename Serv> void wstack_common(
......@@ -1403,14 +1403,14 @@ template<typename T, typename Serv> void x2dirty(
if (verbosity>0) cout << "Gridding using improved w-stacking" << endl;
wstack_common(gconf, srv, wmin, dw, nplanes, minplane, verbosity);
dirty.fill(0);
vector<idx_t> subidx, subidx_old;
vector<idx_t> subidx;
tmpStorage<complex<T>,2> grid_({gconf.Nu(),gconf.Nv()});
auto grid=grid_.getMav();
tmpStorage<complex<T>,2> tdirty_(dirty.shape());
auto tdirty=tdirty_.getMav();
for (size_t iw=0; iw<nplanes; ++iw)
{
update_idx(subidx, subidx_old, minplane[iw], iw>=supp ? minplane[iw-supp] : vector<idx_t>());
update_idx(subidx, minplane[iw], iw>=supp ? minplane[iw-supp] : vector<idx_t>());
if (subidx.size()==0) continue;
if (verbosity>1)
cout << "Working on plane " << iw << " containing " << subidx.size()
......@@ -1482,14 +1482,14 @@ template<typename T, typename Serv> void dirty2x(
// correct for w gridding
apply_wcorr(gconf, tdirty, ES_Kernel(supp, nthreads), dw);
vector<idx_t> subidx, subidx_old;
vector<idx_t> subidx;
tmpStorage<complex<T>,2> grid_({gconf.Nu(),gconf.Nv()});
auto grid=grid_.getMav();
tmpStorage<complex<T>,2> tdirty2_({nx_dirty,ny_dirty});
auto tdirty2=tdirty2_.getMav();
for (size_t iw=0; iw<nplanes; ++iw)
{
update_idx(subidx, subidx_old, minplane[iw], iw>=supp ? minplane[iw-supp] : vector<idx_t>());
update_idx(subidx, minplane[iw], iw>=supp ? minplane[iw-supp] : vector<idx_t>());
if (subidx.size()==0) continue;
if (verbosity>1)
cout << "Working on plane " << iw << " containing " << subidx.size()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment