*
* @throws StructuralException
*/
private void createDendrites() throws StructuralException {
NEFEnsemble[] e = new NEFEnsemble[this.size];
NEFEnsembleFactoryImpl f = new NEFEnsembleFactoryImpl();
NodeFactory g = null;
int i = 0;
float[][] w = MU.I(this.dim); //Identity Matrix transform for the termination on each dendritic ensemble
Random rand = new Random(); //random number generator to select scales for dendrite trees
Random sizeRand = new Random();//Random number generator to select subunit numbers
int newR; //new range from which to choose dendrite scales from
int newSize; //new size chosen from subUnitRange
if (this.LIFDendrites == true) {
g = new LIFNeuronFactory();
} else {
//According to Poirazi et al (2003), a pyramidal neuron's dendrites can be represented as sigmoid subunits capable of spiking
//The function of the sigmoid subunits is assumed to be the same for each subunit and is...
//... s(n) = 1/(1+exp((3.6-n)/0.20) + 0.30n + 0.0114n^2)
g = new PoiraziDendriteFactory();
}
f.setNodeFactory(g);
//make ensemble and add termination
while (i < this.size) {
//if the high and low values are the same, then there is no need to randomly pick a number
if (this.mySubDifference == 0) {
newSize = (int)this.myDendriteCount.getLow();
//if a range is given, a new size is chosen for each dendritic ensemble between the two values specified
} else {
//while this can be done in the class IndicatorPDF, it returns a float[] and is incompatible with the make function of NEFEnsembleFactoryImpl
newSize = (int) (this.myDendriteCount.getLow() + sizeRand.nextInt((int)(this.mySubDifference + 1)));
}
if (this.LIFDendrites == false) {
//select a new range of dendrite scales
//the range is selected at random from the ranges value. This represents the range of scales for the dendritic tree as a whole
//then, each dendrite gets a random scale number chosen from this new range
newR = rand.nextInt(this.ranges);
//ensures that the range to choose from is always greater than 0 in order to avoid an exception
if(newR == 0) {
newR = 1;
}
this.myRange[i][0] = newR;
((PoiraziDendriteFactory)g).changeRange(newR);
}
e[i] = f.make("Dendrites" + i, newSize, this.dim);
e[i].addDecodedTermination("dinput" + i, w , 0.007f, false);
//if a function is being computed, the radius and encoders are different than they normally would be
if (this.myConnectedOrigin != "X") {
((NEFEnsembleImpl)e[i]).setEncoders(this.setDendriteEncoders(newSize));