{"id":13671776,"url":"https://github.com/jackson211/LearnedSPatialHashMap","last_synced_at":"2025-04-27T18:31:42.027Z","repository":{"id":39800680,"uuid":"405603369","full_name":"jackson211/LearnedSPatialHashMap","owner":"jackson211","description":"Learned SPatial Hashmap","archived":false,"fork":false,"pushed_at":"2024-04-17T14:41:00.000Z","size":214,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T22:06:32.395Z","etag":null,"topics":["data-structures","hashmap","index","spatial"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jackson211.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-12T09:48:33.000Z","updated_at":"2025-03-27T13:52:19.000Z","dependencies_parsed_at":"2024-07-27T17:51:05.427Z","dependency_job_id":null,"html_url":"https://github.com/jackson211/LearnedSPatialHashMap","commit_stats":null,"previous_names":["jackson211/learnedspatialhashmap","jackson211/lsph"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackson211%2FLearnedSPatialHashMap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackson211%2FLearnedSPatialHashMap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackson211%2FLearnedSPatialHashMap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackson211%2FLearnedSPatialHashMap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackson211","download_url":"https://codeload.github.com/jackson211/LearnedSPatialHashMap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251187286,"owners_count":21549614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-structures","hashmap","index","spatial"],"created_at":"2024-08-02T09:01:18.395Z","updated_at":"2025-04-27T18:31:40.809Z","avatar_url":"https://github.com/jackson211.png","language":"Rust","readme":"# [LSPH](https://crates.io/crates/lsph) - Learned SPatial HashMap\n\n**fast 2d point query powered by hashmap and statistic model**\n\n![Github Workflow](https://github.com/jackson211/lsph/actions/workflows/rust.yml/badge.svg)\n[![crates.io version](https://img.shields.io/crates/v/lsph)](https://crates.io/crates/lsph)\n[![dos.io](https://img.shields.io/docsrs/lsph)](https://docs.rs/lsph)\n[![dependency status](https://deps.rs/repo/github/jackson211/lsph/status.svg)](https://deps.rs/repo/github/jackson211/lsph)\n\nThe original paper of LSPH can be found [here].\n\n[here]: https://minerva-access.unimelb.edu.au/items/beb5c0ee-2a8d-5bd2-b349-1190a335ef1a\n\nThe LSPH uses a learned model such as a linear regression model as the hash function to predict the index in a hashmap. As a result, the learned model is more fitted to the data that stored in the hashmap, and reduces the\nchance of hashing collisions. Moreover, if the learned model is monotonic function(e.g. linear regression), the hash indexes are increasing as the input data increases. This property can be used to create a sorted order\nof buckets in a hashmap, which allow us to do range searches in a hashmap.\n\nThe LSPH supports:\n\n- Point Query\n- Rectange Query\n- Radius Range Query\n- Nearest Neighbor Query\n\n## Example:\n\n```rust\nuse lsph::{LearnedHashMap, LinearModel};\nlet point_data = vec![[1., 1.], [2., 1.], [3., 2.], [4., 4.]];\nlet (mut map, points) = LearnedHashMap::\u003cLinearModel\u003cf32\u003e, f64\u003e::with_data(\u0026point_data).unwrap();\n\nassert_eq!(map.get(\u0026[1., 1.]).is_some(), true);\nassert_eq!(map.get(\u0026[3., 1.]).is_none(), true);\nassert_eq!(map.range_search(\u0026[0., 0.], \u0026[3., 3.]).is_some(), true);\nassert_eq!(map.radius_range(\u0026[2., 1.], 1.).is_some(), true);\nassert_eq!(map.nearest_neighbor(\u0026[2., 1.]).is_some(), true);\n```\n\n## To Run Benchmark:\n\n```bash\ncargo bench\n```\n\n# License\n\nLicensed under either of\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackson211%2FLearnedSPatialHashMap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackson211%2FLearnedSPatialHashMap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackson211%2FLearnedSPatialHashMap/lists"}