Cache numSegments and numSynapses for performance
Merge pull request #230 from chetan51/issue-229

Cache numSegments and numSynapses for performance