Skip to content

Instantly share code, notes, and snippets.

@una-dinosauria
Created February 26, 2016 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save una-dinosauria/96b0f4f58bc86a864141 to your computer and use it in GitHub Desktop.
Save una-dinosauria/96b0f4f58bc86a864141 to your computer and use it in GitHub Desktop.
findmin in julia
function fm()
n::Int32 = 1000000
h::Int32 = 256
trials::Int32 = 15*4
@time begin
matrix = rand(Float32, h,n)
mins = zeros( Int32, n )
end
min::Float32 = 0;
minidx::Int32 = 1;
@time begin
@inbounds for k = 1:trials
for i = 1:n
minidx = 1;
min = matrix[1, i]
for j = 2:h
if matrix[j, i] < min
min = matrix[j, i]
minidx = j
end
end
mins[i] = minidx
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment