Skip to content

Commit 99acf9d

Browse files
committed
Added frontier delta computation back into ConnGrowth
1 parent b6e2aaa commit 99acf9d

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

Simulator/Connections/Neuro/ConnGrowth.cpp

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,15 @@ void ConnGrowth::setup()
6767
W_ = CompleteMatrix(MATRIX_TYPE, MATRIX_INIT, numVertices, numVertices, 0);
6868
radii_ = VectorMatrix(MATRIX_TYPE, MATRIX_INIT, 1, numVertices, growthParams_.startRadius);
6969
rates_ = VectorMatrix(MATRIX_TYPE, MATRIX_INIT, 1, numVertices, 0);
70+
delta_ = CompleteMatrix(MATRIX_TYPE, MATRIX_INIT, numVertices, numVertices);
7071
area_ = CompleteMatrix(MATRIX_TYPE, MATRIX_INIT, numVertices, numVertices, 0);
7172
outgrowth_ = VectorMatrix(MATRIX_TYPE, MATRIX_INIT, 1, numVertices);
7273
deltaR_ = VectorMatrix(MATRIX_TYPE, MATRIX_INIT, 1, numVertices);
7374

75+
// Initialize connection frontier distance change matrix with the current distances
76+
Layout &layout = Simulator::getInstance().getModel().getLayout();
77+
delta_ = layout.dist_;
78+
7479
// Register VertorMatrix radii_ for Recording if need
7580
// Recorder &recorder = Simulator::getInstance().getModel().getRecorder();
7681
// string variableName = "radii";
@@ -128,6 +133,9 @@ bool ConnGrowth::updateConnections(AllVertices &vertices)
128133
// Update Connections data
129134
updateConns(vertices);
130135

136+
// Updata the distance between forntiers of vertices
137+
updateFrontiers();
138+
131139
// Update the areas of overlap in between vertices
132140
updateOverlap();
133141

@@ -161,10 +169,22 @@ void ConnGrowth::updateConns(AllVertices &vertices)
161169
radii_ += deltaR_;
162170
}
163171

172+
/// Update the distance between frontiers of vertices.
173+
void ConnGrowth::updateFrontiers()
174+
{
175+
LOG4CPLUS_INFO(fileLogger_, "Updating distance between frontiers...");
176+
// Update distance between frontiers
177+
Layout &layout = Simulator::getInstance().getModel().getLayout();
178+
int numVertices = Simulator::getInstance().getTotalVertices();
179+
for (int unit = 0; unit < numVertices - 1; unit++) {
180+
for (int i = unit + 1; i < numVertices; i++) {
181+
delta_(unit, i) = layout.dist_(unit, i) - (radii_[unit] + radii_[i]);
182+
delta_(i, unit) = delta_(unit, i);
183+
}
184+
}
185+
}
186+
164187
/// Update the areas of overlap in between Neurons.
165-
///
166-
/// @param numVertices Number of vertices to update.
167-
/// @param layout Layout information of the neural network.
168188
void ConnGrowth::updateOverlap()
169189
{
170190
int numVertices = Simulator::getInstance().getTotalVertices();
@@ -173,14 +193,11 @@ void ConnGrowth::updateOverlap()
173193
LOG4CPLUS_INFO(fileLogger_, "Computing areas of overlap");
174194

175195
// Compute areas of overlap; this is only done for overlapping units
176-
for (int i = 0; i < numVertices - 1; i++) {
177-
for (int j = i + 1; j < numVertices; j++) {
196+
for (int i = 0; i < numVertices; i++) {
197+
for (int j = 0; j < numVertices; j++) {
178198
area_(i, j) = 0.0;
179199

180-
// Calculate the distance between neuron frontiers
181-
BGFLOAT frontierDelta = layout.dist_(j, i) - (radii_[j] + radii_[i]);
182-
183-
if (frontierDelta < 0) {
200+
if (delta_(i, j) < 0) {
184201
BGFLOAT lenAB = layout.dist_(i, j);
185202
BGFLOAT r1 = radii_[i];
186203
BGFLOAT r2 = radii_[j];

Simulator/Connections/Neuro/ConnGrowth.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ class ConnGrowth : public Connections {
143143
/// @param neurons The Neuron list to search from.
144144
void updateConns(AllVertices &neurons);
145145

146+
/// Update the distance between frontiers of Neurons.
147+
void updateFrontiers();
148+
146149
/// Update the areas of overlap in between Neurons.
147150
void updateOverlap();
148151

@@ -182,6 +185,9 @@ class ConnGrowth : public Connections {
182185
/// spiking rate
183186
VectorMatrix rates_;
184187

188+
/// distance between connection frontiers
189+
CompleteMatrix delta_;
190+
185191
/// areas of overlap
186192
CompleteMatrix area_;
187193

0 commit comments

Comments
 (0)