protected double PropogateForward(RectangularStep upstream, int upstreamX, int upstreamY, int mapNumber)
{
Debug.Assert(upstreamX + Width <= upstream.Width); // Check we are staying within the width limit of the step.
Debug.Assert(upstreamY + Height <= upstream.Height); // Check we are staying within the height limit of the step.
double result = Bias;
int upstreamIndex = (upstreamY * upstream.Width) + upstreamX;
int weightIndex = mapNumber * Width * Height;
for (int y = 0; y < Height; y++)
{
for (int x = 0; x < Width; x++)
{
result += upstream.Output[upstreamIndex] * Weight[weightIndex];
upstreamIndex += 1;
weightIndex += 1;
}
upstreamIndex += upstream.Width - Width;
}
return result;
}