@@ -42,8 +42,8 @@ using SynapseIdx= UInt16; /** Index of synapse in segment. */
4242using Segment = UInt32; /* * Index of segment's data. */
4343using Synapse = UInt32; /* * Index of synapse's data. */
4444using Permanence= Real32; // TODO experiment with half aka float16
45- const Permanence minPermanence = 0 .0f ;
46- const Permanence maxPermanence = 1 .0f ;
45+ constexpr const Permanence minPermanence = 0 .0f ;
46+ constexpr const Permanence maxPermanence = 1 .0f ;
4747
4848
4949/* *
@@ -651,10 +651,13 @@ class Connections : public Serializable
651651 Permanence connectedThreshold_; // TODO make const
652652
653653 // Extra bookkeeping for faster computing of segment activity.
654- std::unordered_map<CellIdx, std::vector<Synapse>> potentialSynapsesForPresynapticCell_;
655- std::unordered_map<CellIdx, std::vector<Synapse>> connectedSynapsesForPresynapticCell_;
656- std::map<CellIdx, std::vector<Segment>> potentialSegmentsForPresynapticCell_;
657- std::map<CellIdx, std::vector<Segment>> connectedSegmentsForPresynapticCell_;
654+
655+ struct identity { constexpr size_t operator ()( const CellIdx t ) const noexcept { return t; }; }; // TODO in c++20 use std::identity
656+
657+ std::unordered_map<CellIdx, std::vector<Synapse>, identity> potentialSynapsesForPresynapticCell_;
658+ std::unordered_map<CellIdx, std::vector<Synapse>, identity> connectedSynapsesForPresynapticCell_;
659+ std::unordered_map<CellIdx, std::vector<Segment>, identity> potentialSegmentsForPresynapticCell_;
660+ std::unordered_map<CellIdx, std::vector<Segment>, identity> connectedSegmentsForPresynapticCell_;
658661
659662 std::vector<Segment> segmentOrdinals_;
660663 std::vector<Synapse> synapseOrdinals_;
0 commit comments