Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
Optimization: Only check half of the last dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcslws committed Jan 23, 2019
1 parent c90df0b commit b9b97cc
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/nupic/experimental/GridUniqueness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1859,14 +1859,26 @@ bool findGridCodeZeroAtRadius(
vector<double> x0(numDims, -radius);
vector<double> dims(numDims, 2*radius);

// Optimization: for the final dimension, don't go negative. Half of the
// hypercube will be equal-and-opposite phases of the other half, so we
// ignore the lower half of the final dimension.
x0[numDims - 1] = 0;
dims[numDims - 1] = radius;

dims[iDim] = 0;
if (findGridCodeZero_noModulo(domainToPlaneByModule,
x0, dims, readoutResolution,
shouldContinue))

// Test -r
if (iDim != numDims - 1)
{
return true;
if (findGridCodeZero_noModulo(domainToPlaneByModule,
x0, dims, readoutResolution,
shouldContinue))
{
return true;
}
}

// Test +r
x0[iDim] = radius;
if (findGridCodeZero_noModulo(domainToPlaneByModule,
x0, dims, readoutResolution,
Expand Down

0 comments on commit b9b97cc

Please sign in to comment.