Dynare++: NaN or Inf asserted in TensorContainer::insert
Posted: Wed Mar 28, 2007 1:56 pm
This thread is a reply to the following Pawel's message:
Pawel, I have experienced all dynare++ errors
The message means that when solving higher order approximation, NaN or Inf values occurred in tensors (large multidimensional matrices). This can be caused by few operations.
The first possibility is an addition and multiplication of tensors. If the overflow happens in this case, then it is very likely that higher order derivatives of the solution explode (grow faster than factorial), which is a sign of non-stationary or non-existent solution. If the model is standard, check sizes of the shocks.
The second possibility is a higher order Sylvester equation. This solves deterministic part of the model, so the sizes of shocks do not matter. However, if your model is very persistent (i.e. the largest eigenvalue of the first derivative with respect to the states is close to 1), then higher order Sylvester equation can (in presence of roundoff) have eigenvalue equal to exact zero, which implies NaN or Inf in solution.
You can look to the journal file to know where the exception was thrown, whether it was just after Sylvester or somewhere else.
Also, a good way how to debug is to start with very small shocks and increase them. You should always try this first, if you have some problems connected to the solution.
Perhaps this helps.
kind rgrds
Ondra K.
However, in the meantime, I've been experiencing other sorts of unexpected dynare++ behaviour, which, I thought, you might be able to help with.
The most serious of these problems is that I have several models that run smoothly when expanded to second order, but crash when I try to do a third order expansion. I was wondering if you've experienced that sort of behaviour before (the error message I'm sometimes getting is: Caugth TL exception: At ./t_container.hweb:223:NaN or Inf asserted in TensorContainer::insert).
I'd be happy to send you the files that cause trouble if you'd like and if that's ok (unfortunately, due to security restrictions in place on all PC's at work I'm unable to upload any files to the forum).
Pawel, I have experienced all dynare++ errors
The message means that when solving higher order approximation, NaN or Inf values occurred in tensors (large multidimensional matrices). This can be caused by few operations.
The first possibility is an addition and multiplication of tensors. If the overflow happens in this case, then it is very likely that higher order derivatives of the solution explode (grow faster than factorial), which is a sign of non-stationary or non-existent solution. If the model is standard, check sizes of the shocks.
The second possibility is a higher order Sylvester equation. This solves deterministic part of the model, so the sizes of shocks do not matter. However, if your model is very persistent (i.e. the largest eigenvalue of the first derivative with respect to the states is close to 1), then higher order Sylvester equation can (in presence of roundoff) have eigenvalue equal to exact zero, which implies NaN or Inf in solution.
You can look to the journal file to know where the exception was thrown, whether it was just after Sylvester or somewhere else.
Also, a good way how to debug is to start with very small shocks and increase them. You should always try this first, if you have some problems connected to the solution.
Perhaps this helps.
kind rgrds
Ondra K.