}
for (int i = 0; i < n; i++) {
Node node = myNodeFactory.make("node" + i);
if ( !(node instanceof NEFNode) ) {
throw new StructuralException("Nodes must be NEFNodes");
}
nodes[i] = (NEFNode) node;
nodes[i].setMode(SimulationMode.CONSTANT_RATE);
if ( !nodes[i].getMode().equals(SimulationMode.CONSTANT_RATE) ) {
throw new StructuralException("Neurons in an NEFEnsemble must support CONSTANT_RATE mode");
}
nodes[i].setMode(SimulationMode.DEFAULT);
}
float[][] encoders = myEncoderFactory.genVectors(n, dim);
float[][] evalPoints = getEvalPointFactory().genVectors(getNumEvalPoints(dim), dim);
NEFEnsemble result = construct(name, nodes, encoders, myApproximatorFactory, evalPoints, radii);
addDefaultOrigins(result);
result.setEnsembleFactory(this);
return result;
}
catch(RuntimeException re)
{
// a singular gamma matrix can produce a runtime exception. If this occurs,
// call make again.
if(re.getMessage() != null && re.getMessage().equals("Matrix is singular.")) {
if (attempts<10) {
return doMake(name,n,radii,attempts+1);
} else {
throw new StructuralException("Error creating ensemble: With the given parameters, there is insufficient\nneural activity to construct a decoder (the activity matrix is singular)");
}
} else
{
System.err.println(re);
return(null);