{"id":13672356,"url":"https://github.com/al-jshen/compute","last_synced_at":"2026-04-04T12:58:07.715Z","repository":{"id":48294578,"uuid":"292742763","full_name":"al-jshen/compute","owner":"al-jshen","description":"Scientific and statistical computing with Rust.","archived":false,"fork":false,"pushed_at":"2021-11-09T06:40:33.000Z","size":1211,"stargazers_count":68,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-02T10:57:10.298Z","etag":null,"topics":["computing","rust","science","statistics"],"latest_commit_sha":null,"homepage":"https://docs.rs/compute","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/al-jshen.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}},"created_at":"2020-09-04T03:48:11.000Z","updated_at":"2025-11-14T06:44:15.000Z","dependencies_parsed_at":"2022-08-27T11:33:27.488Z","dependency_job_id":null,"html_url":"https://github.com/al-jshen/compute","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/al-jshen/compute","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-jshen%2Fcompute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-jshen%2Fcompute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-jshen%2Fcompute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-jshen%2Fcompute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/al-jshen","download_url":"https://codeload.github.com/al-jshen/compute/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/al-jshen%2Fcompute/sbom","scorecard":{"id":177080,"data":{"date":"2025-08-11","repo":{"name":"github.com/al-jshen/compute","commit":"73ead41fddbe25f70845baa77ece338976b87c21"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/rust.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/rust.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/al-jshen/compute/rust.yml/master?enable=pin","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE-APACHE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE-APACHE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-16T17:54:45.409Z","repository_id":48294578,"created_at":"2025-08-16T17:54:45.409Z","updated_at":"2025-08-16T17:54:45.409Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31400460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"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":["computing","rust","science","statistics"],"created_at":"2024-08-02T09:01:33.309Z","updated_at":"2026-04-04T12:58:07.696Z","avatar_url":"https://github.com/al-jshen.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# compute\n\n\u003c!-- [![Build Status](https://travis-ci.org/al-jshen/compute.svg?branch=master)](https://travis-ci.org/al-jshen/compute) --\u003e\n\n[![Crates.io](https://img.shields.io/crates/v/compute.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust)](https://crates.io/crates/compute)\n[![Documentation](https://img.shields.io/badge/docs.rs-compute-5E81AC?style=for-the-badge\u0026labelColor=555555\u0026logoColor=white)](https://docs.rs/compute)\n![License](https://img.shields.io/crates/l/compute?label=License\u0026style=for-the-badge\u0026color=62a69b)\n\nA crate for scientific and statistical computing. For a list of what this crate provides, see [`FEATURES.md`](FEATURES.md). For more detailed explanations, see the [documentation](https://docs.rs/compute).\n\nTo use the latest stable version in your Rust program, add the following to your `Cargo.toml` file:\n\n```rust\n// Cargo.toml\n[dependencies]\ncompute = \"0.2\"\n```\n\nFor the latest version, add the following to your `Cargo.toml` file:\n\n```rust\n[dependencies]\ncompute = { git = \"https://github.com/al-jshen/compute\" }\n```\n\nThere are many functions which rely on linear algebra methods. You can either use the provided Rust methods (default), or use BLAS and/or LAPACK by activating the `\"blas\"` and/or the `\"lapack\"` feature flags in `Cargo.toml`:\n\n```rust\n// example with BLAS only\ncompute = {version = \"0.2\", features = [\"blas\"]}\n```\n\n## Examples\n\n### Statistical distributions\n\n```rust\nuse compute::distributions::*;\n\nlet beta = Beta::new(2., 2.);\nlet betadata = b.sample_n(1000); // vector of 1000 variates\n\nprintln!(\"{}\", beta.mean()); // analytic mean\nprintln!(\"{}\", beta.var()); // analytic variance\nprintln!(\"{}\", beta.pdf(0.5)); // probability distribution function\n\nlet binom = Binomial::new(4, 0.5);\n\nprintln!(\"{}\", p.sample()); // sample single value\nprintln!(\"{}\", p.pmf(2));  // probability mass function\n```\n\n### Linear algebra\n\n```rust\nuse compute::linalg::*;\n\nlet x = arange(1., 4., 0.1).ln_1p().reshape(-1, 3);  // automatic shape detection\nlet y = Vector::from([1., 2., 3.]);  // vector struct\nlet pd = x.t().dot(x);               // transpose and matrix multiply\nlet jitter = Matrix::eye(3) * 1e-6;  // elementwise operations\nlet c = (pd + jitter).cholesky();    // matrix decompositions\nlet s = c.solve(\u0026y.exp());           // linear solvers\nprintln!(\"{}\", s);\n```\n\n### Linear models\n\n```rust\nuse compute::prelude::*;\n\nlet x = vec![\n    0.50, 0.75, 1.00, 1.25, 1.50, 1.75, 1.75, 2.00, 2.25, 2.50, 2.75, 3.00, 3.25, 3.50, 4.00,\n    4.25, 4.50, 4.75, 5.00, 5.50,\n];\nlet y = vec![\n    0., 0., 0., 0., 0., 0., 1., 0., 1., 0., 1., 0., 1., 0., 1., 1., 1., 1., 1., 1.,\n];\nlet n = y.len();\nlet xd = design(\u0026x, n);\n\nlet mut glm = GLM::new(ExponentialFamily::Bernoulli); // logistic regression\nglm.set_penalty(1.);                                  // L2 penalty\nglm.fit(\u0026xd, \u0026y, 25).unwrap();                        // with fit scoring algorithm (MLE)\nlet coef = glm.coef().unwrap();                       // get estimated parameters\nlet errors = glm.coef_standard_error().unwrap();      // get errors on parameters\n\nprintln!(\"{:?}\", coef);\nprintln!(\"{:?}\", errors);\n\n```\n\n### Optimization\n\n```rust\nuse compute::optimize::*;\n\n// define a function using a consistent optimization interface\nfn rosenbrock\u003c'a\u003e(p: \u0026[Var\u003c'a\u003e], d: \u0026[\u0026[f64]]) -\u003e Var\u003c'a\u003e {\n    assert_eq!(p.len(), 2);\n    assert_eq!(d.len(), 1);\n    assert_eq!(d[0].len(), 2);\n\n    let (x, y) = (p[0], p[1]);\n    let (a, b) = (d[0][0], d[0][1]);\n\n    (a - x).powi(2) + b * (y - x.powi(2)).powi(2)\n}\n\n// set up and run optimizer\nlet init = [0., 0.];\nlet optim = Adam::with_stepsize(5e-4);\nlet popt = optim.optimize(rosenbrock, \u0026init, \u0026[\u0026[1., 100.]], 10000);\n\nprintln!(\"{:?}\", popt);\n```\n\n### Time series models\n\n```rust\nuse compute::timeseries::*;\n\nlet x = vec![-2.584, -3.474, -1.977, -0.226, 1.166, 0.923, -1.075, 0.732, 0.959];\n\nlet mut ar = AR::new(1);             // AR(1) model\nar.fit(\u0026x);                          // fit model with Yule-Walker equations\nprintln!(\"{:?}\", ar.coeffs);         // get model coefficients\nprintln!(\"{:?}\", ar.predict(\u0026x, 5)); // forecast 5 steps ahead\n```\n\n### Numerical integration\n\n```rust\nuse compute::integrate::*;\n\nlet f = |x: f64| x.sqrt() + x.sin() - (3. * x).cos() - x.powi(2);\nprintln!(\"{}\", trapz(f, 0., 1., 100));        // trapezoid integration with 100 segments\nprintln!(\"{}\", quad5(f, 0., 1.));             // gaussian quadrature integration\nprintln!(\"{}\", romberg(f, 0., 1., 1e-8, 10)); // romberg integration with tolerance and max steps\n```\n\n### Data summary functions\n\n```rust\nuse compute::statistics::*;\nuse compute::linalg::Vector;\n\nlet x = Vector::from([2.2, 3.4, 5., 10., -2.1, 0.1]);\n\nprintln!(\"{}\", x.mean());\nprintln!(\"{}\", x.var());\nprintln!(\"{}\", x.max());\nprintln!(\"{}\", x.argmax());\n```\n\n### Mathematical and statistical functions\n\n```rust\nuse compute::functions::*;\n\nprintln!(\"{}\", logistic(4.));\nprintln!(\"{}\", boxcox(5., 2.);      // boxcox transform\nprintln!(\"{}\", digamma(2.));\nprintln!(\"{}\", binom_coeff(10, 4)); // n choose k\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fal-jshen%2Fcompute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fal-jshen%2Fcompute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fal-jshen%2Fcompute/lists"}