Hello,
I’m currently struggling with the groupBy method in the GorupBy.hpp file of the htm.core implementation. But actually the reason I wanto to know that is that I don’t really get how the following code in the TemporalMemory::activateCells(…) method is working:
const auto toColumns = [&](const Segment segment)
{
return connections.cellForSegment(segment) / cellsPerColumn_;
};
const auto identity = [](const ElemSparse a) {return a;};
for (auto &&columnData : groupBy( //group by columns, and convert activeSegments & matchingSegments to cols.
sparse, identity,
activeSegments_, toColumns,
matchingSegments_, toColumns))
{
Segment column; //we say "column", but it's the first segment of n-segments per cells that belong to the column
vector<Segment>::const_iterator activeColumnsBegin, activeColumnsEnd,
columnActiveSegmentsBegin, columnActiveSegmentsEnd,
columnMatchingSegmentsBegin, columnMatchingSegmentsEnd;
std::tie(column,
activeColumnsBegin, activeColumnsEnd,
columnActiveSegmentsBegin, columnActiveSegmentsEnd,
columnMatchingSegmentsBegin, columnMatchingSegmentsEnd
) = columnData;
const bool isActiveColumn = activeColumnsBegin != activeColumnsEnd;
Especially I’m struggling with the last line. Why is a column active, if the activeColumnsBegin is unequal to the activeColumnsEnd?
Thank you in advance! I really appreciate any help!