On this page you can find computer codes from my papers and some snippets of code for dealing with well-known problems for which I struggled to find existing code with reasonable licensing terms; e.g. see this page for a discussion of problems with the Numerical Recipes's license terms.
  1. Fortran 90 code for my paper. "A Generalized Endogenous Grid Method for Non-Smooth and Non-Concave Problems", forthcoming The Review of Economic Dynamics, 2013.
  2. Fortran 90 module to find the zero of a function using either the simple Newton method or a hybrid Newton-bisection method. The Newton solver switches to the hybrid solver if it does not locate a zero within a given number of iterations.
  3. Fortran 90 module to sort a real array using the Quicksort method and provide the corresponding permutation of the array index. It adapts Walt Brainerd's code to compute the permuted index array.
  4. Fortran 90 module to find the index of the right interpolating node for each data point in an ordered array. It speeds up computation by exploiting the ordering of both the array of interpolating nodes and of the array of data points. It contains the subroutine sub_int_node for standard interpolation and the subroutine sub_integm_node for applying Carroll's (2006) Method of Endogenous Gridpoints with an occasionally-binding borrowing constraint. sub_integm_node returns index 0 to flag data points for which the borrowing constraint is binding and the solution can be computed analytically.