Skip to content

Instantly share code, notes, and snippets.

using Base.LinAlg: BlasChar, BlasInt, blas_int, chkstride1, chksquare
using Base: blasfunc
using Base.LinAlg.LAPACK: liblapack, @lapackerror
A = [1. 2 3
4 5 6
7 8 9]
B = diagm(randn(3))
args = ('V', 'V', copy(A), copy(B))
##### Install a lot of stuff first #####
$sudo apt-get update
##install python
$ wget http://09c8d0b2229f813c1b93-c95ac804525aac4b6dba79b00b39d1d3.r79.cf1.rackcdn.com/Anaconda-2.0.1-Linux-x86_64.sh
$ sudo bash anaconda........sh
##install necessary libs
$ sudo apt-get install -y python-matplotlib python-tornado ipython ipython-notebook python-setuptools python-pip
#Set up data partition
sudo mkdir /data
sudo chmod 777 /data
sudo "echo /dev/xvdb /data ext4 rw,user,exec,comment=cloudconfig 0 2 >> /etc/fstab"
sudo mount /data
#Install build environment
sudo sed -i "s/enabled=0/enabled=1" /etc/yum.repos.d/epel.epo
sudo yum -y update
sudo yum -y upgrade
@sglyon
sglyon / QuantMacro.jl
Last active August 29, 2015 14:15
quantmacro design
# file: QuantMacro.jl
module QuantMacro
export Models #, other tools
include("models.jl")
end # module
@sglyon
sglyon / threaded_data.py
Created February 23, 2015 15:49
Threaded google or yahoo finance data
#!/usr/bin/env python
import os
import urllib
from threading import Thread
from Queue import Queue
import pandas as pd
def hist_data_threaded(syms, max_threads=100, source='yahoo',
start='1/1/2010', end='12/31/2013'):
@sglyon
sglyon / Hessians
Created March 23, 2015 18:05
Testing 3 ways of computing Hessian in Julia: analytically, ForwardDiff.jl, ReverseDiffSource.jl
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
@sglyon
sglyon / comments.md
Last active August 29, 2015 14:20
osx vs linux performance

Notice that when running it on a Linux VM on OSX I get about a 4x speedup relative to running it natively on OSX.

Also notice from the profile that the Linux version spends about 90% of its time in the myexp call and only about 3% in the line @inbounds d_i2_j += ((points[k, i] - data[k, j])^2). (I know these aren't actually times, but rather times when the profiler registered that line. But it gives an approximation to time spent).

The OSX version spends about 57% of its time (so about 5.3 seconds on average) in myexp and about 33% of its time (about 3 seconds on average) in the line @inbounds d_i2_j += ((points[k, i] - data[k, j])^2).

I can't explain why, on the same hardware, the OSX version is so much slower here.

@sglyon
sglyon / exploration.ipynb
Created May 26, 2015 00:56
Exploring revolutionary war continental loan loan data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sglyon
sglyon / ode_event_solver.jl
Last active August 29, 2015 14:23
events using ODE.jl
using Roots
using ODE
@doc doc"""
ode_events{TY}(f::Function, y0::TY, tspan, odeint::Function; kwargs...)
### Arguments
* `f`: function such that dy/dt = f(t, y)
* `y0`: initial condition for y
@sglyon
sglyon / website_charts.ipynb
Created August 13, 2015 03:15
interactive returns
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.