Skip to content

Commit

Permalink
Add another binning [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
roflmaostc committed Nov 16, 2021
1 parent 63dfbc2 commit 9997d2f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions examples/benchmarks/bin.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
using BenchmarkTools, MicroscopyTools

function bin_3(arr::AbstractArray{T, N}, factors=ntuple(x -> 2, Val(N))) where {T, N}
# old size
sz = size(arr)
# new size
sn = sz factors
s2 = ntuple(i -> isodd(i) ? factors[(i+1)/2] : sn[i/2], Val(2 * N))

dims = ntuple(i -> 2 * i - 1, Val(N))
reshape(sum(reshape(arr,s2),dims=dims),sn)
end


function f(x)
@info "Random data with size $(size(x))"
print("Tullio: ")
@btime bin2($x)
print("CartesianIndices: ")
@btime bin($x, (2,2))
print("RH: ")
@btime bin_3($x, (2,2))
end

function main()
Expand Down

2 comments on commit 9997d2f

@roflmaostc
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/49281

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" 9997d2fdf9855325a32f3d69d1d482060aa31c77
git push origin v0.1.0

Please sign in to comment.