Skip to content

Fix find_medioid returning an element that fails the predicate - #448

Open
mihaic wants to merge 2 commits into
intel:mainfrom
mihaic:find-medioid-fix
Open

mihaic wants to merge 2 commits into
intel:mainfrom
mihaic:find-medioid-fix

Conversation

@mihaic

@mihaic mihaic commented Oct 22, 2026

Copy link
Copy Markdown
Member

When no element is closer to the medioid than the sentinel, utils::find_medioid now returns the first element that satisfies the predicate, or throws if none does, instead of returning element 0.

New "Find Medioid with Extreme Values" and "Dynamic Vamana Index Compact After Far-Away Point" tests fail without the fix and pass with it.

Future work: guard against calling consolidate or compact on an empty index.

When no element is closer to the medioid than the sentinel,
`utils::find_medioid` now returns the first element that satisfies the
predicate, or throws if none does, instead of returning element 0.

New "Find Medioid with Extreme Values" and "Dynamic Vamana
Index Compact After Far-Away Point" tests fail without the fix and pass
with it.

Future work: guard against calling `consolidate` or `compact` on an
empty index.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant