protected void PropogateError(RectangularStep downstream, RectangularStep upstream, int downstreamX, int downstreamY)
{
int downstreamIndex = downstreamY * downstream.Width + downstreamX;
int upstreamIndex = (downstreamY * Height * upstream.Width) + downstreamX * Width;
double downstreamErrorDerivative = downstream.ErrorDerivative[downstreamIndex];
double upstreamError = Weight * downstreamErrorDerivative;
double weightError = 0.0;
for (int y = 0; y < Height; y++)
{
for (int x = 0; x < Width; x++)
{
upstream.ErrorDerivative[upstreamIndex] = upstreamError;
double weightErrorGradient = downstreamErrorDerivative * upstream.Output[upstreamIndex];
weightError += weightErrorGradient;
upstreamIndex += 1;
}
upstreamIndex += upstream.Width - Width;
}
Weight -= weightError * WeightStepSize;
}