I'm trying to make a type of Neural Network. I am working in Java. I'm looking for speed, so I want to represent my network in a 3D array. The network can basically be represented as weights, so I have
double weights[][][]
where
weights[numberOfLayers][neuronsPerLayer][weightFromThisNeuronToTheOneInTheNextLayer]
So, the weights[numberOfLayers] is totally fine. I want 3 layers, so I'll initialize as weights[3][][], but the number of neurons per layer changes, and the number of connections (the third dimension) is equal to the number of neurons in the next layer.
I know I could initialize the array to the size that fits the largest one, and has lots of extra room for some of them.. however, I really want to be able to use nested for loops and count until the end of an array has been reached.