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
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
#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
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
#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)" |
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
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 |
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: +, -, ⋅, *, /, √, convert | |
export DoublelengthFloat | |
immutable DoublelengthFloat{T<:FloatingPoint} <: FloatingPoint | |
head :: T | |
tail :: T | |
end | |
DoublelengthFloat(x::FloatingPoint) = DoublelengthFloat(x, zero(x)) | |
convert{T<:FloatingPoint}(::Type{DoublelengthFloat{T}}, x::T) = DoublelengthFloat(x) |
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
.ipynb_checkpoints | |
*.ipynb | |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.