An inner product, also called a dot product here, multiplies corresponding components of two equal-length vectors and adds the results to produce one number. In a neuron, the two vectors are its input signals and weights. The neuron applies an activation function to that number before passing an output onward. section 7.2 section 7.3
Use the dot product in a neuron
In Swift, the core of `Neuron.output(inputs:)` is `outputCache = dotProduct(inputs, weights)` followed by `return activationFunction(outputCache)`. Caching the value before activation matters: backpropagation later uses it to calculate the neuron's delta. section 7.5
The same operation appears during backpropagation. For a hidden neuron, collect the relevant weights and deltas from the next layer, then take their dot product when calculating its delta. This is a second use of the operation, not another pass of input signals through the neuron. section 7.5
/// Find the dot product of two vectors
/// assuming that they are of the same length
/// using SIMD instructions to speed computation
func dotProduct(_ xs: [Double], _ ys: [Double]) -> Double {
var answer: Double = 0.0
vDSP_dotprD(xs, 1, ys, 1, &answer, vDSP_Length(xs.count))
return answer
}
The Swift `dotProduct` helper calls Accelerate's `vDSP_dotprD`. It assumes equal-length `[Double]` inputs and returns the computed scalar; it does not check their lengths. section 7.3











