Below some useful references and algorithms to better code in C,Fortran and MatLab. In discrete time, Fortran and C++ are quicker than any other language. MatLab is very powerful in continuous time, especially when using sparse matrices.


C++ (discrete time)

Solve the Aiyagari model in 0.04 – 0.14 seconds with Endogenous Grid Method (EGM) (Caroll (2006)). Useful note (by Josep Pijoan-Mas) is available here. Download my code (iterate on marginal utilities here or value functions here).

Solve the stochastic growth model as in Barillas & Villaverde (2007) using EGM, code here.

Discretize income process using Tauchen algorithm in C++: code here (by Sumudu Kankanamge)


MatLab (continuous time)

Solve Aiyagari in 0.13 seconds with Envelope Condition Method (ECM), many codes available here: HATC project

Aiyagari in Continous Time with Jump-Drift Process. Code is available here: aiyagari.m

Heterogenous Agent New Keynesian (HANK) model and the code available here: (not yet available)


Useful references:

Useful libraries in C and Fortran: Jean Pierre Moreau’s Homepage

Matlab codes in continuous time: Benjamin Moll’s Homepage

Stachurski and Sargent’s Homepage


« Dynamic General Equilibrium Modelling, Computational Methods and Applications », by Burkhard Heer and Alfred Maußner