From 2eb43cf2f6df9d4dae3be2e3bb31b6d15dd99907 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Sun, 23 Jun 2013 12:24:06 +0200 Subject: [PATCH] Add check for purely backwards model to k_order_pert The k_order_solver does not solve purely backwards models (as is the case in stochastic_solvers.m). But in contrast to stochastic_solvers, there is no check and no warning. Entering the mex-file then results in a crash of Matlab --- matlab/k_order_pert.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/matlab/k_order_pert.m b/matlab/k_order_pert.m index 7a02d8acd..315c4494a 100644 --- a/matlab/k_order_pert.m +++ b/matlab/k_order_pert.m @@ -30,6 +30,10 @@ nspred = M.nspred; if order>1 && options.loglinear error('The loglinear-option currently only works at order 1') end +if M.maximum_endo_lead == 0 && order>1 + error(['2nd and 3rd order approximation not implemented for purely ' ... + 'backward models']) +end switch(order) case 1