fortran/c version of HODLR