* @throws SimulationException If the given state is not of the expected dimension (ie the input
* dimension of the functions provided in the constructor)
*/
public void run(float[] state, float startTime, float endTime) throws SimulationException {
if (state != null && state.length != myFunctions[0].getDimension()) {
throw new SimulationException("Origin dimension is " + myFunctions[0].getDimension() +
" but state dimension is " + state.length);
}
float[] values = new float[myFunctions.length];
float stepSize = endTime - startTime;
mySTPHistory = new float[myNodes.length];
if (myMode == SimulationMode.DIRECT) {
for (int i = 0; i < values.length; i++) {
values[i] = myFunctions[i].map(state);
}
} else if (myMode == SimulationMode.EXPRESS) {
for (int i = 0; i < values.length; i++) {
values[i] = myFunctions[i].map(state);
}
//create default ExpressModel if necessary ...
if (myExpressModel == null) {
myExpressModel = new DefaultExpressModel(this);
}
values = myExpressModel.getOutput(startTime, state, values);
} else {
for (int i = 0; i < myNodes.length; i++) {
try {
InstantaneousOutput o = myNodes[i].getOrigin(myNodeOrigin).getValues();
float val = 0;
if (o instanceof SpikeOutput) {
val = ((SpikeOutput) o).getValues()[0] ? 1f / stepSize : 0f;
} else if (o instanceof RealOutput) {
val = ((RealOutput) o).getValues()[0];
} else {
throw new Error("Node output is of type " + o.getClass().getName()
+ ". DecodedOrigin can only deal with RealOutput and SpikeOutput, so it apparently has to be updated");
}
float[] decoder = getDynamicDecoder(i, val, startTime, endTime);
for (int j = 0; j < values.length; j++) {
values[j] += val * decoder[j];
}
} catch (StructuralException e) {
throw new SimulationException(e);
}
}
}
if (myNoise != null) {