{"id":44455264,"url":"https://github.com/derrickburns/tdigest","last_synced_at":"2026-02-12T17:12:00.940Z","repository":{"id":84408014,"uuid":"90564753","full_name":"derrickburns/tdigest","owner":"derrickburns","description":"C++ version of Ted Dunning's merging t-digest","archived":false,"fork":false,"pushed_at":"2025-10-23T15:57:00.000Z","size":29,"stargazers_count":27,"open_issues_count":3,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-23T17:42:35.043Z","etag":null,"topics":["cdf","dunning","quantile-estimation","tdigest"],"latest_commit_sha":null,"homepage":"","language":"C++","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/derrickburns.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-05-07T22:05:38.000Z","updated_at":"2025-10-23T15:57:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"457bea8b-4193-4540-a05f-1d301e02daba","html_url":"https://github.com/derrickburns/tdigest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/derrickburns/tdigest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrickburns%2Ftdigest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrickburns%2Ftdigest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrickburns%2Ftdigest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrickburns%2Ftdigest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derrickburns","download_url":"https://codeload.github.com/derrickburns/tdigest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrickburns%2Ftdigest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29373841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cdf","dunning","quantile-estimation","tdigest"],"created_at":"2026-02-12T17:12:00.348Z","updated_at":"2026-02-12T17:12:00.926Z","avatar_url":"https://github.com/derrickburns.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tdigest\n\nThis is an implementation of Ted Dunning's [Merging T-Digest](https://github.com/tdunning/t-digest/).\n\nThis implementation batches all inserts, including merges.  This is an improvement over the original implementation where merges require sorting of all points on each merge.\n\nThis implementation does not support storing the incoming data with each centroid, (since obviously that is for testing).\n\n## Usage\n\nThe T-Digest is a data structure for accurate online computation of quantiles and cumulative distribution functions (CDFs) on streaming data.\n\n### Basic Example\n\n```cpp\n#include \"tdigest2/TDigest.h\"\n\nusing namespace tdigest;\n\nint main() {\n    // Create a T-Digest with compression factor (default: 1000)\n    // Higher compression = more accuracy but more memory\n    TDigest digest(1000);\n\n    // Add data points\n    digest.add(1.0);\n    digest.add(2.0);\n    digest.add(3.0);\n\n    // Or add with weights\n    digest.add(4.0, 2.5);  // value, weight\n\n    // Compute quantiles (0.0 to 1.0)\n    double median = digest.quantile(0.5);      // 50th percentile\n    double p95 = digest.quantile(0.95);        // 95th percentile\n    double p99 = digest.quantile(0.99);        // 99th percentile\n\n    // Compute cumulative distribution function\n    double cdf_at_2 = digest.cdf(2.0);         // P(X \u003c= 2.0)\n\n    return 0;\n}\n```\n\n### Merging Multiple T-Digests\n\n```cpp\nTDigest digest1(1000);\nTDigest digest2(1000);\n\n// Add data to both digests\ndigest1.add(1.0);\ndigest2.add(2.0);\n\n// Merge digest1 into digest2\ndigest2.merge(\u0026digest1);\n\n// Now digest2 contains data from both\ndouble combined_median = digest2.quantile(0.5);\n```\n\n### Batch Processing\n\n```cpp\nTDigest digest(1000);\n\n// Add many values\nfor (int i = 0; i \u003c 1000000; i++) {\n    digest.add(some_value);\n}\n\n// Optional: compress to ensure processing\ndigest.compress();\n\n// Compute quantiles\ndouble q25 = digest.quantile(0.25);\ndouble q50 = digest.quantile(0.50);\ndouble q75 = digest.quantile(0.75);\n```\n\n## Building\n\nThis project uses Bazel for building and testing:\n\n```bash\nbazel test //...\n```\n\n## API Reference\n\n### Key Methods\n\n- `TDigest(compression)` - Constructor with compression factor (default: 1000)\n- `add(value)` - Add a single data point\n- `add(value, weight)` - Add a weighted data point\n- `quantile(q)` - Get the q-th quantile (0.0 to 1.0)\n- `cdf(x)` - Get the cumulative probability P(X \u003c= x)\n- `merge(other)` - Merge another T-Digest into this one\n- `compress()` - Force compression of unprocessed data\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderrickburns%2Ftdigest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderrickburns%2Ftdigest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderrickburns%2Ftdigest/lists"}