{"id":25409608,"url":"https://github.com/habedi/vq","last_synced_at":"2025-07-04T01:04:54.222Z","repository":{"id":277302842,"uuid":"930463398","full_name":"habedi/vq","owner":"habedi","description":"A vector quantization library for Rust :crab:","archived":false,"fork":false,"pushed_at":"2025-04-03T22:52:52.000Z","size":891,"stargazers_count":13,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-16T16:23:38.502Z","etag":null,"topics":["algorithms","clustering","data-compression","machine-learning","nearest-neighbor-search","rust-lang","rust-library","similarity-search","vector-quantization","vector-search"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/habedi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2025-02-10T17:13:44.000Z","updated_at":"2025-05-29T14:43:44.000Z","dependencies_parsed_at":"2025-03-11T12:20:40.152Z","dependency_job_id":"b8be1410-0643-4326-a9f6-ab790104a773","html_url":"https://github.com/habedi/vq","commit_stats":null,"previous_names":["habedi/vq"],"tags_count":5,"template":false,"template_full_name":"habedi/template-rust-project","purl":"pkg:github/habedi/vq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habedi%2Fvq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habedi%2Fvq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habedi%2Fvq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habedi%2Fvq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/habedi","download_url":"https://codeload.github.com/habedi/vq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habedi%2Fvq/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263427306,"owners_count":23464842,"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":["algorithms","clustering","data-compression","machine-learning","nearest-neighbor-search","rust-lang","rust-library","similarity-search","vector-quantization","vector-search"],"created_at":"2025-02-16T09:21:09.757Z","updated_at":"2025-07-04T01:04:54.190Z","avatar_url":"https://github.com/habedi.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Vq\n\n[\u003cimg alt=\"tests\" src=\"https://img.shields.io/github/actions/workflow/status/habedi/vq/tests.yml?label=tests\u0026style=flat\u0026labelColor=555555\u0026logo=github\" height=\"20\"\u003e](https://github.com/habedi/vq/actions/workflows/tests.yml)\n[\u003cimg alt=\"lints\" src=\"https://img.shields.io/github/actions/workflow/status/habedi/vq/lints.yml?label=lints\u0026style=flat\u0026labelColor=555555\u0026logo=github\" height=\"20\"\u003e](https://github.com/habedi/vq/actions/workflows/lints.yml)\n[\u003cimg alt=\"code coverage\" src=\"https://img.shields.io/codecov/c/github/habedi/vq?style=flat\u0026labelColor=555555\u0026logo=codecov\" height=\"20\"\u003e](https://codecov.io/gh/habedi/vq)\n[\u003cimg alt=\"codefactor\" src=\"https://img.shields.io/codefactor/grade/github/habedi/vq?style=flat\u0026labelColor=555555\u0026logo=codefactor\" height=\"20\"\u003e](https://www.codefactor.io/repository/github/habedi/vq)\n[\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/vq.svg?label=crates.io\u0026style=flat\u0026color=fc8d62\u0026logo=rust\" height=\"20\"\u003e](https://crates.io/crates/vq)\n[\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-vq-66c2a5?label=docs.rs\u0026style=flat\u0026labelColor=555555\u0026logo=docs.rs\" height=\"20\"\u003e](https://docs.rs/vq)\n[\u003cimg alt=\"downloads\" src=\"https://img.shields.io/crates/d/vq?label=downloads\u0026style=flat\u0026labelColor=555555\u0026logo=rust\" height=\"20\"\u003e](https://crates.io/crates/vq)\n[\u003cimg alt=\"msrv\" src=\"https://img.shields.io/badge/msrv-1.83.0-orange?label=msrv\u0026style=flat\u0026labelColor=555555\u0026logo=rust\" height=\"20\"\u003e](https://github.com/rust-lang/rust/releases/tag/1.83.0)\n[\u003cimg alt=\"dependencies\" src=\"https://deps.rs/repo/github/habedi/vq/status.svg\"\u003e](https://deps.rs/repo/github/habedi/vq)\n[\u003cimg alt=\"license\" src=\"https://img.shields.io/badge/license-mit%2Fapache--2.0-007ec6?label=license\u0026style=flat\u0026labelColor=555555\u0026logo=open-source-initiative\" height=\"20\"\u003e](https://github.com/habedi/vq)\n\nVq (**v**[ector] **q**[uantizer]) is a Rust library that implements several\npopular [vector quantization](https://en.wikipedia.org/wiki/Vector_quantization) algorithms including binary, scalar,\nand product quantization.\nIt provides a simple API for data compression that helps reduce memory usage and computational overhead.\n\n### Features\n\n- Implemented Algorithms:\n    - [Binary Quantization (BQ)](src/bq.rs)\n    - [Scalar Quantization (SQ)](src/sq.rs)\n    - [Product Quantization (PQ)](https://ieeexplore.ieee.org/document/5432202)\n    - [Optimized Product Quantization (OPQ)](https://ieeexplore.ieee.org/document/6619223)\n    - [Tree-structured Vector Quantization (TSVQ)](https://ieeexplore.ieee.org/document/515493)\n    - [Residual Vector Quantization (RVQ)](https://pmc.ncbi.nlm.nih.gov/articles/PMC3231071/)\n\n- Parallelized vector operations for large vectors using [Rayon](https://crates.io/crates/rayon).\n- Flexible quantization algorithm implementations that support using various distance metrics such as Euclidean, Cosine,\n  and Manhattan distances.\n- Support for quantizing vectors of `f32` to `f16` (using [half](https://crates.io/crates/half)) or `u8` data types.\n- Simple, intuitive, and uniform API for all quantization algorithms.\n\n### Installation\n\n```bash\ncargo add vq\n```\n\n*Vq requires Rust 1.83 or later.*\n\n### Documentation\n\nFind the latest API documentation on [docs.rs](https://docs.rs/vq).\n\nCheck out [vq_examples.rs](src/bin/vq_examples.rs) the [tests](tests) directory for detailed examples of using Vq.\n\n#### Quick Example\n\nHere's a simple example using the SQ algorithm to quantize a vector:\n\n```rust\nuse vq::sq::ScalarQuantizer;\nuse vq::vector::Vector;\n\nfn main() {\n    // Create a scalar quantizer for values in the range [0.0, 1.0] with 256 levels.\n    let quantizer = ScalarQuantizer::fit(0.0, 1.0, 256);\n\n    // Create an input vector.\n    let input = Vector::new(vec![0.1, 0.5, -0.8, -0.3, 0.9]);\n\n    // Quantize the input vector.\n    let quantized_input = quantizer.quantize(\u0026input);\n\n    println!(\"Quantized input vector: {}\", quantized_input);\n}\n```\n\n### Performance\n\nCheck out the [notebooks](notebooks/) directory for information on how to evaluate the performance of the implemented\nalgorithms.\nAdditionally, see the content of [src/bin](src/bin/) directory for the scripts used for the evaluation.\n\n\u003e On a ThinkPad T14 laptop with an Intel i7-1355U CPU and 32GB of RAM, the performance of the PQ algorithm for\n\u003e quantizing one million vectors of 128 dimensions (into 16 subspaces with 256 centroids per subspace) is as follows:\n\u003e   - Training Time: 232.5 seconds\n\u003e   - Quantization Time: 34.1 seconds\n\u003e   - Reconstruction Error (MSE): 0.02\n\u003e   - Recall@10: 0.19\n\n### Contributing\n\nPlease see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute.\n\n### License\n\nVq is available under the terms of either of the following licenses:\n\n- MIT License ([LICENSE-MIT](LICENSE-MIT))\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhabedi%2Fvq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhabedi%2Fvq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhabedi%2Fvq/lists"}