Use MEX to create stacked Jacobian in two-boundaries blocks with block decomposition
The perfect_foresight_problem
MEX was introduced so as to speed-up the construction of the stacked Jacobian for deterministic problems (when there are both leads and lags).
However, when doing block decomposition, there is no equivalent MEX for constructing the stacked Jacobian for two-boundaries blocks. This is an obvious opportunity for optimization.
It remains to be seen how much can be factorized with the existing perfect_foresight_problem
MEX. The bytecode case may also need special treatment.