This file contains hidden or 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
module GPRangeTst | |
import Base: colon, show | |
export autoscale, parse_gpr | |
immutable AutoScale | |
end | |
autoscale = AutoScale() |
This file contains hidden or 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
This file contains any messages produced by compilers while | |
running configure, to aid debugging if configure makes a mistake. | |
It was created by GLPK configure 4.52, which was | |
generated by GNU Autoconf 2.69. Invocation command line was | |
$ ./configure | |
## --------- ## | |
## Platform. ## |
This file contains hidden or 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
<Multi_key> <space> <a> : "α" U03B1 # GREEK SMALL LETTER ALPHA | |
<Multi_key> <a> <space> : "α" U03B1 # GREEK SMALL LETTER ALPHA | |
<Multi_key> <space> <b> : "β" U03B2 # GREEK SMALL LETTER BETA | |
<Multi_key> <b> <space> : "β" U03B2 # GREEK SMALL LETTER BETA | |
<Multi_key> <space> <c> : "ξ" U03BE # GREEK SMALL LETTER XI | |
<Multi_key> <c> <space> : "ξ" U03BE # GREEK SMALL LETTER XI | |
<Multi_key> <space> <d> : "δ" U03B4 # GREEK SMALL LETTER DELTA | |
<Multi_key> <d> <space> : "δ" U03B4 # GREEK SMALL LETTER DELTA | |
<Multi_key> <space> <e> : "ε" U03B5 # GREEK SMALL LETTER EPSILON | |
<Multi_key> <e> <space> : "ε" U03B5 # GREEK SMALL LETTER EPSILON |
This file contains hidden or 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: @ngenerate, @nloops, @nref, @ncall, @ntuple, @nif, @nexprs | |
import Base: start, done, next | |
# this generates types like this: | |
# immutable SubInd_3 <: SubInds{3} | |
# I_1::Int | |
# I_2::Int | |
# I_3::Int | |
# end | |
# they are used as iterator states |
This file contains hidden or 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
let broadcast_cache = Dict{Function,Dict{Int,Dict{Int,Function}}}() | |
global broadcast! | |
function broadcast!(f::Function, B, As::Union(Array,BitArray)...) | |
nd = ndims(B) | |
narrays = length(As) | |
idx_f = Base.ht_keyindex2(broadcast_cache, f) | |
if idx_f < 0 | |
idx_f = -idx_f | |
Base._setindex!(broadcast_cache, Dict{Int,Dict{Int,Function}}(), f, idx_f) |
This file contains hidden or 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
macro invoke(ex) | |
Meta.isexpr(ex, :call) || error("invoke macro syntax error") | |
isa(ex.args[1], Symbol) || error("invoke macro syntax error") | |
fname = ex.args[1] | |
types = [Meta.isexpr(a, :(::)) ? a.args[2] : Expr(:call, :typeof, a) for a in ex.args[2:end]] | |
args = [Meta.isexpr(a, :(::)) ? a.args[1] : a for a in ex.args[2:end]] | |
Expr(:call, :invoke, fname, Expr(:tuple, types...), args...) | |
end |
This file contains hidden or 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 GLPK # NOTE: it's better to use 'import' with GLPK, | |
# rather than 'using' | |
μ = [1/7, 2/7, 4/7] | |
ν = [1/4, 1/4, 1/2] | |
n = length(μ) | |
D = 1 .- eye(n) # NOTE: starting from julia v0.3, you won't be | |
# allowed to use '-' here, you need to | |
# use '.-' |
This file contains hidden or 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 Base.rsearch(str::Union(ByteString,SubString), re::Regex, idx::Integer = endof(str)) | |
sidx = 1 | |
lastr = 0:-1 | |
while sidx <= endof(str) | |
r = search(str, re, sidx) | |
isempty(r) && return lastr | |
last(r) > last(lastr) && (lastr = r) | |
sidx = nextind(str, first(r)) | |
end | |
return lastr |
This file contains hidden or 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
module SlowRemoteExecution | |
type W | |
J::Vector{BitVector} | |
W(N::Int, K::Int) = new([randbool(N) for k=1:K]) | |
end | |
function inner(ws::Vector{W}, X::Vector{BitVector}) | |
r = 0 | |
@time begin |
This file contains hidden or 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 bench() | |
b = bitrand(500, 500, 300) | |
i = bitrand(500, 500, 300) | |
t = vec(bitrand(sum(i))) | |
c = bitunpack(b) | |
j = bitunpack(i) | |
y = bitunpack(t) | |
println("logical getindex A[I]") |