@Override public boolean collapse(AugmentedState state) { if (state.getInfo() != StateInfo.Forecast) { return false; } if (!isPositive(Q.diagonal().drop(0, 1))) { return false; } // update the state vector Matrix A = new Matrix(state.B()); int d = A.getColumnsCount(); Matrix S = new Matrix(a()); LowerTriangularMatrix.rsolve(S, A.subMatrix().transpose()); DataBlock D = b().deepClone(); LowerTriangularMatrix.lsolve(S, D); for (int i = 0; i < d; ++i) { DataBlock col = A.column(i); state.a().addAY(-Q.get(d, i), col); state.P().addXaXt(1, col); } state.dropAllConstraints(); return true; }