Code Monkey home page Code Monkey logo

distancehistograms.jl's Introduction

DistanceHistograms.jl

DistanceHistograms.jl is a lightweight package for optimised computation of pairwise and cross-correlated distance histograms. These summarise distance matrix distributions with constant memory and greater efficiency than compute-then-bin approaches. Inputs are collections of coordinates, given as Vector{SVector}; outputs are Vector{Int64}. All Distances.jl SemiMetrics are supported, with some specialised versions available. Binning is linear and 0->maximum style. This packaged is optimised for medium scale 2-point correlation function computation, and does not employ spatial tree techniques, though the kernels are suitable for this.

Compute an autocorrelation function with auto_corr, or a cross correlation function with cross_corr. Select a suitable maximal value by setting rmax, and the number of bins with nbins. metric may be set to any SemiMetric to modify the distance computation used. blocksize may be used to set the batch size for autocorrelation computation.

We can compute a distance histogram over any set of points,

# generate a set of points
julia> a = collect(CartesianIndices((100,100)));
# convert to SVectors
julia> b = reinterpret(SVector{length(axes(a)),Float64}, Float64.(vec(DistanceHistograms.as_ints(a))));
#computing a correlation function with 10 bins
julia> auto_corr(b,zeros(Int64, 10), 145, 10, metric=Euclidean())
10-element Vector{Int64}:
 2790126
 6994502
 9263358
 9780918
 8944602
 6970206
 3913838
 1113342
  212062
   12046

julia> cross_corr(b,b,zeros(Int64, 10), 145, 10, metric=Euclidean())
10-element Vector{Int64}:
  5590252
 13989004
 18526716
 19561836
 17889204
 13940412
  7827676
  2226684
   424124
    24092

distancehistograms.jl's People

Contributors

jagho avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.