Skip to content

Instantly share code, notes, and snippets.

View joehuchette's full-sized avatar

Joey Huchette joehuchette

View GitHub Profile
@joehuchette
joehuchette / gist:527dab03c99621fb78ab
Created August 28, 2015 19:29
ntuple(+, Val{1:2})
Last login: Fri Aug 28 14:46:35 on ttys000
~❯ lldb ~/julia/julia
(lldb) target create "/Users/huchette/julia/julia"
Current executable set to '/Users/huchette/julia/julia' (x86_64).
(lldb) r
Process 86146 launched: '/Users/huchette/julia/julia' (x86_64)
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
@joehuchette
joehuchette / 15.083-setup.md
Last active August 29, 2015 13:56
Installation instructions for JuMP in 15.083

JuMP for 15.083

Follow the steps below to install Julia, JuMP, Gurobi, and IJulia for use in 15.083. If you encounter installation problems, contact huchette@mit.edu or mlubin@mit.edu.

Install Julia

Mac OS X

  1. We will use the v0.3.5 binaries provided on the Julia download page. If you are running OS-X Lion, Mountain Lion, or Mavericks, choose the 10.7+64-bit version. Snow Leopard users, the 10.6 64-bit version is for you.
  2. Once downloaded, open the .dmg disk image in Finder and then drag Julia-0.3.5.app to your Applications folder.
  3. Open the Terminal.app add the Julia executable to your path:
  • Run echo PATH=\$PATH:\"/Applications/Julia-0.3.5.app/Contents/Resources/julia/bin\" >> ~/.bash_profile.
@joehuchette
joehuchette / GC
Last active August 29, 2015 14:11
GC/JuMP benchmark
$ julia speed.jl [9:57:54]
WARNING: deprecated syntax "{}" at /Users/huchette/.julia/v0.4/Calculus/src/symbolic.jl:108.
Use "[]" instead.
WARNING: deprecated syntax "{}" at /Users/huchette/.julia/v0.4/Calculus/src/symbolic.jl:121.
Use "[]" instead.
WARNING: deprecated syntax "{a,b, ...}" at /Users/huchette/.julia/v0.4/Calculus/src/differentiate.jl:41.
Use "Any[a,b, ...]" instead.
julia> Pkg.test("JuMP")
INFO: Computing test dependencies for JuMP...
INFO: No packages to install, update or remove
INFO: Testing JuMP
[print] JuMPContainer{Variable}
- bound printing
- index set printing
- category printing
- issue testing
105 facts verified.
julia> Pkg.test("JuMP")
INFO: Computing test dependencies for JuMP...
INFO: No packages to install, update or remove
INFO: Testing JuMP
[print] JuMPContainer{Variable}
- bound printing
- index set printing
- category printing
- issue testing
105 facts verified.
@joehuchette
joehuchette / gist:fc42eaab6540eb06aa86
Last active August 29, 2015 14:25
Long array literal that leads to an OverflowError
r1 = Float64[0.8677740691514089,0.19604975646380596,0.3348926569217161,0.3248007339301342,0.5643351433984425,0.678129667722664,0.4382958323593511,0.3854819582516418,0.6703876916490539,0.939391398202607,0.6712565360771676,0.030151192492724244,0.9433798154469348,0.30018142410623705,0.8560554047624087,0.16807219392638206,0.6465861482771635,0.8735697386633838,0.44343341731848795,0.7130297016014373,0.6860530727546059,0.9708252757898115,0.9010508858286657,0.8679288956581972,0.7601477774306107,0.004149412294208732,0.5040316462905663,0.24514960432403554,0.13597046283854897,0.5300485431347912,0.887238808131132,0.4504538578240762,0.1275144080969075,0.9412766545758653,0.9413683668536381,0.39509809246641203,0.5221263955340283,0.8164161572521973,0.7043896772091331,0.899657747720227,0.08929487458119478,0.2879299685331045,0.11040818175046696,0.3554016155226434,0.42112417356261433,0.29349214888286435,0.9546694672789169,0.5073768257521505,0.23471863413312666,0.4850993646779316,0.5380609648360031,0.9115182420977661,0.638121941
@joehuchette
joehuchette / gist:8640589
Created January 26, 2014 22:57
Cryptic Julia error
ERROR: no method length(
in include_from_node1 at loading.jl:120fatal: error thrown and no exception handler available.
Base.MethodError(f=Base.Enumerate{I}, args=((<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?::<?
@joehuchette
joehuchette / gist:10396014
Created April 10, 2014 15:49
cddwrap.jl
using PyCall
@pyimport cdd
# returns extreme points of polyhedron Ax <= b
function extremepoints(A,b)
m = cdd.Matrix([b -A], number_type="fraction")
m[:rep_type] = 1 # we're providing H representation
p = cdd.Polyhedron(m)
EPs = p[:get_generators]()