
Distances
Distances.jl is a Julia package for calculating distance metrics between vectors, including pairwise and column-wise calculations.

About Distances
Distances.jl is a Julia package for evaluating distance metrics between vectors and other iterables of known size. It covers a broad set of metrics, including Euclidean, Cityblock, Chebyshev, Minkowski, Hamming, Jaccard, cosine, correlation, Mahalanobis, Hellinger, Haversine, Kullback-Leibler, Rényi and Jensen-Shannon, among others, and offers weighted variants for several of them.
Beyond single-vector comparison, the package provides colwise and pairwise routines for 2D arrays, which the project describes as often substantially faster than straightforward loop implementations. Results can be written into preallocated arrays using in-place variants, and distance type instances or convenience functions can be used for evaluation.
Key features
- Computes distances between two equal-length vectors or iterables
- Supports many metrics including Euclidean, cosine, Hamming, Jaccard and Mahalanobis
- Column-wise batch computation between corresponding matrix columns
- Pairwise distance matrices via dims=1 or dims=2
- In-place colwise! and pairwise! variants use preallocated output arrays
- Weighted versions offered for Euclidean, Cityblock, Minkowski and Hamming distances
- Batch colwise and pairwise functions are described as often substantially faster than straightforward loops
- Large selection of distance, divergence and dissimilarity measures in one package
- Functions accept arbitrary iterable objects of known size, not only plain arrays
- Covers vectors and 2D arrays; distances between tables with heterogeneous columns require the separate TableDistances.jl package
- Weighted variants are provided only for a subset of metrics, such as Euclidean, squared Euclidean, Cityblock, Minkowski and Hamming
Distances at a glance
- Category
- Development › Developer Tools
- Type
- Open-source project
- Pricing
- Not confirmed. Check the site
- Open source
- Not stated
- Language
- English
- Last checked
- Oct 6, 2026 · Online when checked
- Listed
- Oct 5, 2026
Guides for Developer Tools
Distances alternatives
Tools and sites you could use instead, ranked by how closely they match.
dtaidistance calculates time-series distances using a fast dynamic time warping implementation.
DataDeps.jl provides reproducible data setup for scientific work, with a Julia package for fetching and using data dependencies.
GLM.jl provides generalized linear models in Julia, with documentation and examples for the package.
TextAnalysis.jl is a Julia package for text and language data, with tools such as corpora, TF-IDF, and topic models.
GaussianMixtures.jl is a Julia package for working with Gaussian mixture models.
ReadStat.jl is a Julia package that parses data files from Stata, SAS, and SPSS into a ReadStatDataFrame.
Popular in Developer Tools
Well-known listings from the same topic.
Distances FAQ
What is the difference between colwise and pairwise computation?
Can distances be computed when observations are stored in rows?
Can results be written without allocating a new array?
Tell us and an editor will check it.
Claim the listing and suggest updates yourself. An editor checks every claim first.













