{"id":13717442,"url":"https://github.com/kaihsin/Tor10","last_synced_at":"2025-05-07T07:31:39.665Z","repository":{"id":73436704,"uuid":"161453110","full_name":"kaihsin/Tor10","owner":"kaihsin","description":"A Generic Tensor-Network library that is designed for quantum simulation, base on the pytorch","archived":false,"fork":false,"pushed_at":"2019-06-21T19:35:29.000Z","size":16591,"stargazers_count":60,"open_issues_count":1,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-28T12:20:40.985Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaihsin.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}},"created_at":"2018-12-12T08:01:56.000Z","updated_at":"2024-07-05T07:35:30.000Z","dependencies_parsed_at":"2024-01-25T19:05:18.819Z","dependency_job_id":"8ec550fb-c5e3-42fe-85da-f7ee2a7bf1d3","html_url":"https://github.com/kaihsin/Tor10","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihsin%2FTor10","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihsin%2FTor10/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihsin%2FTor10/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihsin%2FTor10/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaihsin","download_url":"https://codeload.github.com/kaihsin/Tor10/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224573514,"owners_count":17333804,"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":[],"created_at":"2024-08-03T00:01:22.275Z","updated_at":"2025-05-07T07:31:39.653Z","avatar_url":"https://github.com/kaihsin.png","language":"Python","funding_links":[],"categories":["Pytorch \u0026 related libraries｜Pytorch \u0026 相关库","Pytorch \u0026 related libraries","Python"],"sub_categories":["Other libraries｜其他库:","Other libraries:"],"readme":"![alt text](./Tor10_icon.png)\n\n## What's new\n    v0.3\n    1. Three type of UniTensor can be construct. [symmetry][tagged][untagged] \n    2. The Bond can be tagged with bra/ket or untagged (regular)\n    3. Now change the storage of symmetry to blockform. the dense storage for symmetry is deprecated.\n    4. Add braketform() to coalesce the bra/ket with row/col(in/out)\n    5. rowrank defines the row/col space. \n    6. Enhanced Print_diagram\n    7. Seperate Contiguous() and Contiguous\\_() for inplace and return type function.\n    8. change behavior of GetBlock and PutBlock on a non-symm tensor. in this version, it will return a rank-2 matrix.\n    9. Add GetValidQnums() for symmetry tensor\n    10. For symmtry, the bond order is relevant. The default fusion tree is in order of ((((0,1),2),3),4 ....\n    11. Add UniTensor.dtype() [@property]\n    12. Add UniTensor.device() [@property]\n    13. nn , some linalg can only accept non-symm, untagged tensor. \n\n    v0.3.1    \n    1. Fix cannot create rank-0 UniTensor bug.\n\n    v0.3.2\n    1. Fix Permute() will print the tensor elements bug.\n\n    v0.3.3\n    1. Remove the private args in UniTensor.__init__, in place, they are move to private member function __mac() \n    2. Fix UniTensor.__pow__ does not return anything bug. \n    3. Remove unrelated arguments in documentation\n    4. Change the order of functions appears in documentation tor10.UniTensor\n\n    v0.3.4\n    1. Fix Svd, Svd_truncate, Qr, Qdr crash bug. Originated from the variable change of v0.3.3a \n    2. From 1., iTEBD.py cannot work is fixed. \n\n    v0.3.5\n    1. Fix create Rank-0 Tensor crash bug, also change to real rank-0 tensor\n    2. Fix Reshape_() labels are not set bug, and remove redundancy code in the Reshape_()\n    3. Add View() and View_, which is the same functionality as pytorch \n    4. Can now create rank-0 tensor from torch.tensor(). \n\n    v0.3.6\n    1. Exchange BRA and KET. KET is now row-space and BRA is now col-space\n\n    v0.3.7\n    1. Change `N_rowrank` to `rowrank`\n    2. Fix T.Svd_truncate missing argument bug\n    3. Fix T.Svd_truncate missing linalg. bug\n    4. Fix PutBlock cause mismatch on non-contiguous tensors\n    5. Update docs for PutBlock\n\n    v0.3.8\n    1. Fix Network trace out all bonds will raise error bug.\n\n    v0.3.9\n    1. Change the behaviour of Bonds when initialize a UniTensor. All the bonds will be deepcopy now\n\n    v0.3.10\n    1. Change Tor10 -\u003e tor10 for deployment\n\n## Release version\n    v0.3.9 alpha\n\n## Known issue\n    1. HOSVD is not functional\n    2. Contract for UniTensors with symmetry cannot have the bonds in two tensors all are unique labels.\n\n## Requirements\n    pytorch\u003e=1.0\n    numpy  \u003e=1.15\n    sphinx \u003e=1.8.2\n    sphinx_rtd_theme \u003e=0.4.2 \n\n## Documentation:\n\n[https://kaihsinwu.gitlab.io/tor10](https://kaihsinwu.gitlab.io/tor10)\n\n## Code naming principle:\n    1) the functions start with \"_\" are the private function that should not be call directly by user.\n\n## Feature:\n        \n    1. Create Tensor:\n        * support multiple precisions.        \n        * support devices (cpu and gpu are trivial)\n        * preserve the similar api for Bond \n        * can serve as regular generic Tensor or physical tensor (with bra-ket tagged)\n        \n```python\n       ## create a rank-2 Physical Tensor with no symmetry \n       bds = [ Bond(3,BD_BRA), Bond(4,BD_KET)]\n       A = UniTensor(bds,label=[2,4],N_inbond=1,dtype=torch.float64,device=torch.device(\"cpu\"))\n\n       ## create a rank-2 generic Tensor \n       bds = [ Bond(4), Bond(6) ]\n       B = UniTensor(bds,N_inbond=1)\n\n       ## Moving to GPU:\n       A.to(torch.device(\"cuda:0\"))\n```\n\n    2. Tensor :\n        * vitual swap and permute. All the permute and swap will not change the underlying memory\n        * Use Contiguous() or Contiguous_() when needed to actual moving the memory layout.\n\n```python\n        A.Contiguous()\n```\n\n    3. Multiple Symmetries:\n        * Support arbitrary numbers and types of symmetry.\n        * Currently support U1 and Zn (with arbitrary n). \n\n```python\n        #\u003e Multiple mix symmetry: U1 x Z2 x Z4\n        bd_sym_mix = tor10.Bond(3,qnums=[[-2,0,0],\n                                         [-1,1,3],\n                                         [ 1,0,2]],\n                                 sym_types=[tor10.Symmetry.U1(),\n                                            tor10.Symmetry.Zn(2),\n                                            tor10.Symmetry.Zn(4)],\n                                  tor10.BD_BRA)\n``` \n        \n    4. Network :\n        * See documentation for how to use network.\n\n    5. Autograd mechanism:\n        The tor10 now support the autograd functionality. The Contract, Matmul etc will automatically contruct the gradient flow for UniTensor that has [requires_grad=True]\n        \n        * See documentation for further details\n\n\n    6. Easy coordinate with pytorch for Neural-Network:\n        We provide tor10.nn that can easy cooperate with pytorch.nn.Module to perform neural-network tasks.\n\n```python\n        import torch\n        import tor10\n        class Model(torch.nn.Module):\n            def __init__(self):\n                super(Model,self).__init__()\n                ## Customize and register the parameter.\n                self.P1 = tor10.nn.Parameter(tor10.UniTensor(bonds=[tor10.Bond(2),tor10.Bond(2)],rowrank=1))\n                self.P2 = tor10.nn.Parameter(tor10.UniTensor(bonds=[tor10.Bond(2),tor10.Bond(2)],rowrank=1))\n \n            def forward(self,x):\n                y = tor10.Matmul(tor10.Matmul(x,self.P1),self.P2)\n                return y\n\n        md = Model()\n        print(list(md.parameters()))\n        ## Output:\n        #    [Parameter containing:\n        #    tensor([[0., 0.],\n        #            [0., 0.]], dtype=torch.float64, requires_grad=True), Parameter containing:\n        #    tensor([[0., 0.],\n        #            [0., 0.]], dtype=torch.float64, requires_grad=True)]\n```\n        * See documentation for further details\n\n\n    See test.py for further detail application functions.\n\n## Example:\n\n    See iTEBD.py for an simple example of using iTEBD algo. to calculate the 1D-transverse field Ising model \n    See iTEBD_gpu.py for an simple example of the same algo accelerated with GPU. \n\n    See example.py for elementary usage.\n\n## Developers:\n\n    * Kai-Hsin Wu     kaihsinwu@gmail.com\n\n    * Jing-Jer Yen \n    * Yen-Hsin Wu \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaihsin%2FTor10","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaihsin%2FTor10","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaihsin%2FTor10/lists"}