FastHistograms.jl

Fast, minimal histogram algorithms.
Author Octogonapus
Popularity
1 Star
Updated Last
2 Years Ago
Started In
March 2021

FastHistograms

Stable Dev Build Status Coverage Code Style: Blue

FastHistograms declares and implements a minimal histogram interface with a focus on speed. This package does not aim to implement general histogram algorithms that work for a wide array of data types; for that purpose, consider StatsBase.

Currently, the only implemented algorithm is for fixed-width bins on (small) 2D data.

Example

using FastHistograms, Random

julia> h = SingleThreadFixedWidth2DHistogram()

julia> img1 = zeros(10, 10)
julia> img1[:, 6:end] .= 0xff

julia> img2 = zeros(10, 10)
julia> img2[6:end, :] .= 0xff

# Compute the histogram bin counts
julia> calc_hist!(h, img1, img2)

julia> @show counts(h) # Get the bin counts

16×16 Matrix{Int64}:
 25  0  0  0  0  0  0  0  0  0  0  0  0  0  0  25
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0   0
 25  0  0  0  0  0  0  0  0  0  0  0  0  0  0  25

Benchmarks

With two 40x80 8-bit images and 16 bins per dimension, FastHistograms runs in 12 μs and StatsBase runs in 194 μs.

Required Packages

No packages found.