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
typealias MyTuple (ASCIIString, BitsKind) | |
type MyType | |
some_field::Int | |
function MyType(vec::Vector{MyTuple}) | |
println("INNER") | |
new(0) | |
end | |
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
# Annotated version | |
function calc{T<:Float}(X::Matrix{T}, N...) # change the name of the second argument -> the bug goes away | |
# (type of second argument doesn't matter) | |
# we might even use a single argument N::Matrix{T} | |
# it doesn't matter what's left of the T, it might be | |
# T<:Float64 or T<:Any or even just T | |
#function calc(X::Matrix{Float64}, N::Int) # use this form -> the bug goes away | |
# except where noted |
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
julia> a(i) = a(i::x->1) | |
(type-error car cons ()) | |
unexpected error: #0 (goto-form/lambda/lambda | |
#0=#fn("7000r1|i10Ko102i11awo11;" [] #1=[#0# | |
#2=#fn("8000r0i12ai12wo122;" [] #1# make-label) | |
#3=#fn("8000r1~c0|L241;" [label] #1# mark-label) | |
#4=#fn("7000r0i10F16G02i10MF16=02e0i1031c1<680i10M\x84;c2q\x7f3041;" [caar | |
label #fn("7000r1i02|312|;" [])] #1# make&mark-label) | |
#5=#fn("7000r3|F@17702|c0>6>0|C670~|41;^;c1q|M41;" [(null) | |
#fn(":000r1|c0=6=0i10e1~3141;|c2=6L0c3qe4e5~\x84i023217502c63141;|c7=6^0c8qc9e1~\x8431c:L3c;c:L2e<~31F16<02e<~31Mc=<43;|c>=6<0e?c@q~N42;|cA=6B0cBqi1330i113042;|cC=6=0cDqi113041;|cE=6?0cFqcG~\x84\x7f3241;|c==6Y0eHi23`326A0i10cIi23L231530]2i10e1~3141;|cJ=6B0cKqi1130i113042;|cL=640^;i10e1~3141;" [call |
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-error car cons ()) | |
unexpected error: #0 (caddr ((call dlsym _jl_libglpk ($ f)) | |
($ (... args)))) | |
#1 (parse-resword/lambda/lambda/lambda/lambda/lambda/lambda | |
((call dlsym _jl_libglpk ($ f)) | |
($ (... args)))) | |
#2 (parse-resword/lambda/lambda/lambda | |
#fn("6000r0~k02\x7fk12i02k2;" [ops-by-prec range-colon-enabled space-sensitive] [[(= | |
:= += -= *= /= //= .//= .*= ./= |\\=| |.\\=| ^= .^= %= |\|=| &= $= => <<= >>= | |
>>>=) (?) (|\|\||) (&&) (<- -- -->) (> < >= <= == != .> .< .>= .<= .== .!= .= |
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 reallygreedylinecounter(fname::String) | |
f = open(fname) | |
return reallygreedylinecounter(f) | |
end | |
function reallygreedylinecounter(f::IOStream) | |
try | |
seek(f, 0) | |
end | |
ln = 0 | |
eof = int(typemax(Uint32)) #argh |
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
100x100 matrices, averages over 250000 tests: | |
A'*A gemm : 0.00022529661750793456 ± 1.3165374929527648e-6 | |
A'*A syrk : 0.0004116961793899536 ± 2.2544687273938097e-6 | |
A*A' gemm : 0.00020168535614013673 ± 9.12395962546235e-7 | |
A*A' syrk : 0.0004128545732498169 ± 2.236023626830784e-6 | |
200x200 matrices, averages over 31250 tests: | |
A'*A gemm : 0.0016472916564941407 ± 1.1819936441612635e-5 | |
A'*A syrk : 0.0019588019256591795 ± 1.173932771520073e-5 | |
A*A' gemm : 0.0012420702819824219 ± 2.3948308461046164e-6 |
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
typealias MatOrNothing{T} Union(AbstractMatrix{T}, Vector{None}, Nothing) | |
my_func{T}(A::MatOrNothing{T}) = println("my_func ok") | |
M = [1. 2. ; 3. 4.] | |
my_func(M) # works | |
my_func([]) # works | |
my_func(nothing) # fails |
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
julia> load("flatten1d.jl") | |
julia> a = [[randi(3) for k=1:3] for i=1:3, j=1:2] | |
3x2 Array{Int64,1} Array: | |
[3, 1, 2] [1, 3, 3] | |
[1, 1, 3] [2, 3, 3] | |
[3, 1, 3] [3, 2, 2] | |
julia> flatten1d(a) | |
18-element Int64 Array: |
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
load("fft_powers.jl") | |
@assert fft_powers_approx([2,3,5], 37) == 40 | |
@assert nextprod([2,3,5], 37) == 40 | |
function bench_nextprod(ps, x) | |
tm = 1000 | |
t = Array(Float64, tm) | |
for i = 1:tm | |
t[i] = @elapsed nextprod(ps, x) | |
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
require("textwrap.jl") | |
import TextWrap.* | |
import OptionsMod.* | |
text = "Julia is a high-level, high-performance dynamic programming language for technical computing, with syntax that is familiar to users of other technical computing environments. It provides a sophisticated compiler, distributed parallel execution, numerical accuracy, and an extensive mathematical function library." | |
println("DEFAULT OPTIONS") | |
println("-"^70) | |
println_wrapped(text) |
OlderNewer