Improve performance of local_state_space_iteration_*

The local_state_space_iteration_2 MEX is much faster than local_state_space_iteration_k at order 2.

The solution is to fully rewrite it without using Dynare++ codebase (and by the way, do that in Fortran). This will be done via #1802 (closed)

Related to #1768 (closed) and #1643.

Edited by Johannes Pfeifer