public void Propagate() { for (int i = 1; i < layers.Length; i++) { double[] prevLayerValues = new double[layers[i - 1].Neurons.Length]; Array.ForEach(NetMath.Range(layers[i - 1].Neurons.Length), j => prevLayerValues[j] = layers[i - 1].Neurons[j].Val); for (int j = 0; j < layers[i].Neurons.Length; j++) { double dotSum = NetMath.DotProduct(prevLayerValues, layers[i].Neurons[j].Weights); double activated = Sigmoid(dotSum + layers[i].Neurons[j].Bias); layers[i].Neurons[j].Val = activated; } } }