Mex Code for QZ Decomposition

Hi there,

I am solving a GE model with heterogeneous firms with Reiter’s method. Currently, I am using my own code to solve the model due to the nested projection solution of the firms’ decision, which increase the scale of the system to around 2000 equations. Now I am trying to estimate the model, but the bottleneck for me is the qz decomposition part. Now, the first-order derivative matrix has the dimension of 1800x1800. The qz decomposition takes around 4 to 5 seconds. I noticed that Dynare has a compiled mex file for generalized QZ decomposition. I am wondering which function in the dynare folder is the one executing the decomposition. Since during the estimation, the derivative matrix is very sparse and the estimating parameters only affect a small region of the matrix, I am wondering whether there will be some tricks to avoid the repetitive computation.

Many thanks!

Best,
Xing

Dynare relies on mjdgges.mex* in the mex subfolders. @MichelJuillard Do you know whether there are tricks for the sparse case?

I don’t know of any implementation of QZ algorithm for sparse matrix. The alternative would be to use option dr=cycle_reduction that uses only matrix multiplication and solution of a linear system. Currently, it is only implemented for dense matrix but I would be interested in adding a sparse option. Xing, I would need your *.mod file to check the feasibility

Hi Michel,

Many thanks for your reply and help!

Since I am perturbating the policy and value functions of heterogeneous firms, most part of the solution is my self-written code. I tried to use Dyanre once: after I solve the derivative matrix fx, fxp, fy, fyp, I print the linearized model into a mod file and let dynare to solve it. But the system seems to big (there are around 2000 equations), and the preprocessing process takes forever. In the end, I did not really use Dynare for solving the model. But I still keep the .mod file. They are attached here. The DynareMain.mod is the main *.mod file.

I am very interested in the dimension reduction you just mentioned. Following the typical representation of the linearized system, A*[Xp;Yp]=B*[X;Y]+shocks, when I check A and B, they are both very sparse and I think this would be very common especially for the large system showing up in the heterogeneity agent model. If there would be an option handling these cases, it would be a great news for us!!

Many thanks!

Best,
Xing

Dear Xing,
I can’t find the file that you mention
Best

Michel