Skip to content

Fix `simult_.m` to call specialized simulation codes for order <= 3 instead of...

Normann Rion requested to merge normann/dynare:pruning into master

Fix simult_.m to call specialized simulation codes for order <= 3 instead of k_order_simul whenever possible.

After having a look at the k_order_solver option, it is still needed when order is >= 3 to solve the model. When it comes to simulation (in simult_.m), it's another story. W/out pruning, the k_order_simul routine is necessary when order >= 3. With pruning, it's necessary when order >= 4. k_order_solver is the default option when order >=3.

In the current implementation, if the user sets the k_order_solver option in stoch_simul, he actively chooses to use the k_order_simul regardless the gains the specialized MATLAB code provides for orders <= 3 compared to the k-order routine. Here, I choose to remove the link between the k_order_solver and the called simulation routine to use specialized (faster) code when available, the existence of which only depends on the order and the presence of pruning. If we really want to keep the user's freedom of choice between simulation routines, we could create a new option k_order_simul to explicitly call the same-name routine. Even though we solve and simulate within one stoch_simul command, the two actions are actually distinct. IMO, if the user really wants to depart from the default choice when order <= 3, he can call the k_order_simul routine himself in the mod file and such a new option is unnecessary. Following the same logic, the k_order_solver keyword and options are unnecessary and should be removed.

Merge request reports