* Sample psi
*/
final MultivariateGaussian priorPsi = prevState.getPsiSS();
final Vector priorPsiSmpl = priorPsi.sample(this.getRandom());
final KalmanFilter kf = prevState.getFilter().clone();
/*
* Update the filter parameters with the new psi.
*/
final Matrix smplArTerms = MatrixFactory.getDefault().createDiagonal(
priorPsiSmpl.subVector(
priorPsiSmpl.getDimensionality()/2,
priorPsiSmpl.getDimensionality() - 1));
kf.getModel().setA(smplArTerms);
final Vector smplOffsetTerm = priorPsiSmpl.subVector(0,
priorPsiSmpl.getDimensionality()/2 - 1);
kf.getModel().setState(smplOffsetTerm);
kf.setCurrentInput(smplOffsetTerm);
/*
* Perform the Kalman update to get the posterior state suff. stats.
*/
final InverseGammaDistribution priorSigma2 = prevState.getSigma2SS().clone();
final double sigma2Sample = priorSigma2.sample(this.getRandom());
MultivariateGaussian posteriorState = prevState.getState().clone();
// TODO FIXME gross hack!
// posteriorState.getCovariance().scaleEquals(sigma2Sample);
// kf.setMeasurementCovariance(Iy.scale(sigma2Sample));
// kf.setModelCovariance(Ix.scale(sigma2Sample));
kf.predict(posteriorState);
kf.update(posteriorState, data.getObservedValue());
// kf.setMeasurementCovariance(Iy);
// kf.setModelCovariance(Ix);
final GaussianArHpWfParticle newTransState =