Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
Grid dep perf: Only perform back-transform on nonzero elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Kloeckner committed Mar 28, 2010
1 parent 4e16263 commit 57f20eb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cpp/dep_grid.hpp
Expand Up @@ -290,11 +290,19 @@ namespace pyrticle
// pick values off the grid
const py_vector::const_iterator weights = eog.m_weight_factors.begin();

bool had_nonzero = false;
for (unsigned i = 0; i < eog.m_grid_nodes.size(); ++i)
grid_values[i] = weights[i]
{
double w = weights[i]
* from_it[offset + eog.m_grid_nodes[i]*increment];
grid_values[i] = w;

if (w)
had_nonzero = true;
}

// and apply the interpolation matrix
if (had_nonzero)
{
const dyn_fortran_matrix &matrix = eog.m_interpolation_matrix;
using namespace boost::numeric::bindings;
Expand Down

0 comments on commit 57f20eb

Please sign in to comment.