Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
aac7f18
ci: Update CI workflow triggers to include PR and workflow_dispatch
sdd Dec 7, 2025
46b0c56
style: remove unnecessary parentheses
sdd Dec 7, 2025
809d457
ci: permit coverage to run for PRs as well
sdd Dec 7, 2025
ed3b7d7
deps: remove doc-comment dependency and use doc attribute that was ad…
jqnatividad Oct 24, 2025
18c8bb3
chore: use `doc` attribute instead of `doc_comment!`
jqnatividad Oct 24, 2025
ac0878c
fix: correct slice access in remainder processing and remove unsafe
MarkusZoppelt Nov 19, 2025
c691564
test: add regression test for remainder slice access bug
MarkusZoppelt Nov 19, 2025
b4a40ce
style: fix formatting
sdd Dec 7, 2025
6c5bcbf
fix: use try_from() with error for leaf_items.len()
MarkusZoppelt Nov 20, 2025
f3f2ec3
chore(deps): update actions/checkout action to v6
renovate[bot] Dec 7, 2025
5e3ee0f
chore(deps): update codspeedhq/action action to v4
renovate[bot] Dec 7, 2025
695c97c
chore(deps): update ad-m/github-push-action action to v1
renovate[bot] Dec 7, 2025
9a1e218
chore(deps): update rust crate rstest to 0.26
renovate[bot] Dec 7, 2025
db1fbe9
chore(deps): update rust crate codspeed-criterion-compat to v4
renovate[bot] Dec 7, 2025
aa7b565
ci: fix release-plz and add commitlint
sdd Dec 7, 2025
6c2940b
Added WithinUnsortedIterOwned
KvA2KLvA5T Jun 9, 2025
ba36d8d
fix: update to use transform function
sdd Jun 29, 2025
7b88de8
refactor: remove within_unsorted_iter_owned in favour of modifying wi…
sdd Jun 29, 2025
6e1afdd
docs: update Cargo.toml, changelog and docs for 5.2.3
sdd Dec 8, 2025
e746edf
deps: bump cmov to 0.4 as all other versions were yanked
jqnatividad Dec 28, 2025
bc89bc5
docs: update changelog, readme, and Cargo.toml for 5.2.4 release
sdd Jan 1, 2026
f87b965
chore: update changelog
github-actions[bot] Jun 29, 2025
47db176
test: Add coverage for Manhattan and Squared Euclidean distance metrics
cbueth Feb 5, 2026
8178908
feat: Add Chebyshev distance metric and test coverage
cbueth Feb 5, 2026
57dff79
test: add integration tests for Chebyshev, Manhattan, and Squared Euc…
cbueth Feb 7, 2026
b1fe052
inclusive radius matching and leaf note remainder loops
cbueth Feb 7, 2026
4a59cb8
fix over-pruning for L_inf
cbueth Feb 7, 2026
28859a9
Add `D::accumulate` and `D::IS_MAX_BASED`
cbueth Feb 7, 2026
c8dcb3e
feat: add fixed Chebyshev distance metric
cbueth Feb 7, 2026
3f32f6b
refactor: in-loop accumulation for max-based metrics
cbueth Feb 7, 2026
93b98c1
unify distance accumulation logic with `D::accumulate`
cbueth Feb 7, 2026
c934656
remove `D::IS_MAX_BASED`, unify heap logic, improve `DistanceMetric` …
cbueth Feb 7, 2026
fa3361f
change test comment & lint
cbueth Feb 7, 2026
7ebb80b
refactor: make metric property tests reusable
cbueth Feb 7, 2026
44a0f1e
chore: add default implementation of `accumulate` to `DistanceMetric`…
cbueth Feb 12, 2026
7adffe8
chore: saturating add for fixed metrics
cbueth Feb 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .commitlintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extends:
- "@commitlint/config-conventional"

30 changes: 22 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: CI

on: [push]
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -10,12 +15,21 @@ env:
LATEST_STABLE_RUST_VERSION: "TBD"

jobs:
commitlint:
name: Commit Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: wagoid/commitlint-github-action@v6
with:
configFile: .commitlintrc.yaml

format:
name: Formatting
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
show-progress: false

Expand Down Expand Up @@ -44,7 +58,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
show-progress: false

Expand Down Expand Up @@ -80,7 +94,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
show-progress: false

Expand Down Expand Up @@ -115,7 +129,7 @@ jobs:
name: Cargo Check (Stable)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
show-progress: false

Expand Down Expand Up @@ -149,7 +163,7 @@ jobs:
name: Cargo Check (Nightly)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
show-progress: false

Expand Down Expand Up @@ -185,7 +199,7 @@ jobs:
name: Run Tests (Stable, no crate features enabled that require unstable Rust)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
show-progress: false

Expand Down Expand Up @@ -218,7 +232,7 @@ jobs:
name: Run Tests (Nightly, all features enabled)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
show-progress: false

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
show-progress: false

Expand All @@ -27,7 +27,7 @@ jobs:
run: cargo codspeed build

- name: Run the benchmarks
uses: CodSpeedHQ/action@v3
uses: CodSpeedHQ/action@v4
with:
run: cargo codspeed run
token: ${{ secrets.CODSPEED_TOKEN }}
9 changes: 7 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Coverage

on: [push]
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
Expand All @@ -10,7 +15,7 @@ jobs:
name: Test Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
show-progress: false

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pre-release-string-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Pre Release String Updater
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
show-progress: false

Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
git commit -a -m "chore: update version references"

- name: Push changes
uses: ad-m/github-push-action@v0.8.0
uses: ad-m/github-push-action@v1.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
3 changes: 2 additions & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ jobs:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
show-progress: false
fetch-depth: 0

- name: Get date
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: ${{ github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
show-progress: false

Expand Down
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,66 @@
# Kiddo Changelog

## Unreleased

I've kept back these changes for now as, whilst extremely welcome, the change to the return type of `size()` would be breaking.
I'm hoping to have v6 available soon, which will include both these changes as well as addressing quite a few other long-running feature requests.

### ✨ Features

- Improve the flexibility of T type, KdTree.size. Add generate nearest_one_point (https://github.com/sdd/kiddo/pull/214, @pjkundert)
- Fix broken test of custom struct as T. Add test for `()` as T (https://github.com/sdd/kiddo/pull/243 @pjkundert)

## [5.2.4] - 2026-01-01 (Happy New Year! 🎉)

### Deps

- update cmov dep from 0.3 to 0.4 after 0.3 got yanked (see https://github.com/RustCrypto/utils/issues/1304). Thanks @yuby and @jqnatividad

## [5.2.3] - 2025-12-08

### 🐛 Bug Fixes

- Correct slice access in remainder processing and remove unsafe (@MarkusZoppelt)
- Use `try_from()` with error for `leaf_items.len()` (@MarkusZoppelt)

### ♻️ Refactor

- within_unsorted_iter no longer uses a generator (@KvA2KLvAST)
- Remove needless SubAssign trait bound from Content trait

### Deps

- Remove doc-comment dependency and use doc attribute that was added in Rust 1.54 instead (@jqnatividad)
- Use `doc` attribute instead of `doc_comment!` (@jqnatividad)
- Update actions/checkout action to v6
- Update codspeedhq/action action to v4
- Update ad-m/github-push-action action to v1
- Update rust crate rstest to 0.26
- Update rust crate codspeed-criterion-compat to v4

### Ci

- Update CI workflow triggers to include PR and workflow_dispatch
- Permit coverage to run for PRs as well
- Fix release-plz and add commitlint

### 💄 Styling

- Remove unnecessary parentheses
- Fix formatting
- Fix some lint issues

### 🧪 Testing

- Add regression test for remainder slice access bug (@MarkusZoppelt)

## [5.2.2] - 2025-06-30

### ♻️ Refactor

- refactor `within_unsorted_iter` to decouple the lifetime of the iterator from that of the query by
copying `query` once at the start of the call (@KvA2KLvAST)

## [5.2.1] - 2025-06-29

### 📝 Documentation
Expand Down
9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kiddo"
version = "5.2.1"
version = "5.2.4"
edition = "2021"
authors = ["Scott Donnelly <scott@donnel.ly>"]
description = "A high-performance, flexible, ergonomic k-d tree library. Ideal for geo- and astro- nearest-neighbour and k-nearest-neighbor queries"
Expand All @@ -27,16 +27,15 @@ opt-level = 3
aligned-vec = "0.6.1"
array-init = "2.1.0"
az = "1"
cmov = "0.3"
cmov = "0.4"
divrem = "1"
doc-comment = "0.3"
num-traits = "0.2"
ordered-float = "5"
sorted-vec = "0.8"

[dev-dependencies]
bincode = { version = "2", features = ["serde"] }
codspeed-criterion-compat = "2.10"
codspeed-criterion-compat = "4.0"
criterion = "0.6"
elapsed = "0.1.2"
flate2 = { version = "1", features = ["zlib-ng-compat"], default-features = false }
Expand All @@ -48,7 +47,7 @@ radians = "0.3"
rand = "0.9"
rand_distr = "0.5"
rayon = "1"
rstest = "0.25"
rstest = "0.26"
serde = { version = "1", features = ["derive", "rc"] }
serde_json = "1"
ubyte = "0.10"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Kiddo provides:
Add `kiddo` to `Cargo.toml`
```toml
[dependencies]
kiddo = "5.2.0"
kiddo = "5.2.4"
```

Add points to k-d tree and query nearest n points with distance function
Expand Down
2 changes: 1 addition & 1 deletion examples/cities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let dist = kilometres_to_unit_sphere_squared_euclidean(1000.0);
let best_3_iter = kdtree.best_n_within::<SquaredEuclidean>(&query, dist, 3);
let best_3 = best_3_iter
.map(|neighbour| (&cities[neighbour.item].name))
.map(|neighbour| &cities[neighbour.item].name)
.collect::<Vec<_>>();
println!("\nMost populous 3 cities within 1000km of 0N, 0W: {best_3:?}");

Expand Down
1 change: 1 addition & 0 deletions git-cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ commit_parsers = [
{ message = "^refactor", group = "♻️ Refactor"},
{ message = "^style", group = "💄 Styling"},
{ message = "^test", group = "🧪 Testing"},
{ message = "^chore", group = "🧹 Chore"},
]
protect_breaking_commits = true
tag_pattern = "v[0-9]\\.[0-9]\\.[0-9]"
Expand Down
7 changes: 1 addition & 6 deletions release-plz.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
[workspace]
allow_dirty = false
changelog_config = "git-cliff.toml" # use a custom git-cliff configuration
changelog_update = true # disable changelog updates
dependencies_update = true # update dependencies with `cargo update`
git_release_enable = true # disable GitHub/Gitea releases
pr_labels = ["release"] # add the `release` label to the release Pull Request
publish = true
publish_allow_dirty = false
semver_check = true # disable API breaking changes checks

8 changes: 4 additions & 4 deletions src/common/generate_best_n_within.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#[macro_export]
macro_rules! generate_best_n_within {
($leafnode:ident, $comments:tt) => {
doc_comment! {
concat!$comments,
#[doc = concat!$comments]
#[inline]
pub fn best_n_within<D>(
&self,
Expand Down Expand Up @@ -77,7 +76,7 @@ macro_rules! generate_best_n_within {
rd,
);

rd = Axis::rd_update(rd, D::dist1(new_off, old_off));
rd = D::accumulate(rd, D::dist1(new_off, old_off));

if rd <= radius {
off[split_dim] = new_off;
Expand Down Expand Up @@ -147,4 +146,5 @@ macro_rules! generate_best_n_within {
}
}
}
}}}
};
}
10 changes: 5 additions & 5 deletions src/common/generate_nearest_n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#[macro_export]
macro_rules! generate_nearest_n {
($comments:tt) => {
doc_comment! {
concat!$comments,
#[doc = concat!$comments]
#[inline]
pub fn nearest_n<D>(&self, query: &[A; K], qty: usize) -> Vec<NearestNeighbour<A, T>>
where
Expand Down Expand Up @@ -66,7 +65,7 @@ macro_rules! generate_nearest_n {
rd,
);

rd = Axis::rd_update(rd, D::dist1(new_off, old_off));
rd = D::accumulate(rd, D::dist1(new_off, old_off));

if Self::dist_belongs_in_heap(rd, results) {
off[split_dim] = new_off;
Expand Down Expand Up @@ -113,8 +112,9 @@ macro_rules! generate_nearest_n {
}
}

#[inline]
#[inline(always)]
fn dist_belongs_in_heap(dist: A, heap: &BinaryHeap<NearestNeighbour<A, T>>) -> bool {
heap.is_empty() || dist < heap.peek().unwrap().distance || heap.len() < heap.capacity()
}
}}}
};
}
Loading
Loading