This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# converts bit-float and hex-float strings to floating point numbers | |
# assumes round-to-nearest | |
import Base: significand_mask, significand_bits, exponent_bias, tryparse | |
for B in (2,16) | |
@eval function tryparse{T<:Float64}(::Type{T}, s::String, ::Type{Val{$B}}) | |
f_neg = false | |
r_ind = false # radix pt. indicator | |
r = 0 # no. of places after radix pt. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on https://github.com/tlycken/Interpolations.jl/pull/37 | |
Pkg.checkout("Interpolations", "master") | |
Pkg.checkout("Ratios", "checked") | |
using Interpolations, Grid | |
A = rand(300,300,30); | |
itp = interpolate!(copy(A), BSpline(Quadratic(Flat)), OnCell); | |
yi = InterpGrid(copy(A), BCreflect, InterpQuadratic); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type DataFrame{N,D} | |
data::D | |
end | |
immutable Field{s} | |
end | |
Field(s::Symbol) = Field{s}() | |
function DataFrame(;kwds...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("extras/distributions.jl") | |
require("slicesampler.jl") | |
import Distributions.* | |
macro buildslicesampler(model) | |
# pull apart the model into variables and distributions | |
variables = Dict{Symbol,Expr}() | |
unboundvars = Set{Symbol}() | |
for line in model.args |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract UTree{T} | |
immutable UTreeBranch{T} <: UTree{T} | |
left::UTree{T} | |
right::UTree{T} | |
end | |
immutable UTreeLeaf{T} <: UTree{T} | |
v::T | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Base: checked_add, checked_mul | |
function newparse{T}(::Type{T}, s, base=0) | |
0 <= base <= 62 || throw(ParseError("Invalid base")) | |
en = endof(s) | |
i = start(s) | |
done(s,i) && throw(ParseError("Invalid $T")) | |
c,i = next(s,i) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup(pkgname) | |
Pkg.cd() do | |
cd(pkgname) do | |
info("Generating ssh key") | |
run(`ssh-keygen -N "" -f .quickdocs_id_rsa`) | |
info("Encrypting private key") | |
run(`travis login --auto`) | |
run(`travis encrypt-file .quickdocs_id_rsa --add deploy`) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.