Program: 72936
Project: 72936
Buggy source:
/** 
 * Consume the inputs and produce the outputs of the FFT filter.
 * @exception IllegalActionException If a runtime type error occurs.
 */
public void fire() throws IllegalActionException {
  super.fire();
  populateArrays();
  if ((_nStates != _s0.length) || (_nStates != _A0.length) || (_nStates != _priors.length)|| (_nStates != _m0.length)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  Token observationArray=input.get(0);
  _observationLength=((ArrayToken)observationArray).length();
  _observations=new double[_observationLength];
  if (_observationLength <= 0) {
    throw new IllegalActionException(this,"String_Node_Str" + _observationLength + "String_Node_Str");
  }
  for (int i=0; i < _observationLength; i++) {
    _observations[i]=((DoubleToken)((ArrayToken)observationArray).getElement(i)).doubleValue();
  }
  HashMap newEstimates=new HashMap();
  int nStates=_m0.length;
  if (_modelType == _HMM) {
    double[][] A_new=new double[nStates][nStates];
    double[] m_new=new double[nStates];
    double[] s_new=new double[nStates];
    int asked=0;
    for (int iterations=0; iterations < _nIterations; iterations++) {
      newEstimates=gaussianHMM(0,_observations,_A0,_m0,_s0,_priors);
      m_new=(double[])newEstimates.get("String_Node_Str");
      s_new=(double[])newEstimates.get("String_Node_Str");
      A_new=(double[][])newEstimates.get("String_Node_Str");
      if ((m_new[0] != m_new[0]) || (s_new[0] != s_new[0]) || (A_new[0] != A_new[0])) {
        if (iterations < _nIterations - 1) {
        }
 else {
          MessageHandler.message("String_Node_Str");
        }
        double minO=_observations[0];
        double maxO=_observations[0];
        for (int t=0; t < _observations.length; t++) {
          if (_observations[t] < minO) {
            minO=_observations[t];
          }
          if (_observations[t] > maxO) {
            maxO=_observations[t];
          }
        }
        double L=maxO - minO;
        for (int i=0; i < nStates; i++) {
          m_new[i]=L / nStates * Math.random() + L * i / nStates + minO;
          s_new[i]=Math.abs((maxO - minO) * Math.random()) / nStates;
          for (int j=0; j < nStates; j++) {
          }
        }
        A_new=_Ainit;
        Arrays.sort(m_new);
      }
      if ((_m0[0] - m_new[0]) < mTol) {
      }
      _A0=A_new;
      _s0=s_new;
      _m0=m_new;
    }
    Token[] mTokens=new Token[nStates];
    Token[] sTokens=new Token[nStates];
    for (int i=0; i < nStates; i++) {
      mTokens[i]=new DoubleToken(m_new[i]);
      sTokens[i]=new DoubleToken(s_new[i]);
    }
    mean.send(0,new ArrayToken(mTokens));
    sigma.send(0,new ArrayToken(sTokens));
    transitionMatrix.send(0,new DoubleMatrixToken(A_new));
  }
 else   if (_modelType == _MM) {
    double[] pi_new=new double[nStates];
    double[] m_new=new double[nStates];
    double[] s_new=new double[nStates];
    for (int iterations=0; iterations < _nIterations; iterations++) {
      newEstimates=gaussianMM(0,_observations,_m0,_s0,_priors);
      m_new=(double[])newEstimates.get("String_Node_Str");
      s_new=(double[])newEstimates.get("String_Node_Str");
      pi_new=(double[])newEstimates.get("String_Node_Str");
      _priors=pi_new;
      _s0=s_new;
      _m0=m_new;
    }
    Token[] mTokens=new Token[nStates];
    Token[] sTokens=new Token[nStates];
    Token[] pTokens=new Token[nStates];
    for (int i=0; i < nStates; i++) {
      mTokens[i]=new DoubleToken(m_new[i]);
      sTokens[i]=new DoubleToken(s_new[i]);
      pTokens[i]=new DoubleToken(pi_new[i]);
    }
    mean.send(0,new ArrayToken(mTokens));
    sigma.send(0,new ArrayToken(sTokens));
    transitionMatrix.send(0,new ArrayToken(pTokens));
  }
}

Fixed version (ground truth):
/** 
 * Consume the inputs and produce the outputs of the FFT filter.
 * @exception IllegalActionException If a runtime type error occurs.
 */
public void fire() throws IllegalActionException {
  super.fire();
  populateArrays();
  if ((_nStates != _s0.length) || (_nStates != _A0.length) || (_nStates != _priors.length)|| (_nStates != _m0.length)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  Token observationArray=input.get(0);
  _observationLength=((ArrayToken)observationArray).length();
  _observations=new double[_observationLength];
  if (_observationLength <= 0) {
    throw new IllegalActionException(this,"String_Node_Str" + _observationLength + "String_Node_Str");
  }
  for (int i=0; i < _observationLength; i++) {
    _observations[i]=((DoubleToken)((ArrayToken)observationArray).getElement(i)).doubleValue();
  }
  HashMap newEstimates=new HashMap();
  int nStates=_m0.length;
  if (_modelType == _HMM) {
    double[][] A_new=new double[nStates][nStates];
    double[] m_new=new double[nStates];
    double[] s_new=new double[nStates];
    for (int iterations=0; iterations < _nIterations; iterations++) {
      newEstimates=gaussianHMM(0,_observations,_A0,_m0,_s0,_priors);
      m_new=(double[])newEstimates.get("String_Node_Str");
      s_new=(double[])newEstimates.get("String_Node_Str");
      A_new=(double[][])newEstimates.get("String_Node_Str");
      if ((m_new[0] != m_new[0]) || (s_new[0] != s_new[0]) || (A_new[0] != A_new[0])) {
        if (iterations < _nIterations - 1) {
        }
 else {
          MessageHandler.message("String_Node_Str");
        }
        double minO=_observations[0];
        double maxO=_observations[0];
        for (int t=0; t < _observations.length; t++) {
          if (_observations[t] < minO) {
            minO=_observations[t];
          }
          if (_observations[t] > maxO) {
            maxO=_observations[t];
          }
        }
        double L=maxO - minO;
        for (int i=0; i < nStates; i++) {
          m_new[i]=L / nStates * Math.random() + L * i / nStates + minO;
          s_new[i]=Math.abs((maxO - minO) * Math.random()) / nStates;
          for (int j=0; j < nStates; j++) {
          }
        }
        A_new=_Ainit;
        Arrays.sort(m_new);
      }
      if ((_m0[0] - m_new[0]) < mTol) {
      }
      _A0=A_new;
      _s0=s_new;
      _m0=m_new;
    }
    Token[] mTokens=new Token[nStates];
    Token[] sTokens=new Token[nStates];
    for (int i=0; i < nStates; i++) {
      mTokens[i]=new DoubleToken(m_new[i]);
      sTokens[i]=new DoubleToken(s_new[i]);
    }
    mean.send(0,new ArrayToken(mTokens));
    sigma.send(0,new ArrayToken(sTokens));
    transitionMatrix.send(0,new DoubleMatrixToken(A_new));
  }
 else   if (_modelType == _MM) {
    double[] pi_new=new double[nStates];
    double[] m_new=new double[nStates];
    double[] s_new=new double[nStates];
    for (int iterations=0; iterations < _nIterations; iterations++) {
      newEstimates=gaussianMM(0,_observations,_m0,_s0,_priors);
      m_new=(double[])newEstimates.get("String_Node_Str");
      s_new=(double[])newEstimates.get("String_Node_Str");
      pi_new=(double[])newEstimates.get("String_Node_Str");
      _priors=pi_new;
      _s0=s_new;
      _m0=m_new;
    }
    Token[] mTokens=new Token[nStates];
    Token[] sTokens=new Token[nStates];
    Token[] pTokens=new Token[nStates];
    for (int i=0; i < nStates; i++) {
      mTokens[i]=new DoubleToken(m_new[i]);
      sTokens[i]=new DoubleToken(s_new[i]);
      pTokens[i]=new DoubleToken(pi_new[i]);
    }
    mean.send(0,new ArrayToken(mTokens));
    sigma.send(0,new ArrayToken(sTokens));
    transitionMatrix.send(0,new ArrayToken(pTokens));
  }
}