protected internal void ComputeLayer(int currentLayer)
{
int inputIndex = _layerIndex[currentLayer];
int outputIndex = _layerIndex[currentLayer - 1];
int inputSize = _layerCounts[currentLayer];
int outputSize = _layerFeedCounts[currentLayer - 1];
int index = _weightIndex[currentLayer - 1];
int limitX = outputIndex + outputSize;
int limitY = inputIndex + inputSize;
// weight values
for (int x = outputIndex; x < limitX; x++)
{
double sum = 0;
for (int y = inputIndex; y < limitY; y++)
{
sum += _weights[index++]*_layerOutput[y];
}
_layerOutput[x] = sum;
_layerSums[x] = sum;
}
_activationFunctions[currentLayer - 1].ActivationFunction(
_layerOutput, outputIndex, outputSize);
// update context values
int offset = _contextTargetOffset[currentLayer];
for (int x = 0; x < _contextTargetSize[currentLayer]; x++)
{
_layerOutput[offset + x] = _layerOutput[outputIndex + x];
}
}