*/
public float[] eval(float[] input) throws IOException
{
//Setup the input values
int numberOfInputValues = input.length;
ExecutionContext context = new ExecutionContext(OPERATORS);
for (int i = numberOfInputValues - 1; i >= 0; i--)
{
PDRange domain = getDomainForInput(i);
float value = clipToRange(input[i], domain.getMin(), domain.getMax());
context.getStack().push(value);
}
//Execute the type 4 function.
instructions.execute(context);
//Extract the output values
int numberOfOutputValues = getNumberOfOutputParameters();
int numberOfActualOutputValues = context.getStack().size();
if (numberOfActualOutputValues < numberOfOutputValues)
{
throw new IllegalStateException("The type 4 function returned "
+ numberOfActualOutputValues
+ " values but the Range entry indicates that "
+ numberOfOutputValues + " values be returned.");
}
float[] outputValues = new float[numberOfOutputValues];
for (int i = numberOfOutputValues - 1; i >= 0; i--)
{
PDRange range = getRangeForOutput(i);
outputValues[i] = context.popReal();
outputValues[i] = clipToRange(outputValues[i], range.getMin(), range.getMax());
}
//Return the resulting array
return outputValues;