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
el = Float64 | |
types=(el, Vector{el}, Matrix{el}) | |
functions=Dict() | |
for mytype in types | |
functions[mytype]={} | |
for method in methodswith(mytype, true) | |
(length(method.sig) == 1) || #Unary functions | |
(length(method.sig) == 2 && method.va) || #Binary function with varargs | |
continue | |
method.func.code.name in functions[mytype] && continue #Don't duplicate |
Loading
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
#Working version | |
using JSON | |
auth_token= #fill in to access Github API | |
function getcontribs(owner, repo, auth_token) | |
#Download information about contributors | |
page, authors=0, {} | |
while true #Download every page | |
page += 1 | |
url="https://api.github.com/repos/$owner/$repo/contributors?page=$(page)&access_token=$(auth_token)" |
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
RawUnicodeData=readdlm(download("http://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt"), ';', String) | |
#UAX11 - http://www.unicode.org/reports/tr11/ | |
widthmap={ | |
"A "=>0, #ambiguous | |
"W "=>2, #wide | |
"F "=>2, #full | |
"N "=>0, #neutral | |
"Na "=>1, #narrow | |
"H "=>1, #half |
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
#Computes the dispatch ratio for each generic function defined in a module | |
#all: iterate over exported methods, or all methods? | |
function dispatchratio(M::Module=Base, all=false) | |
methodcount = Dict{Symbol, Int}() | |
for name in names(M, all) | |
try #name may not represent a function or function-able type | |
methodcount[name] = length(methods(eval(M, name))) | |
catch continue end | |
end | |
methodcount |
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: start, next, done | |
immutable Terminator #Stores information related to when the algorithm should terminate | |
maxiter :: Int | |
resabsthresh :: Real | |
resrelthresh :: Real | |
end | |
Terminator(maxiter::Integer) = Terminator(maxiter, eps(), eps()) | |
Terminator() = Terminator(0) #By default, always terminate. |
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
warning off; | |
function assert(bool) | |
if ~bool | |
error('Assertion failed') | |
end | |
endfunction | |
function timeit(name, func, varargin1) | |
lang = 'scilab'; |
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
using Images | |
using JSON | |
auth_token=#Put your auth_token here | |
download("https://api.github.com/repos/JuliaLang/julia/contributors?access_token=$(auth_token)", "julia_contribs.json") | |
authors=JSON.parse(open("julia_contribs.json")) | |
for (idx, author) in enumerate(authors) | |
authorname=author["login"] | |
gravatar_filename = string("avatar_", authorname, ".png") | |
download(author["avatar_url"], gravatar_filename) | |
theimage = Images.imread(gravatar_filename) |
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
/* Experimental typographically tinkered IJulia stylesheet | |
* Copyright © 2013 Jiahao Chen <[email protected]> | |
* MIT License | |
* | |
* To use, place in ~/.ipython/profile_julia/static/custom/custom.css | |
* and refresh IJulia | |
* | |
* Based on suggestions from practicaltypography.com | |
*/ |
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 bicgstabell(K::KrylovSubspace; tol::Real, l::Int=1) | |
k=-l | |
initrand!(K) | |
#XXX Choose r̃[0] | |
r[0]=b-nextvec(K) | |
u[-1]=0 | |
x[0]=K.v0 | |
ρ₀=1 | |
α=0 | |
ω=1 |