Program: 72483
Project: 72483
Buggy source:
/** 
 * Consume the inputs and produce the outputs of the FFT filter.
 * @exception IllegalActionException If a runtime type error occurs.
 */
@Override public void fire() throws IllegalActionException {
  super.fire();
  mean.update();
  standardDeviation.update();
  transitionMatrix.update();
  prior.update();
  _nStates=((ArrayToken)mean.getToken()).length();
  _priors=new double[_nStates];
  _transitionMatrixEstimate=new double[_nStates][_nStates];
  for (int i=0; i < _nStates; i++) {
    _priors[i]=((DoubleToken)((ArrayToken)prior.getToken()).getElement(i)).doubleValue();
    for (int j=0; j < _nStates; j++) {
      _transitionMatrixEstimate[i][j]=((DoubleToken)((MatrixToken)transitionMatrix.getToken()).getElementAsToken(i,j)).doubleValue();
    }
  }
  int obsDim=1;
  if (((ArrayToken)mean.getToken()).getElementType().isCompatible(BaseType.DOUBLE)) {
    _mu=new double[_nStates][obsDim];
    _sigma=new double[_nStates][obsDim][obsDim];
    for (int i=0; i < _nStates; i++) {
      _sigma[i][0][0]=((DoubleToken)((ArrayToken)standardDeviation.getToken()).getElement(i)).doubleValue();
      _mu[i][0]=((DoubleToken)((ArrayToken)mean.getToken()).getElement(i)).doubleValue();
    }
  }
 else {
    obsDim=((ArrayToken)((ArrayToken)mean.getToken()).getElement(0)).length();
    _mu=new double[_nStates][obsDim];
    _sigma=new double[_nStates][obsDim][obsDim];
    for (int i=0; i < _nStates; i++) {
      _sigma[i]=((DoubleMatrixToken)((ArrayToken)standardDeviation.getToken()).getElement(i)).doubleMatrix();
      for (int j=0; j < obsDim; j++) {
        _mu[i][j]=((DoubleToken)((ArrayToken)((ArrayToken)mean.getToken()).getElement(i)).getElement(j)).doubleValue();
      }
    }
  }
  if ((_nStates != _sigma.length) || (_nStates != _transitionMatrixEstimate.length)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  if (_observations != null) {
    int[] classifyStates=new int[_observations.length];
    classifyStates=classifyHMM(_observations,_priors,_transitionMatrixEstimate);
    IntToken[] _outTokenArray=new IntToken[classifyStates.length];
    for (int i=0; i < classifyStates.length; i++) {
      _outTokenArray[i]=new IntToken(classifyStates[i]);
    }
    output.broadcast(new ArrayToken(BaseType.INT,_outTokenArray));
    likelihood.send(0,new DoubleToken(_likelihood));
  }
}

Fixed version (ground truth):
/** 
 * Consume the inputs and produce the outputs of the FFT filter.
 * @exception IllegalActionException If a runtime type error occurs.
 */
@Override public void fire() throws IllegalActionException {
  super.fire();
  mean.update();
  covariance.update();
  transitionMatrix.update();
  prior.update();
  _nStates=((ArrayToken)mean.getToken()).length();
  _priors=new double[_nStates];
  _transitionMatrixEstimate=new double[_nStates][_nStates];
  for (int i=0; i < _nStates; i++) {
    _priors[i]=((DoubleToken)((ArrayToken)prior.getToken()).getElement(i)).doubleValue();
    for (int j=0; j < _nStates; j++) {
      _transitionMatrixEstimate[i][j]=((DoubleToken)((MatrixToken)transitionMatrix.getToken()).getElementAsToken(i,j)).doubleValue();
    }
  }
  int obsDim=1;
  if (((ArrayToken)mean.getToken()).getElementType().isCompatible(BaseType.DOUBLE)) {
    _mu=new double[_nStates][obsDim];
    _sigma=new double[_nStates][obsDim][obsDim];
    for (int i=0; i < _nStates; i++) {
      _sigma[i][0][0]=((DoubleToken)((ArrayToken)covariance.getToken()).getElement(i)).doubleValue();
      _mu[i][0]=((DoubleToken)((ArrayToken)mean.getToken()).getElement(i)).doubleValue();
    }
  }
 else {
    obsDim=((ArrayToken)((ArrayToken)mean.getToken()).getElement(0)).length();
    _mu=new double[_nStates][obsDim];
    _sigma=new double[_nStates][obsDim][obsDim];
    for (int i=0; i < _nStates; i++) {
      _sigma[i]=((DoubleMatrixToken)((ArrayToken)covariance.getToken()).getElement(i)).doubleMatrix();
      for (int j=0; j < obsDim; j++) {
        _mu[i][j]=((DoubleToken)((ArrayToken)((ArrayToken)mean.getToken()).getElement(i)).getElement(j)).doubleValue();
      }
    }
  }
  if ((_nStates != _sigma.length) || (_nStates != _transitionMatrixEstimate.length)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  if (_observations != null) {
    int[] classifyStates=new int[_observations.length];
    classifyStates=classifyHMM(_observations,_priors,_transitionMatrixEstimate);
    IntToken[] _outTokenArray=new IntToken[classifyStates.length];
    for (int i=0; i < classifyStates.length; i++) {
      _outTokenArray[i]=new IntToken(classifyStates[i]);
    }
    output.broadcast(new ArrayToken(BaseType.INT,_outTokenArray));
    likelihood.send(0,new DoubleToken(_likelihood));
  }
}