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 standard housing macroeconomic models with DC-EGM algorithm. Useful note here, code available here.

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 or value functions with code 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)