Skip to content

Commit 7ab155b

Browse files
committed
fixes for type changes
1 parent b13153e commit 7ab155b

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

src/htm/algorithms/SpatialPooler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ void SpatialPooler::calculateOverlapPct_(const vector<SynapseIdx> &overlaps,
842842

843843

844844
void SpatialPooler::inhibitColumns_(const vector<Real> &overlaps,
845-
vector<UInt> &activeColumns) const {
845+
vector<CellIdx> &activeColumns) const {
846846
Real density = localAreaDensity_;
847847
if (numActiveColumnsPerInhArea_ > 0) {
848848
UInt inhibitionArea =

src/htm/algorithms/SpatialPooler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ class SpatialPooler : public Serializable
921921
columns.
922922
*/
923923
void inhibitColumns_(const vector<Real> &overlaps,
924-
vector<UInt> &activeColumns) const;
924+
vector<CellIdx> &activeColumns) const;
925925

926926
/**
927927
Perform global inhibition.

src/htm/algorithms/TemporalMemory.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,13 @@ void TemporalMemory::activateCells(const SDR &activeColumns, const bool learn) {
427427
const auto columnForSegment = [&](Segment segment) {
428428
return connections.cellForSegment(segment) / cellsPerColumn_;
429429
};
430-
const auto identity = [](const UInt a) {return a;}; //TODO use std::identity when c++20
430+
const auto identity = [](const ElemSparse a) {return a;}; //TODO use std::identity when c++20
431431

432432
for (auto &&columnData : groupBy( //group by columns, and convert activeSegments & matchingSegments to cols.
433433
sparse, identity,
434434
activeSegments_, columnForSegment,
435435
matchingSegments_, columnForSegment)) {
436-
UInt column;
436+
CellIdx column;
437437
vector<Segment>::const_iterator activeColumnsBegin, activeColumnsEnd,
438438
columnActiveSegmentsBegin, columnActiveSegmentsEnd,
439439
columnMatchingSegmentsBegin, columnMatchingSegmentsEnd;
@@ -598,9 +598,12 @@ SDR TemporalMemory::cellsToColumns(const SDR& cells) const {
598598
auto correctDims = getColumnDimensions(); //nD column dimensions (eg 10x100)
599599
correctDims.push_back(static_cast<CellIdx>(getCellsPerColumn())); //add n+1-th dimension for cellsPerColumn (eg. 10x100x8)
600600

601-
NTA_CHECK(cells.dimensions == correctDims)
601+
NTA_CHECK(cells.dimensions.size() == correctDims.size())
602602
<< "cells.dimensions must match TM's (column dims x cellsPerColumn) ";
603603

604+
for(size_t i = 0; i<correctDims.size(); i++)
605+
NTA_CHECK(correctDims[i] == cells.dimensions[i]);
606+
604607
SDR cols(getColumnDimensions());
605608
auto& dense = cols.getDense();
606609
for(const auto cell : cells.getSparse()) {

src/htm/types/Sdr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ namespace htm {
318318
NTA_CHECK( ( 1 + fractionNoise) * getSparsity() <= 1. );
319319

320320
const UInt num_move_bits = (UInt) std::round( fractionNoise * getSum() );
321-
const vector<UInt> turn_off = rng.sample(getSparse(), num_move_bits);
321+
const auto& turn_off = rng.sample(getSparse(), num_move_bits);
322322

323323
auto& dns = getDense();
324324

src/htm/utils/GroupBy.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static KeyType minFrontKey(KeyType frontrunner, Iterator0 begin0,
7777
KeyType ret = frontrunner;
7878

7979
if (begin0 != end0) {
80-
ret = std::min(ret, keyFn0(*begin0));
80+
ret = std::min(ret, static_cast<KeyType>(keyFn0(*begin0)));
8181
}
8282

8383
if (begin1 != end1) {

0 commit comments

Comments
 (0)