{"id":15325731,"url":"https://github.com/matthiasreumann/t1m","last_synced_at":"2025-04-15T02:52:43.587Z","repository":{"id":169304415,"uuid":"642414329","full_name":"MatthiasReumann/t1m","owner":"MatthiasReumann","description":"Transposition-free Complex Tensor Contractions","archived":false,"fork":false,"pushed_at":"2025-03-19T14:26:28.000Z","size":823,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T02:52:37.133Z","etag":null,"topics":["complex-tensors","tensor","tensor-contraction","tensors"],"latest_commit_sha":null,"homepage":"","language":"C++","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/MatthiasReumann.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}},"created_at":"2023-05-18T14:08:28.000Z","updated_at":"2023-09-28T22:22:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"c659c216-62bc-49c6-8dce-aa7650968f2a","html_url":"https://github.com/MatthiasReumann/t1m","commit_stats":{"total_commits":135,"total_committers":2,"mean_commits":67.5,"dds":0.0444444444444444,"last_synced_commit":"790f5352faca3b6e1498100fea9f581b728b5b3d"},"previous_names":["matthiasreumann/tfctc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthiasReumann%2Ft1m","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthiasReumann%2Ft1m/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthiasReumann%2Ft1m/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthiasReumann%2Ft1m/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MatthiasReumann","download_url":"https://codeload.github.com/MatthiasReumann/t1m/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997087,"owners_count":21195797,"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":["complex-tensors","tensor","tensor-contraction","tensors"],"created_at":"2024-10-01T09:32:56.058Z","updated_at":"2025-04-15T02:52:43.571Z","avatar_url":"https://github.com/MatthiasReumann.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# t1m\n\nFusion of the [**T**BLIS](https://github.com/devinamatthews/tblis) approach and the [**1M** Method](https://www.cs.utexas.edu/users/flame/pubs/blis6_toms_rev2.pdf) for complex Matrix-Matrix Multiplication to achieve complex Tensor Contractions. \n\n## Requirements\n\n- BLIS Library ([URL](https://github.com/flame/blis))\n- MArray Library ([URL](https://github.com/devinamatthews/marray))\n\n\n## API \n\n```cpp\nnamespace t1m\n{\n  void contract(Tensor\u003cstd::complex\u003cfloat\u003e\u003e A, std::string labelsA,\n                Tensor\u003cstd::complex\u003cfloat\u003e\u003e B, std::string labelsB,\n                Tensor\u003cstd::complex\u003cfloat\u003e\u003e C, std::string labelsC);\n\n  void contract(Tensor\u003cstd::complex\u003cdouble\u003e\u003e A, std::string labelsA,\n                Tensor\u003cstd::complex\u003cdouble\u003e\u003e B, std::string labelsB,\n                Tensor\u003cstd::complex\u003cdouble\u003e\u003e C, std::string labelsC);\n\n  void contract(float alpha, Tensor\u003cfloat\u003e A, std::string labelsA,\n                Tensor\u003cfloat\u003e B, std::string labelsB,\n                float beta, Tensor\u003cfloat\u003e C, std::string labelsC);\n\n  void contract(double alpha, Tensor\u003cdouble\u003e A, std::string labelsA,\n                Tensor\u003cdouble\u003e B, std::string labelsB,\n                double beta, Tensor\u003cdouble\u003e C, std::string labelsC);\n};\n```\n\n### Multithreading \n\nThe `t1m` library supports OpenMP. The number of threads can be specified with the environment variable `OMP_NUM_THREADS`.\n\n### Example\n\n```cpp\n#include \u003ccomplex\u003e\n#include \"t1m.hpp\"\n\nint main() \n{\n  std::complex\u003cfloat\u003e *A = nullptr, *B = nullptr, *C = nullptr;\n  t1m::utils::alloc_aligned(\u0026A, 2 * 2 * 2);\n  t1m::utils::alloc_aligned(\u0026B, 2 * 2);\n  t1m::utils::alloc_aligned(\u0026C, 2 * 2 * 2);\n  \n  // initialize values in column major\n\n  auto tensorA = t1m::Tensor\u003cstd::complex\u003cfloat\u003e\u003e({2, 2, 2}, A);\n  auto tensorB = t1m::Tensor\u003cstd::complex\u003cfloat\u003e\u003e({2, 2}, B);\n  auto tensorC = t1m::Tensor\u003cstd::complex\u003cfloat\u003e\u003e({2, 2, 2}, C);\n\n  t1m::contract(tensorA, \"abc\", tensorB, \"bd\", tensorC, \"acd\");\n  \n  // work with C or tensorC\n  \n  free(A);\n  free(B);\n  free(C);\n}\n```\n\n## Citation\n\nIn case you want refer to `t1m` as part of a research paper, please cite appropriately ([pdf](https://mediatum.ub.tum.de/download/1718165/1718165.pdf)):\n\n```text.bibtex\n@thesis {t1m2023,\n  author = {Matthias Reumann},\n  title = {Transpose-Free Contraction of Complex Tensors},\n  year = {2023},\n  school = {Technical University of Munich},\n  month = {Aug},\n  language = {en},\n  abstract = {Tensor Contraction (TC) is the operation that connects tensors in a Tensor Network (TN). Many scientific applications rely on efficient algorithms for the contraction of large tensors. In this thesis, we aim to develop a transposition-free TC algorithm for complex tensors. Our algorithm fuses high-performance General Matrix-Matrix Multiplication (GEMM), the 1M method for achieving complex with real-valued GEMM, and the Block-Scatter layout for tensors. Consequently, we give an elaborate overview of each. A benchmark for a series of contractions shows that our implementation can compete with the performance of state-of-the-art TC libraries.},\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthiasreumann%2Ft1m","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatthiasreumann%2Ft1m","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthiasreumann%2Ft1m/lists"}