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
diff -r CBModules/ga/cbga.c CBModules.orig/ga/cbga.c | |
42c42 | |
< #define MaxGenerations 1000 | |
--- | |
> #define MaxGenerations 100 | |
154,155c154 | |
< long watch, | |
< double errorscale) | |
--- | |
> long watch) |
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
module Tst | |
using JLD | |
GC.gc() | |
Aarray = Vector{Float64}[[1.2,3.4],[1.1]] | |
str = "abc" | |
stringsA = ["x","y","z"] | |
strings16 = convert(Vector{JLD.UTF16String}, stringsA) | |
bigdata = [1:10000;] |
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
module BitBug | |
function copy_to_bitarray_chunks_simplified!(Bc::Vector{UInt64}, C::Array{Bool}, numbits::Int) | |
ld1 = numbits - 1 | |
u = Base._msk64 | |
msk_d1 = (u << (ld1+1)) | |
ind = 1 | |
@show C |
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
abstractvector getindex A[I] | |
--------------------- | |
A::BitArray I::Vector{Int} | |
elapsed time: 0.271078954 seconds (4 MB allocated) | |
A::Array{Bool} I::Vector{Int} | |
elapsed time: 0.096585028 seconds (35 MB allocated) | |
A::Array{Float64} I::Vector{Int} | |
elapsed time: 0.267021423 seconds (286 MB allocated) | |
abstractvector setindex! A[I]=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
module PartSort | |
using Base.Order | |
import Base: sort!, Sort.Algorithm | |
export PartialQuickSort | |
immutable PartialQuickSort <: Algorithm | |
k::Int |
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
module NV | |
immutable NullableVector{T} | |
isnull::BitVector | |
values::Vector{T} | |
end | |
@inline Base.length(nv::NullableVector) = length(nv.isnull) | |
@inline function Base.getindex(nv::NullableVector{Float64}, i::Integer) |
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 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]") |
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
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 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 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 '.-' |
NewerOlder