tnsp-bridge


Nametnsp-bridge JSON
Version 0.3.17 PyPI version JSON
download
home_pageNone
Summarybridge from TNSP to TAT
upload_time2024-09-06 07:36:38
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseGPLv3
keywords tensor tensor network tensor network state peps mps quantum many body system
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            TNSP-bridge is a tool used to facilitate the conversion of tensor data from the format of [the old TNSP](https://www.sciencedirect.com/science/article/pii/S001046551830078X) to [TAT](https://github.com/USTC-TNS/TNSP/tree/main/PyTAT) format.
It's important to note that different versions of TNSP may have variations in their data structures,
but this specific subproject focuses on compatibility with TNSP version 4.
And we support the conversion of non-symmetry tensors and boson/fermion \(Z(2)\) / \(U(1)\) symmetry tensors of various scalar types.


# Install

Please either copy or create a soft link for the directory in the `site-packages` directory.
Alternatively, users can utilize pip to install the TNSP-bridge package by running the command `pip install tnsp_bridge`.


# Documents

The only function is `bridge`, which accepts a function that extracts the old version tensor data line by line and returns the tensor in the new version.
For example, here is the old version of the data:

     T T T T
     readable_data T
               2           8           3           0
               1           4           8
               3           7           8
       1.00000000       2.00000000       3.00000000      -1.00000000      -2.00000000      -3.00000000      -4.00000000       0.00000000
     End_data
     readable_data T
               1           8           3           0
               1           4           8
               3           7           8
               3           2           1           1           2           2           1           1
     End_data
     readable_data T
               1           6           2           0
               1           4
               3           6
               3           4           1          -1          -1           1
     End_data
     A1_1.D  A1_1.R  A1_1.n
     readable_data T
               3           9          12           0
               1       22049           0           0           4   538976288   538976288   538976288           8   538976288   538976288   538976288
               3           0           0           0           7           0           0           0           9           0           0           0
     0.23446911431164341       0.13002435022579403       -3.1842370052190448E-002  0.45356268067516309       -1.4087785231172337E-002  -9.0396315774136524E-002  -2.0732171027595565E-002 -0.35235299284206140       -1.2456779139446277E-002
     End_data
    EOF

The code below converts the aforementioned data,
stored in the string variable named `example_data`, to the new version format:

    from bridge import bridge
    
    data_line_by_line = example_data.split("\n")
    data_line_by_line.reverse()
    print(bridge(data_line_by_line.pop, compat=True, parity=False))

    {names:[A1_1.n,A1_1.R,A1_1.D],edges:[{arrow:0,segment:{0:1}},{arrow:1,segment:{-1:1,-2:2,-3:2,-4:1}},{arrow:1,segment:{1:3,2:2,3:1}}],blocks:{[0,-1,1]:[0.234469,0.130024,-0.0318424],[0,-2,2]:[0.453563,-0.0140878,-0.0903963,-0.0207322],[0,-3,3]:[-0.352353,-0.0124568]}}

The function `bridge` has two optional arguments.
The first one is `parity`, used to distinguish the symmetry group of a symmetry tensor.
When `parity` is set to `False` (default), it should be a fermion or boson \(U(1)\) symmetry tensor.
If set to `True`, a fermion or boson \(Z(1)\) symmetry tensor is considered.
The second argument is `compat`, which distinguishes the version in the old TNSP.
Within old TNSP, there are two data formats: the older one is processed when `compat` is set to `True`, and the newer one if set to `False` (default).


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tnsp-bridge",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "tensor, tensor network, tensor network state, PEPS, MPS, quantum many body system",
    "author": null,
    "author_email": "Hao Zhang <zh970205@mail.ustc.edu.cn>",
    "download_url": null,
    "platform": null,
    "description": "TNSP-bridge is a tool used to facilitate the conversion of tensor data from the format of [the old TNSP](https://www.sciencedirect.com/science/article/pii/S001046551830078X) to [TAT](https://github.com/USTC-TNS/TNSP/tree/main/PyTAT) format.\nIt's important to note that different versions of TNSP may have variations in their data structures,\nbut this specific subproject focuses on compatibility with TNSP version 4.\nAnd we support the conversion of non-symmetry tensors and boson/fermion \\(Z(2)\\) / \\(U(1)\\) symmetry tensors of various scalar types.\n\n\n# Install\n\nPlease either copy or create a soft link for the directory in the `site-packages` directory.\nAlternatively, users can utilize pip to install the TNSP-bridge package by running the command `pip install tnsp_bridge`.\n\n\n# Documents\n\nThe only function is `bridge`, which accepts a function that extracts the old version tensor data line by line and returns the tensor in the new version.\nFor example, here is the old version of the data:\n\n     T T T T\n     readable_data T\n               2           8           3           0\n               1           4           8\n               3           7           8\n       1.00000000       2.00000000       3.00000000      -1.00000000      -2.00000000      -3.00000000      -4.00000000       0.00000000\n     End_data\n     readable_data T\n               1           8           3           0\n               1           4           8\n               3           7           8\n               3           2           1           1           2           2           1           1\n     End_data\n     readable_data T\n               1           6           2           0\n               1           4\n               3           6\n               3           4           1          -1          -1           1\n     End_data\n     A1_1.D  A1_1.R  A1_1.n\n     readable_data T\n               3           9          12           0\n               1       22049           0           0           4   538976288   538976288   538976288           8   538976288   538976288   538976288\n               3           0           0           0           7           0           0           0           9           0           0           0\n     0.23446911431164341       0.13002435022579403       -3.1842370052190448E-002  0.45356268067516309       -1.4087785231172337E-002  -9.0396315774136524E-002  -2.0732171027595565E-002 -0.35235299284206140       -1.2456779139446277E-002\n     End_data\n    EOF\n\nThe code below converts the aforementioned data,\nstored in the string variable named `example_data`, to the new version format:\n\n    from bridge import bridge\n    \n    data_line_by_line = example_data.split(\"\\n\")\n    data_line_by_line.reverse()\n    print(bridge(data_line_by_line.pop, compat=True, parity=False))\n\n    {names:[A1_1.n,A1_1.R,A1_1.D],edges:[{arrow:0,segment:{0:1}},{arrow:1,segment:{-1:1,-2:2,-3:2,-4:1}},{arrow:1,segment:{1:3,2:2,3:1}}],blocks:{[0,-1,1]:[0.234469,0.130024,-0.0318424],[0,-2,2]:[0.453563,-0.0140878,-0.0903963,-0.0207322],[0,-3,3]:[-0.352353,-0.0124568]}}\n\nThe function `bridge` has two optional arguments.\nThe first one is `parity`, used to distinguish the symmetry group of a symmetry tensor.\nWhen `parity` is set to `False` (default), it should be a fermion or boson \\(U(1)\\) symmetry tensor.\nIf set to `True`, a fermion or boson \\(Z(1)\\) symmetry tensor is considered.\nThe second argument is `compat`, which distinguishes the version in the old TNSP.\nWithin old TNSP, there are two data formats: the older one is processed when `compat` is set to `True`, and the newer one if set to `False` (default).\n\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "bridge from TNSP to TAT",
    "version": "0.3.17",
    "project_urls": {
        "Changelog": "https://github.com/USTC-TNS/TNSP/blob/main/CHANGELOG.org",
        "Homepage": "https://github.com/USTC-TNS/TNSP/tree/main/tnsp_bridge",
        "Issues": "https://github.com/USTC-TNS/TNSP/issues",
        "Repository": "https://github.com/USTC-TNS/TNSP.git"
    },
    "split_keywords": [
        "tensor",
        " tensor network",
        " tensor network state",
        " peps",
        " mps",
        " quantum many body system"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27cad1eb2ba0bbfd9cb7cc511457f88e0787f039d4654882bb5aeab930e8b179",
                "md5": "1f0de7d5eb55dfde270b5ba7a3fbd16a",
                "sha256": "c7c65d213bbf8dfd3f5b5442d39eb365a4243fc721bcf1efcf1a4f9c926904f3"
            },
            "downloads": -1,
            "filename": "tnsp_bridge-0.3.17-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1f0de7d5eb55dfde270b5ba7a3fbd16a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 5309,
            "upload_time": "2024-09-06T07:36:38",
            "upload_time_iso_8601": "2024-09-06T07:36:38.438134Z",
            "url": "https://files.pythonhosted.org/packages/27/ca/d1eb2ba0bbfd9cb7cc511457f88e0787f039d4654882bb5aeab930e8b179/tnsp_bridge-0.3.17-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-06 07:36:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "USTC-TNS",
    "github_project": "TNSP",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tnsp-bridge"
}
        
Elapsed time: 0.76428s