Code: Select all
/**********************************************************
* Variable definitions for outputs and weights. *
**********************************************************/
/*
ns is the array that holds neuron states by layer
and neuron. the first bracket set is the layer
number, the second is the neuron number.
*/
double ns[][] = new double[10][10];
/*
nw is the array that holds the neuron input weights.
the first two bracket sets function the same as in
no, the third determines which input neuron is being
specified, and the number contained is the weight
for that input.
*/
double nw[][][] = new double[10][10][10];
/******************************************************
* Code for the actual neuronal functions. *
******************************************************/
// o: output neuron selector or previous layer neuron selector
int o = 0;
// n: present neuron selector
int n = 0;
// l: layer selector
int l = 1;
// runs through the layers
while (l < 10)
{
// runs through the neurons
while (n < 10)
{
// runs through the output neuron weights
while (o < 10)
{
// sets the state for the current neuron (l,n) as the current state
// plus one tenth the product of the output for neuron (l-1,o), the
// weight for that neuron (l,n,o)
ns[l][n] = ns[l][n] + (ns[l-1][o] * nw[l][n][o] * 0.1);
// increments o so the while (o < 10) loop runs down
o = o++;
}
// increments n so the while (n < 10) loop runs down
n = n++;
// sets o to 0 so that the next implementation of the while (o < 10) loop
// actually functions. otherwise o would equal 9 and the loop would not loop
o = 0;
}
// increments l so the while (l < 10) loop runs
l = l++;
// sets n to 0
n = 0;
}
/*************************************************************
* summary to present: *
* :: definitions for the properties are set (ns, and nw) *
* :: output, layer, and present neuron selectors are set *
* :: while loops go through each output neuron, summing the *
* present ns with 1/10th the product of the output of the *
* selected neuron and the associated weight, through each *
* neuron and layer *
*************************************************************/