{"id":17606601,"url":"https://github.com/peekxc/primate","last_synced_at":"2025-08-20T03:35:00.495Z","repository":{"id":191752220,"uuid":"685320702","full_name":"peekxc/primate","owner":"peekxc","description":"Implicit matrix function and trace estimator","archived":false,"fork":false,"pushed_at":"2024-12-28T01:08:19.000Z","size":25335,"stargazers_count":5,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-13T05:58:08.022Z","etag":null,"topics":["lanczos-algorithm","linear-algebra","matrix-functions","python-package","randomized-algorithm","scientific-computing"],"latest_commit_sha":null,"homepage":"https://peekxc.github.io/primate/","language":"Python","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/peekxc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2023-08-31T01:20:42.000Z","updated_at":"2024-12-28T01:08:22.000Z","dependencies_parsed_at":"2023-10-05T03:34:50.031Z","dependency_job_id":"953bfa67-e649-4d13-b2a8-be86a51a1bea","html_url":"https://github.com/peekxc/primate","commit_stats":{"total_commits":253,"total_committers":3,"mean_commits":84.33333333333333,"dds":0.07509881422924902,"last_synced_commit":"d1ea18fe6512a2ca19b696c00d88326609975021"},"previous_names":["peekxc/pyimate"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/peekxc/primate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peekxc%2Fprimate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peekxc%2Fprimate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peekxc%2Fprimate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peekxc%2Fprimate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peekxc","download_url":"https://codeload.github.com/peekxc/primate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peekxc%2Fprimate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271259239,"owners_count":24728250,"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","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["lanczos-algorithm","linear-algebra","matrix-functions","python-package","randomized-algorithm","scientific-computing"],"created_at":"2024-10-22T15:45:20.129Z","updated_at":"2025-08-20T03:35:00.441Z","avatar_url":"https://github.com/peekxc.png","language":"Python","readme":"[![](https://img.shields.io/badge/docs-quarto-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAADDklEQVR4nOyZXYhNXRjHf+8bw4TyUYYpxUQm8jG+wo0rX0XiYkoaLpRcUEzNXEiZuZjQhCsKd27UiEa5RCSSbzJGNBMZIo1EYTSGVj1pOufZ+6y1zlpz5mh+dZrp2Xuv9f/vvdfa63nW/xQ5QwYKTdEbGJYZKKuYnW+b5qZMBH4Cn4ASYBzwEejLp+EPnW1Zsf8yA3UtL33argI2AWuBOSK6AWgEFgL3gB/AE+Aa0ArcBn67dNJcPSMrlvUEHCgDtgM1QKXF+SOBJfKrBzqBU8BpeVJe+IyBCcBRoANoshSvUQEcArqAw8AYn0ZcDcwCHgJ7gVE+HSqUyhN5Dix2vdjFwEbgBjDFtRNLyoGrwHqXi2wNbAEuAOP9tFkzGjgPbLC9wMbAGhloA8VwoEX6zUkuA0tlyisNo80aMw2flTGXSpoB8404CYwIq82asfLalqSdlGZgGzA3vC4nZgK7005IMmDu/r44mpypS3sLkgxUA9nf7cJgvvg7kw4mGaiNp8eLPdq6jQQD02S9MpiYCizQDmgGVsbX44WqSzMwP74WL6q0oGZgsAzeTKZrQc3ApPhavFB1aQnN5kBf33fytx1YFKC9Xi2oGXgaoLP+fAPuB27zL5qBXZJ15YvJfa8Dk4EdAdozN6I5M6gZqAn0HWgQA+Xyf750aAa0QfwmQGcxUHVpBtrja/HimRbUDNyJr8WLu1pQM2AS9574epzoA65oBzQDn4Ez8TU5ccllDCCFprzqmIE5mHQgyYCZss7F0+PEZamjqqTlxI3ArzianDiQdjDNgJlOj4fX48QR4FbaCbnqQvVJo38AuCgJfSq5DPRIrfJxOF1WtAFbbfYPbEqL34F1wIMw2nJyE1gBfLE52ba42wUsl/k4Jmbxtwrotr3ApbzeIyX2BtkuCslXYD+wWpbN1rhucPTK9FoZ8Gm0SgmzyWcJ47vN+loGdxVwTPa7XDCv5AlgnjzVV546shOa951OGeUj+dVK8WmZFGTL+6Wm3bKZ9xZ4Ieml11boP0nR79QPGSg0fwIAAP//ppR6oEaYviYAAAAASUVORK5CYII=)](https://peekxc.github.io/primate/)\n[![GH wheel build](https://badgen.net/github/checks/peekxc/primate?icon=pypi\u0026label=wheels)](https://github.com/peekxc/primate/actions/workflows/wheels.yml)\n[![Coveralls coverage](https://img.shields.io/coverallsCoverage/github/peekxc/primate?logo=pytest\u0026logoColor=white)](https://coveralls.io/github/peekxc/primate?branch=main)\n[![Python versions](https://badgen.net/badge/python/3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13/blue)](https://github.com/peekxc/primate/actions)\n[![PyPI Version](https://badgen.net/pypi/v/scikit-primate)](https://pypi.org/project/scikit-primate/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n\u003c!-- [![Cirrus CI - Default Branch Build Status](https://img.shields.io/cirrus/github/peekxc/primate?style=flat\u0026logo=pytest\u0026logoColor=white\u0026label=tests)](https://cirrus-ci.com/github/peekxc/primate)\n[![Coverage Status](https://badgen.net/coveralls/c/github/peekxc/primate/main)](https://coveralls.io/github/peekxc/primate?branch=main) --\u003e\n\u003c!-- [![build_macos](https://img.shields.io/github/actions/workflow/status/peekxc/primate/build_macos.yml?logo=apple\u0026logoColor=white)](https://github.com/peekxc/primate/actions/workflows/wheels.yml) \n[![build_windows](https://img.shields.io/github/actions/workflow/status/peekxc/primate/build_windows.yml?logo=windows\u0026logoColor=white)](https://github.com/peekxc/primate/actions/workflows/wheels.yml) \n[![build_linux](https://img.shields.io/github/actions/workflow/status/peekxc/primate/build_linux.yml?logo=linux\u0026logoColor=white)](https://github.com/peekxc/primate/actions/workflows/wheels.yml) --\u003e\n\n`primate`, short for **Pr**obabilistic **I**mplicit **Ma**trix **T**race **E**stimator, is a Python package that provides estimators of quantities from matrices, linear operators, and [matrix functions](https://en.wikipedia.org/wiki/Analytic_function_of_a_matrix):\n\n$$ f(A) \\triangleq U f(\\Lambda) U^{\\intercal}, \\quad \\quad f : [a,b] \\to \\mathbb{R}$$\n\nThis definition is quite general in that different parameterizations of $f$ produce a variety of spectral quantities, including the matrix inverse $A^{-1}$, the matrix exponential $\\mathrm{exp}(A)$, the matrix logarithm $\\mathrm{log}(A)$, and so on. \n\nComposing these with _trace_ and _diagonal_ estimators yields approximations for the [numerical rank](https://doi.org/10.1016/j.amc.2007.06.005), the [log-determinant](https://en.wikipedia.org/wiki/Determinant#Trace), the [Schatten norms](https://en.wikipedia.org/wiki/Schatten_norm), the [eigencount](https://doi.org/10.1002/nla.2048), the [Estrada index](https://en.wikipedia.org/wiki/Estrada_index), the [Heat Kernel Signature](https://en.wikipedia.org/wiki/Heat_kernel_signature), and so on. \n\n\u003c!-- `primate` also exports functionality for estimating the [spectral density](https://doi.org/10.1137/130934283) and for computing Gaussian quadrature rules from Jacobi matrices.  --\u003e\n\nNotable features of `primate` include:\n\n- Efficient methods for _trace_, _diagonal_, and _matrix function_ approximation\n- Support for _arbitrary_ matrix types, e.g. NumPy arrays, sparse matrices, or [LinearOperator](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.LinearOperator.html#scipy-sparse-linalg-linearoperator)'s\n- Support for _arbitrary_ matrix functions, i.e. `Callable`'s (Python) and `invocable`'s[^3] (C++)\n- Matrix-free interface to the _Lanczos_ and _Golub-Welsch_ methods \n- Various composable stopping criteria for easy and adaptive convergence checking\n\n`primate` was partially inspired by the [`imate` package](https://github.com/ameli/imate)---for a comparison of the two, see [here](https://peekxc.github.io/primate/imate_compare.html).\n\n## Installation\n\n`primate` is a standard PEP-517 package, and thus can be installed via pip:\n\n```{bash}\npython -m pip install scikit-primate\n```\n\nAssuming your platform is supported, no compilation is needed. \n\nSee the [installation page](https://peekxc.github.io/primate/basic/install.html) for details.\n\n## Applications \n\nApplications of matrix functions include [characterizing folding in proteins](https://en.wikipedia.org/wiki/Estrada_index), [principal component regression](https://en.wikipedia.org/wiki/Principal_component_regression), [spectral clustering](https://en.wikipedia.org/wiki/Spectral_clustering),  [Gaussian process likelihood estimation](https://en.wikipedia.org/wiki/Gaussian_process), [counting triangles in distributed-memory networks](https://doi.org/10.1137/23M1548323), [characterizing graph similarity](https://doi.org/10.1016/j.patcog.2008.12.029), and [deep neural loss landscape analysis](https://proceedings.mlr.press/v97/ghorbani19b).\n\nIf you have a particular application, feel free to make a computational notebook to illustrate it as a use-case!\n\n[^1]: Musco, Cameron, Christopher Musco, and Aaron Sidford. (2018) \"Stability of the Lanczos method for matrix function approximation.\"\n[^2]: Ubaru, S., Chen, J., \u0026 Saad, Y. (2017). Fast estimation of tr(f(A)) via stochastic Lanczos quadrature.\n[^3]: This includes [std::function](https://en.cppreference.com/w/cpp/utility/functional/function)'s, C-style function pointers, [functors](https://stackoverflow.com/questions/356950/what-are-c-functors-and-their-uses), and [lambda expressions](https://en.cppreference.com/w/cpp/language/lambda).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeekxc%2Fprimate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeekxc%2Fprimate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeekxc%2Fprimate/lists"}