Skip to content

Instantly share code, notes, and snippets.

View sadatnfs's full-sized avatar

Nafis Sadat sadatnfs

  • Microsoft
  • Seattle, WA
View GitHub Profile
@sadatnfs
sadatnfs / SS_breaker.r
Created July 10, 2018 01:06
SuiteSparse limit breaker
## this script can be used to run really large models easily in order to test limits in SuiteSparse, Matrix, TMB, and INLA
## it loads simulated data created over all africa and all years
#############################################
## setup the environment for singularity R ##
#############################################
## Set core_repo location and tmb_repo loc
core_repo <- sprintf('/share/code/geospatial/lbd_core/')
tmb_repo <- sprintf('/home/j/temp/azimmer/suitesparse_overloader')
@sadatnfs
sadatnfs / cholmod_super_symbolic.c
Last active July 10, 2018 17:23
cholmod_super_symbolic.c
/* ========================================================================== */
/* === Supernodal/cholmod_super_symbolic ==================================== */
/* ========================================================================== */
/* -----------------------------------------------------------------------------
* CHOLMOD/Supernodal Module. Copyright (C) 2005-2006, Timothy A. Davis
* The CHOLMOD/Supernodal Module is licensed under Version 2.0 of the GNU
* General Public License. See gpl.txt for a text of the license.
* CHOLMOD is also available under other licenses; contact authors for details.
* http://www.suitesparse.com
@sadatnfs
sadatnfs / cholmod_super_numeric.c
Last active July 10, 2018 17:22
cholmod_super_numeric file with higher malloc thresh
/* ========================================================================== */
/* === Supernodal/cholmod_super_numeric ===================================== */
/* ========================================================================== */
/* -----------------------------------------------------------------------------
* CHOLMOD/Supernodal Module. Copyright (C) 2005-2006, Timothy A. Davis
* The CHOLMOD/Supernodal Module is licensed under Version 2.0 of the GNU
* General Public License. See gpl.txt for a text of the license.
* CHOLMOD is also available under other licenses; contact authors for details.
* http://www.suitesparse.com
@sadatnfs
sadatnfs / SuiteSparse_config.mk
Last active July 18, 2018 16:38
Custom SuiteSparse config file for TMB builds
#===============================================================================
# SuiteSparse_config.mk: common configuration file for the SuiteSparse
#===============================================================================
# This file contains all configuration settings for all packages authored or
# co-authored by Tim Davis:
#
# Package Version Description
# ------- ------- -----------
# AMD 1.2 or later approximate minimum degree ordering
@sadatnfs
sadatnfs / simulating_random_walks.ipynb
Created June 23, 2018 19:24
Simulating IID and Correlated Random Walks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sadatnfs
sadatnfs / Makefile
Last active June 19, 2018 15:54
INLA Travis-CI test
## Makefile for downloading the source code and building
## a binary package of R-INLA
##
## Run 'make' with no arguments for usage instructions
##
## This Makefile has been tested under Ubuntu 17.10
##
## Requirements:
## mercurial
## A full gcc/g++/gfortran installation
@sadatnfs
sadatnfs / GPR_mods.cpp
Created June 14, 2018 16:10
1-D Gaussian Process Regression using various different methods in TMB
#include <TMB.hpp>
#include <Eigen/Sparse>
#include <vector>
using namespace density;
using Eigen::SparseMatrix;
// helper function to make sparse SPDE precision matrix
// Inputs:
// logkappa: log(kappa) parameter value
// logtau: log(tau) parameter value
@sadatnfs
sadatnfs / AFModel.cpp
Created June 14, 2018 16:09
Automated Forecasting Model TMB Template
////////////////////////////////////////////////////////////////
// Author: Nafis Sadat
// Purpose: Forecasting model base across countries, incorporating ARIMA components
// Created: Sometime in 2017
////////////////////////////////////////////////////////////////
#include <TMB.hpp>
#include <Eigen/Sparse>
#include <vector>
@sadatnfs
sadatnfs / xarray_to_r.r
Last active January 6, 2023 10:49
Extracting an xarray based netcdf file to use in R
require(ncdf4)
require(ncdf4.helpers)
require(data.table)
## Get the name of the value vars in the nc file
get_nc_value_name <- function(nc_file) {
## Get names
nc_obj <- nc_open(nc_file)
name<-names(nc_obj$var)
@sadatnfs
sadatnfs / Makefile
Last active May 13, 2018 21:45
Makefile for building INLA in Debian:Buster
## Makefile for downloading the source code and building
## a binary package of R-INLA on Debian/Buster
## using a custom version of R and Intel MKL
## Intended for use by : Institute for Health Metrics and Evaulation
##
## Maintained by : Nafis Sadat, [email protected]
##
## Run 'make' with no arguments for usage instructions
##
## This Makefile has been tested under Debian GNU/Linux