pyqentangle


Namepyqentangle JSON
Version 4.0.3 PyPI version JSON
download
home_pageNone
SummaryQuantum Entanglement in Python
upload_time2024-09-23 18:33:46
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT
keywords quantum physics quantum information schmidt decomposition entanglement
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Quantum Entanglement in Python

[![CircleCI](https://circleci.com/gh/stephenhky/pyqentangle.svg?style=svg)](https://circleci.com/gh/stephenhky/pyqentangle.svg)
[![GitHub release](https://img.shields.io/github/release/stephenhky/pyqentangle.svg?maxAge=3600)](https://github.com/stephenhky/pyqentangle/releases)
[![Documentation Status](https://readthedocs.org/projects/pyqentangle/badge/?version=latest)](https://pyqentangle.readthedocs.io/en/latest/?badge=latest)
[![Updates](https://pyup.io/repos/github/stephenhky/pyqentangle/shield.svg)](https://pyup.io/repos/github/stephenhky/pyqentangle/)
[![Python 3](https://pyup.io/repos/github/stephenhky/pyqentangle/python-3-shield.svg)](https://pyup.io/repos/github/stephenhky/pyqentangle/)
[![pypi](https://img.shields.io/pypi/v/pyqentangle.svg?maxAge=3600)](https://pypi.org/project/pyqentangle/)
[![download](https://img.shields.io/pypi/dm/pyqentangle.svg?maxAge=2592000&label=installs&color=%2327B1FF)](https://pypi.org/project/pyqentangle/)

## Version

The releases of `pyqentangle` 2.x.x is incompatible with previous releases.

The releases of `pyqentangle` 3.x.x is incompatible with previous releases.

Since release 3.1.0, the support for Python 2.7 and 3.5 has been decomissioned.
Since release 3.3.0, support for Python 3.6 is diminished, but that for Python 3.11 is added.

## Installation

This package can be installed using `pip`.

```
>>> pip install pyqentangle
```

To use it, enter

```
>>> import pyqentangle
>>> import numpy as np
```

## Schmidt Decomposition for Discrete Bipartite States

We first express the bipartite state in terms of a tensor. For example, if the state is `|01>+|10>`, then express it as

```
>>> tensor = np.array([[0., np.sqrt(0.5)], [np.sqrt(0.5), 0.]])
```

To perform the Schmidt decompostion, just enter:

```
>>> pyqentangle.schmidt_decomposition(tensor)
[(0.7071067811865476, array([ 0., -1.]), array([-1., -0.])),
 (0.7071067811865476, array([-1.,  0.]), array([-0., -1.]))]
 ```

For each tuple in the returned list, the first element is the Schmidt coefficients, the second the component for first subsystem, and the third the component for the second subsystem.

## Schmidt Decomposition for Continuous Bipartite States

We can perform Schmidt decomposition on continuous systems too. For example, define the following normalized wavefunction:

```
>>> fcn = lambda x1, x2: np.exp(-0.5 * (x1 + x2) ** 2) * np.exp(-(x1 - x2) ** 2) * np.sqrt(np.sqrt(8.) / np.pi)
```

Then perform the Schmidt decomposition, 

```
>>> modes = pyqentangle.continuous_schmidt_decomposition(biwavefcn, -10., 10., -10., 10., keep=10)
```

where it describes the ranges of x1 and x2 respectively, and `keep=10` specifies only top 10 Schmidt modes are kept. Then we can read the Schmidt coefficients:

```
>>> list(map(lambda dec: dec[0], modes))
[0.9851714310094161,
 0.1690286950361957,
 0.02900073920775954,
 0.004975740210361192,
 0.0008537020544076649,
 0.00014647211608480773,
 2.51306421011773e-05,
 4.311736522272035e-06,
 7.39777032460608e-07,
 1.2692567250688184e-07]
```

The second and the third elements in each tuple in the list `decompositions` are lambda functions for the modes of susbsystems A and B respectively. The Schmidt functions can be plotted:
```
>>> xarray = np.linspace(-10., 10., 100)

    plt.subplot(3, 2, 1)
    plt.plot(xarray, modes[0][1](xarray))
    plt.subplot(3, 2, 2)
    plt.plot(xarray, modes[0][2](xarray))

    plt.subplot(3, 2, 3)
    plt.plot(xarray, modes[1][1](xarray))
    plt.subplot(3, 2, 4)
    plt.plot(xarray, modes[1][2](xarray))

    plt.subplot(3, 2, 5)
    plt.plot(xarray, modes[2][1](xarray))
    plt.subplot(3, 2, 6)
    plt.plot(xarray, modes[2][2](xarray))
```

![alt](https://github.com/stephenhky/pyqentangle/raw/master/fig/three_harmonic_modes.png)


## Useful Links

* Study of Entanglement in Quantum Computers: [https://datawarrior.wordpress.com/2017/09/20/a-first-glimpse-of-rigettis-quantum-computing-cloud/](https://datawarrior.wordpress.com/2017/09/20/a-first-glimpse-of-rigettis-quantum-computing-cloud/)
* Github page: [https://github.com/stephenhky/pyqentangle](https://github.com/stephenhky/pyqentangle)
* PyPI page: [https://pypi.python.org/pypi/pyqentangle/](https://pypi.python.org/pypi/pyqentangle/)
* Documentation: [http://pyqentangle.readthedocs.io/](http://pyqentangle.readthedocs.io/)
* RQEntangle: [https://CRAN.R-project.org/package=RQEntangle](https://CRAN.R-project.org/package=RQEntangle) (corresponding R library)

## Reference
* Artur Ekert, Peter L. Knight, "Entangled quantum systems and the Schmidt decomposition", *Am. J. Phys.* 63, 415 (1995).

## Acknowledgement
* [Hossein Seifoory](https://ca.linkedin.com/in/hosseinseifoory?trk=public_profile_card_url)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyqentangle",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "quantum physics, quantum information, Schmidt decomposition, entanglement",
    "author": null,
    "author_email": "Kwan Yuet Stephen Ho <stephenhky@yahoo.com.hk>",
    "download_url": "https://files.pythonhosted.org/packages/fa/a2/ac8174a8f3e72537eae5927644d21d55f5b8bb5d6aca044e9ea5d7a88903/pyqentangle-4.0.3.tar.gz",
    "platform": null,
    "description": "# Quantum Entanglement in Python\n\n[![CircleCI](https://circleci.com/gh/stephenhky/pyqentangle.svg?style=svg)](https://circleci.com/gh/stephenhky/pyqentangle.svg)\n[![GitHub release](https://img.shields.io/github/release/stephenhky/pyqentangle.svg?maxAge=3600)](https://github.com/stephenhky/pyqentangle/releases)\n[![Documentation Status](https://readthedocs.org/projects/pyqentangle/badge/?version=latest)](https://pyqentangle.readthedocs.io/en/latest/?badge=latest)\n[![Updates](https://pyup.io/repos/github/stephenhky/pyqentangle/shield.svg)](https://pyup.io/repos/github/stephenhky/pyqentangle/)\n[![Python 3](https://pyup.io/repos/github/stephenhky/pyqentangle/python-3-shield.svg)](https://pyup.io/repos/github/stephenhky/pyqentangle/)\n[![pypi](https://img.shields.io/pypi/v/pyqentangle.svg?maxAge=3600)](https://pypi.org/project/pyqentangle/)\n[![download](https://img.shields.io/pypi/dm/pyqentangle.svg?maxAge=2592000&label=installs&color=%2327B1FF)](https://pypi.org/project/pyqentangle/)\n\n## Version\n\nThe releases of `pyqentangle` 2.x.x is incompatible with previous releases.\n\nThe releases of `pyqentangle` 3.x.x is incompatible with previous releases.\n\nSince release 3.1.0, the support for Python 2.7 and 3.5 has been decomissioned.\nSince release 3.3.0, support for Python 3.6 is diminished, but that for Python 3.11 is added.\n\n## Installation\n\nThis package can be installed using `pip`.\n\n```\n>>> pip install pyqentangle\n```\n\nTo use it, enter\n\n```\n>>> import pyqentangle\n>>> import numpy as np\n```\n\n## Schmidt Decomposition for Discrete Bipartite States\n\nWe first express the bipartite state in terms of a tensor. For example, if the state is `|01>+|10>`, then express it as\n\n```\n>>> tensor = np.array([[0., np.sqrt(0.5)], [np.sqrt(0.5), 0.]])\n```\n\nTo perform the Schmidt decompostion, just enter:\n\n```\n>>> pyqentangle.schmidt_decomposition(tensor)\n[(0.7071067811865476, array([ 0., -1.]), array([-1., -0.])),\n (0.7071067811865476, array([-1.,  0.]), array([-0., -1.]))]\n ```\n\nFor each tuple in the returned list, the first element is the Schmidt coefficients, the second the component for first subsystem, and the third the component for the second subsystem.\n\n## Schmidt Decomposition for Continuous Bipartite States\n\nWe can perform Schmidt decomposition on continuous systems too. For example, define the following normalized wavefunction:\n\n```\n>>> fcn = lambda x1, x2: np.exp(-0.5 * (x1 + x2) ** 2) * np.exp(-(x1 - x2) ** 2) * np.sqrt(np.sqrt(8.) / np.pi)\n```\n\nThen perform the Schmidt decomposition, \n\n```\n>>> modes = pyqentangle.continuous_schmidt_decomposition(biwavefcn, -10., 10., -10., 10., keep=10)\n```\n\nwhere it describes the ranges of x1 and x2 respectively, and `keep=10` specifies only top 10 Schmidt modes are kept. Then we can read the Schmidt coefficients:\n\n```\n>>> list(map(lambda dec: dec[0], modes))\n[0.9851714310094161,\n 0.1690286950361957,\n 0.02900073920775954,\n 0.004975740210361192,\n 0.0008537020544076649,\n 0.00014647211608480773,\n 2.51306421011773e-05,\n 4.311736522272035e-06,\n 7.39777032460608e-07,\n 1.2692567250688184e-07]\n```\n\nThe second and the third elements in each tuple in the list `decompositions` are lambda functions for the modes of susbsystems A and B respectively. The Schmidt functions can be plotted:\n```\n>>> xarray = np.linspace(-10., 10., 100)\n\n    plt.subplot(3, 2, 1)\n    plt.plot(xarray, modes[0][1](xarray))\n    plt.subplot(3, 2, 2)\n    plt.plot(xarray, modes[0][2](xarray))\n\n    plt.subplot(3, 2, 3)\n    plt.plot(xarray, modes[1][1](xarray))\n    plt.subplot(3, 2, 4)\n    plt.plot(xarray, modes[1][2](xarray))\n\n    plt.subplot(3, 2, 5)\n    plt.plot(xarray, modes[2][1](xarray))\n    plt.subplot(3, 2, 6)\n    plt.plot(xarray, modes[2][2](xarray))\n```\n\n![alt](https://github.com/stephenhky/pyqentangle/raw/master/fig/three_harmonic_modes.png)\n\n\n## Useful Links\n\n* Study of Entanglement in Quantum Computers: [https://datawarrior.wordpress.com/2017/09/20/a-first-glimpse-of-rigettis-quantum-computing-cloud/](https://datawarrior.wordpress.com/2017/09/20/a-first-glimpse-of-rigettis-quantum-computing-cloud/)\n* Github page: [https://github.com/stephenhky/pyqentangle](https://github.com/stephenhky/pyqentangle)\n* PyPI page: [https://pypi.python.org/pypi/pyqentangle/](https://pypi.python.org/pypi/pyqentangle/)\n* Documentation: [http://pyqentangle.readthedocs.io/](http://pyqentangle.readthedocs.io/)\n* RQEntangle: [https://CRAN.R-project.org/package=RQEntangle](https://CRAN.R-project.org/package=RQEntangle) (corresponding R library)\n\n## Reference\n* Artur Ekert, Peter L. Knight, \"Entangled quantum systems and the Schmidt decomposition\", *Am. J. Phys.* 63, 415 (1995).\n\n## Acknowledgement\n* [Hossein Seifoory](https://ca.linkedin.com/in/hosseinseifoory?trk=public_profile_card_url)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Quantum Entanglement in Python",
    "version": "4.0.3",
    "project_urls": {
        "Documentation": "http://pyqentangle.readthedocs.io",
        "Issues": "https://github.com/stephenhky/pyqentangle/issues",
        "Repository": "https://github.com/stephenhky/pyqentangle"
    },
    "split_keywords": [
        "quantum physics",
        " quantum information",
        " schmidt decomposition",
        " entanglement"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0212156e18aa4ae63354a84cc2822843bafce2cbe88655031cb17065d1caac00",
                "md5": "f0e814405685004fb6a4cbf9231cb17c",
                "sha256": "acc5370615041afa1595df8c398b7c109a9b7aa50b7b7710b7d39099fd7b2fb1"
            },
            "downloads": -1,
            "filename": "pyqentangle-4.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f0e814405685004fb6a4cbf9231cb17c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11968,
            "upload_time": "2024-09-23T18:33:44",
            "upload_time_iso_8601": "2024-09-23T18:33:44.700864Z",
            "url": "https://files.pythonhosted.org/packages/02/12/156e18aa4ae63354a84cc2822843bafce2cbe88655031cb17065d1caac00/pyqentangle-4.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "faa2ac8174a8f3e72537eae5927644d21d55f5b8bb5d6aca044e9ea5d7a88903",
                "md5": "8707cc7ce85feeb02c6f735722f2dd14",
                "sha256": "5ebcf07513dc93d745500d676e19a22ec1877a2b601a5f8d69ec5386f9000ffd"
            },
            "downloads": -1,
            "filename": "pyqentangle-4.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "8707cc7ce85feeb02c6f735722f2dd14",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 14626,
            "upload_time": "2024-09-23T18:33:46",
            "upload_time_iso_8601": "2024-09-23T18:33:46.001655Z",
            "url": "https://files.pythonhosted.org/packages/fa/a2/ac8174a8f3e72537eae5927644d21d55f5b8bb5d6aca044e9ea5d7a88903/pyqentangle-4.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-23 18:33:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "stephenhky",
    "github_project": "pyqentangle",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "lcname": "pyqentangle"
}
        
Elapsed time: 0.37223s