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

Commit

Permalink
Revert "Revert "add SparseBinaryMatrix.rowFromSparse()""
Browse files Browse the repository at this point in the history
This reverts commit 551c455.
  • Loading branch information
breznak committed Dec 31, 2014
1 parent 82dcdc6 commit 751caa5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nupic/algorithms/SpatialPooler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ void SpatialPooler::initialize(vector<UInt> inputDimensions,
{
vector<UInt> potential = mapPotential_(i, wrapAround_);
vector<Real> perm = initPermanence_(potential, initConnectedPct_);
potentialPools_.rowFromDense(i,potential.begin(),potential.end());
potentialPools_.rowFromSparse(i,potential.begin(),potential.end());
updatePermanencesForColumn_(perm,i,true);
}

Expand Down
18 changes: 18 additions & 0 deletions src/nupic/math/SparseBinaryMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,24 @@ namespace nupic {
ind_[row].push_back((size_type)(it - begin));
}

//--------------------------------------------------------------------------------
template <typename InputIterator>
inline void
rowFromSparse(size_type row, InputIterator begin, InputIterator end)
{
{ // Pre-conditions
NTA_ASSERT(row < nRows())
<< "SparseBinaryMatrix::rowFromDense: "
<< "Invalid row index: " << row;
} // End pre-conditions

ind_[row].clear();
for (InputIterator it = begin; it != end; ++it)
if (!nearlyZero(*it))
ind_[row].push_back(*it);
}


//--------------------------------------------------------------------------------
template <typename OutputIterator>
inline void
Expand Down

0 comments on commit 751caa5

Please sign in to comment.