{"id":16977870,"url":"https://github.com/jcmgray/einsum_bmm","last_synced_at":"2025-04-12T01:30:40.214Z","repository":{"id":85415430,"uuid":"602317692","full_name":"jcmgray/einsum_bmm","owner":"jcmgray","description":"einsum via batch matrix multiply","archived":false,"fork":false,"pushed_at":"2023-11-29T19:09:43.000Z","size":38,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T19:22:54.665Z","etag":null,"topics":["einsum","tensor","tensor-contraction","tensor-networks"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcmgray.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}},"created_at":"2023-02-16T00:25:09.000Z","updated_at":"2024-09-30T17:21:36.000Z","dependencies_parsed_at":"2023-03-07T04:30:12.731Z","dependency_job_id":null,"html_url":"https://github.com/jcmgray/einsum_bmm","commit_stats":null,"previous_names":["jcmgray/einsum_bmm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmgray%2Feinsum_bmm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmgray%2Feinsum_bmm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmgray%2Feinsum_bmm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcmgray%2Feinsum_bmm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcmgray","download_url":"https://codeload.github.com/jcmgray/einsum_bmm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248504193,"owners_count":21115132,"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":["einsum","tensor","tensor-contraction","tensor-networks"],"created_at":"2024-10-14T01:29:59.738Z","updated_at":"2025-04-12T01:30:39.934Z","avatar_url":"https://github.com/jcmgray.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `einsum_bmm`\n\n**:cactus: This has now been incorporated into `cotengra`, see the [high level functionality](https://cotengra.readthedocs.io/en/latest/high-level-interface.html), called with `implementation='cotengra'`, and the actual two term implementation [here](https://cotengra.readthedocs.io/en/latest/autoapi/cotengra/contract/index.html#cotengra.contract.einsum). There is also a PR for `numpy.einsum` with the `optimize` kwarg [here](https://github.com/numpy/numpy/pull/23513) :cactus:**\n\nThis repository provides an `einsum` (and `tensordot`) function implemented via **batch matrix\nmultiply**.\n\n\n\n1. This *can* be much faster than the raw `numpy.einsum` function, especially\n   for large and high dimensional contractions.\n2. It can also be used to enable `einsum` for any backend that provides only\n   `tranpose`, `reshape` and `matmul`.\n\nThe implementation is achieved by grouping indices according to the following classification:\n\n\u003cimg src=\"https://user-images.githubusercontent.com/8982598/228432891-595c88af-cb81-443e-9cf3-5eda86db01b2.png\" alt=\"Schematic\" width=\"500\" title=\"Einsum Schematic\"\u003e\n\n1. Summed indices are trivially removed.\n2. A and B and then transposed and reshaped for batched matrix multiplication\n3. The output is reshaped and transposed\n\nEach of these steps only occurs if necessary. There are slight specializations for both pure multiplication and no batch indices.\n\nNotes:\n\n* It currently only supports 1 or 2 terms, a library such as `opt_einsum` or\n  `cotengra` should be used to dispatch many term contractions to a pairwise\n  ordering in conjuction with this `einsum_bmm`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcmgray%2Feinsum_bmm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcmgray%2Feinsum_bmm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcmgray%2Feinsum_bmm/lists"}