{"id":15046513,"url":"https://github.com/f-dangel/curvlinops","last_synced_at":"2026-01-17T17:38:54.237Z","repository":{"id":60503206,"uuid":"513120915","full_name":"f-dangel/curvlinops","owner":"f-dangel","description":"PyTorch linear operators for curvature matrices (Hessian, Fisher/GGN, KFAC, ...)","archived":false,"fork":false,"pushed_at":"2026-01-11T23:47:12.000Z","size":2595,"stargazers_count":61,"open_issues_count":17,"forks_count":12,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-01-12T03:25:25.993Z","etag":null,"topics":["fisher","ggn","hessian","linalg","linear","linearoperator","operators","pytorch","scipy"],"latest_commit_sha":null,"homepage":"https://curvlinops.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/f-dangel.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-07-12T11:48:35.000Z","updated_at":"2026-01-11T02:30:32.000Z","dependencies_parsed_at":"2023-10-16T06:46:15.200Z","dependency_job_id":"58cc46df-5e2f-4c7d-8adb-dcc32b92670a","html_url":"https://github.com/f-dangel/curvlinops","commit_stats":{"total_commits":271,"total_committers":6,"mean_commits":"45.166666666666664","dds":0.5313653136531366,"last_synced_commit":"45c13bac2b71304a5d77c52267612cbd1d276280"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/f-dangel/curvlinops","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f-dangel%2Fcurvlinops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f-dangel%2Fcurvlinops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f-dangel%2Fcurvlinops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f-dangel%2Fcurvlinops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f-dangel","download_url":"https://codeload.github.com/f-dangel/curvlinops/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f-dangel%2Fcurvlinops/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28513831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"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":["fisher","ggn","hessian","linalg","linear","linearoperator","operators","pytorch","scipy"],"created_at":"2024-09-24T20:53:11.263Z","updated_at":"2026-01-17T17:38:54.226Z","avatar_url":"https://github.com/f-dangel.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cimg alt=\"Logo\" src=\"./docs/rtd/assets/logo.svg\" height=\"90\"\u003e Linear Operators for Curvature Matrices in PyTorch\n\n[![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/release/python-3100/)\n![tests](https://github.com/f-dangel/curvature-linear-operators/actions/workflows/test.yaml/badge.svg)\n[![Coveralls](https://coveralls.io/repos/github/f-dangel/curvlinops/badge.svg?branch=main)](https://coveralls.io/github/f-dangel/curvlinops)\n\nThis library provides **lin**ear **op**erator**s**---a unified interface for matrix-free computation---for deep learning **curv**ature matrices in PyTorch.\n`curvlinops` is inspired by SciPy's [`sparse.linalg.LinearOperator`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.LinearOperator.html) interface and implements a PyTorch version.\n\nYou can read our [position paper](https://arxiv.org/abs/2501.19183) to know more about why combining linear operators with curvature matrices might be a good idea.\n\nMain features:\n\n- **Broad support of curvature matrices.** `curvlinops` supports many common curvature matrices and approximations thereof, such as the Hessian, Fisher, generalized Gauss-Newton, and K-FAC ([overview](https://curvlinops.readthedocs.io/en/latest/linops.html#linear-operators), [visual tour](https://curvlinops.readthedocs.io/en/latest/basic_usage/example_visual_tour.html#visualization)).\n\n- **Unified interface.** All linear operators share the same interface, making it easy to switch between curvature matrices.\n\n- **Purely PyTorch.** All computations can run on a GPU.\n\n- **SciPy export.** You can export a `curvlinops` linear operator to a SciPy `LinearOperator` with `.to_scipy()`.\n  This allows plugging it into `scipy`, while carrying out the heavy lifting (matrix-vector multiplies) in PyTorch on GPU.\n  My favorite example is\n[`scipy.sparse.linalg.eigsh`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.eigsh.html) that lets you compute a subset of eigen-pairs ([example](https://curvlinops.readthedocs.io/en/latest/basic_usage/example_eigenvalues.html)).\n\n- **Randomized estimation algorithms.** `curvlinops` offers functionality to estimate properties the matrix represented by a linear operators, like its spectral density ([example](https://curvlinops.readthedocs.io/en/latest/basic_usage/example_verification_spectral_density.html)),\n  inverse ([example](https://curvlinops.readthedocs.io/en/latest/basic_usage/example_inverses.html)),\n  trace \u0026 diagonal ([example](https://curvlinops.readthedocs.io/en/latest/basic_usage/example_trace_diagonal_estimation.html)).\n\n## Installation\n\n```bash\npip install curvlinops-for-pytorch\n```\n\n## Useful Links\n\n- [Basic\n  usage](https://curvlinops.readthedocs.io/en/latest/basic_usage/example_matrix_vector_products.html)\n\n- [Advanced\n  examples](https://curvlinops.readthedocs.io/en/latest/basic_usage/index.html)\n\n- **Documentation:** https://curvlinops.readthedocs.io/en/latest/\n\n- **Bug reports \u0026 feature requests:**\n  https://github.com/f-dangel/curvlinops/issues\n\n## Citation\n\nIf you find `curvlinops` useful for your work, consider citing our [position paper](https://arxiv.org/abs/2501.19183)\n\n```bibtex\n\n@article{dangel2025position,\n  title =        {Position: Curvature Matrices Should Be Democratized via Linear\n                  Operators},\n  author =       {Dangel, Felix and Eschenhagen, Runa and Ormaniec, Weronika and\n                  Fernandez, Andres and Tatzel, Lukas and Kristiadi, Agustinus},\n  journal =      {arXiv 2501.19183},\n  year =         2025,\n}\n\n```\n\n## Future ideas\n\n- Refactor the back-end for curvature-matrix multiplication into pure functions\n  to improve recycle-ability and ease the use of `torch.compile`.\n\n- Multi-GPU support.\n\n- Include more curvature matrices\n  - E.g. the [GGN's hierarchical decomposition](https://arxiv.org/abs/2008.11865)\n\n###### Logo mage credits\n- PyTorch logo: https://github.com/soumith, [CC BY-SA\n  4.0](https://creativecommons.org/licenses/by-sa/4.0), via Wikimedia Commons\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff-dangel%2Fcurvlinops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff-dangel%2Fcurvlinops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff-dangel%2Fcurvlinops/lists"}