deepquantum


Namedeepquantum JSON
Version 3.3.0 PyPI version JSON
download
home_pageNone
SummaryDeepQuantum for quantum computing
upload_time2024-09-27 09:54:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords quantum computing quantum machine learning photonic quantum computing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DeepQuantum

<p align="center">
  <a href="https://github.com/TuringQ/deepquantum">
    <img width=70% src="docs/assets/deepquantum_logo_light_v1.png" alt="DeepQuantum logo"/>
  </a>
</p>

[![docs](https://img.shields.io/badge/docs-link-blue.svg)](https://dqapi.turingq.com/)
[![PyPI](https://img.shields.io/pypi/v/deepquantum.svg?logo=pypi)](https://pypi.org/project/deepquantum/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/deepquantum)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?logo=apache)](./LICENSE)
[![Downloads](https://img.shields.io/pypi/dm/deepquantum.svg)](https://pypi.org/project/deepquantum/)
[![Downloads](https://static.pepy.tech/badge/deepquantum)](https://pepy.tech/project/deepquantum)

DeepQuantum is a platform that integrates artificial intelligence (AI) and quantum computing (QC). It is an efficient programming framework designed for quantum machine learning and photonic quantum computing. By leveraging the PyTorch deep learning platform for QC, DeepQuantum provides a powerful and easy-to-use tool for creating and simulating quantum circuits and photonic quantum circuits. This makes it ideal for developers to quickly get started and explore the field in depth. It also serves as a valuable learning platform for quantum computing enthusiasts.

# Key Features

- **AI-Enhanced Quantum Computing Framework**: Seamlessly integrated with PyTorch, it utilizes technologies such as automatic differentiation, vectorized parallelism, and GPU acceleration for efficiency. It facilitates the easy construction of hybrid quantum-classical models, enabling end-to-end training and inference.
- **User-Friendly API Design**: The API is designed to be simple and intuitive, making it easy to initialize quantum neural networks and providing flexibility in data encoding.
- **Photonic Quantum Computing Simulation**: The Photonic module includes both Fock and Gaussian backends, catering to different simulation needs in photonic quantum computing. It comes with built-in optimizers to support on-chip training of photonic quantum circuits.
- **Large-Scale Quantum Circuit Simulation**: Based on tensor networks, it enables the simulation of 100+ qubits on a laptop, leading the industry in both simulation efficiency and scale.

# Installation

Before installing DeepQuantum, we recommend first manually installing PyTorch 2.
If the latest version of PyTorch is not compatible with your CUDA version, manually install a compatible PyTorch 2 version.

The PyTorch installation instructions currently recommend:
1. Install [Miniconda](https://docs.anaconda.com/miniconda/) or [Anaconda](https://www.anaconda.com/download).
2. Setup conda environment. For example, run `conda create -n <ENV_NAME> python=3.10` and `conda activate <ENV_NAME>`.
3. Install PyTorch following the [PyTorch installation instructions](https://pytorch.org/get-started/locally/).
Currently, this suggests running `conda install pytorch -c pytorch`.

If you want to customize your installation, please follow the [PyTorch installation instructions](https://pytorch.org/get-started/locally/) to build from source.

To install DeepQuantum with `pip`, run

```bash
pip install deepquantum
# or for developers
pip install deepquantum[dev]
# or use tsinghua source
pip install deepquantum -i https://pypi.tuna.tsinghua.edu.cn/simple
```

Alternatively, to install DeepQuantum from source, run

```bash
git clone https://github.com/TuringQ/deepquantum.git
cd deepquantum
pip install -e .
# or use tsinghua source
pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple
```

# Getting Started

To begin, please start with the tutorial on [basics](./docs/basics.ipynb).

Below are some minimal demos to help you get started.

- Quantum circuit

```python
import deepquantum as dq
cir = dq.QubitCircuit(2)
cir.h(0)
cir.cnot(0, 1)
cir.rx(1, 0.2)
cir.observable(0)
print(cir())
print(cir.expectation())
```

- Quantum circuit based on matrix product state

You can simply set `mps=True` in `QubitCircuit` and adjust the bond dimension `chi` to control the complexity.

```python
cir = dq.QubitCircuit(2, mps=True, chi=4)
cir.h(0)
cir.cnot(0, 1)
cir.rx(1, 0.2)
cir.observable(0)
print(cir())
print(cir.expectation())
```

- Photonic quantum circuit with the Fock backend, based on Fock basis state

```python
cir = dq.QumodeCircuit(2, [1,1])
cir.dc([0,1])
cir.ps(0, 0.1)
cir.bs([0,1], [0.2,0.3])
print(cir())
print(cir.measure())
```

- Photonic quantum circuit with the Fock backend, based on Fock state tensor

```python
cir = dq.QumodeCircuit(2, [(1, [1,1])], basis=False)
cir.dc([0,1])
cir.ps(0, 0.1)
cir.bs([0,1], [0.2,0.3])
print(cir())
print(cir.measure())
```

- Photonic quantum circuit with the Gaussian backend

```python
cir = dq.QumodeCircuit(2, 'vac', cutoff=10, backend='gaussian')
cir.s(0, 0.1)
cir.d(1, 0.1)
cir.bs([0,1], [0.2,0.3])
print(cir())
print(cir.measure())
print(cir.photon_number_mean_var(wires=0))
print(cir.measure_homodyne(wires=1))
```

# License

DeepQuantum is open source, released under the Apache License, Version 2.0.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "deepquantum",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Junjie He <hejunjie@turingq.com>",
    "keywords": "quantum computing, quantum machine learning, photonic quantum computing",
    "author": null,
    "author_email": "TuringQ <Algorithms-Applications@turingq.com>, Junjie He <hejunjie@turingq.com>, Keming Hu <hukeming@turingq.com>, Yuze Zhu <zhuyuze@turingq.com>",
    "download_url": "https://files.pythonhosted.org/packages/03/bb/c3d8c19c4abb46a3a7bb0808a108454b0d3155cbc0ff7831b819b113b332/deepquantum-3.3.0.tar.gz",
    "platform": null,
    "description": "# DeepQuantum\n\n<p align=\"center\">\n  <a href=\"https://github.com/TuringQ/deepquantum\">\n    <img width=70% src=\"docs/assets/deepquantum_logo_light_v1.png\" alt=\"DeepQuantum logo\"/>\n  </a>\n</p>\n\n[![docs](https://img.shields.io/badge/docs-link-blue.svg)](https://dqapi.turingq.com/)\n[![PyPI](https://img.shields.io/pypi/v/deepquantum.svg?logo=pypi)](https://pypi.org/project/deepquantum/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/deepquantum)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?logo=apache)](./LICENSE)\n[![Downloads](https://img.shields.io/pypi/dm/deepquantum.svg)](https://pypi.org/project/deepquantum/)\n[![Downloads](https://static.pepy.tech/badge/deepquantum)](https://pepy.tech/project/deepquantum)\n\nDeepQuantum is a platform that integrates artificial intelligence (AI) and quantum computing (QC). It is an efficient programming framework designed for quantum machine learning and photonic quantum computing. By leveraging the PyTorch deep learning platform for QC, DeepQuantum provides a powerful and easy-to-use tool for creating and simulating quantum circuits and photonic quantum circuits. This makes it ideal for developers to quickly get started and explore the field in depth. It also serves as a valuable learning platform for quantum computing enthusiasts.\n\n# Key Features\n\n- **AI-Enhanced Quantum Computing Framework**: Seamlessly integrated with PyTorch, it utilizes technologies such as automatic differentiation, vectorized parallelism, and GPU acceleration for efficiency. It facilitates the easy construction of hybrid quantum-classical models, enabling end-to-end training and inference.\n- **User-Friendly API Design**: The API is designed to be simple and intuitive, making it easy to initialize quantum neural networks and providing flexibility in data encoding.\n- **Photonic Quantum Computing Simulation**: The Photonic module includes both Fock and Gaussian backends, catering to different simulation needs in photonic quantum computing. It comes with built-in optimizers to support on-chip training of photonic quantum circuits.\n- **Large-Scale Quantum Circuit Simulation**: Based on tensor networks, it enables the simulation of 100+ qubits on a laptop, leading the industry in both simulation efficiency and scale.\n\n# Installation\n\nBefore installing DeepQuantum, we recommend first manually installing PyTorch 2.\nIf the latest version of PyTorch is not compatible with your CUDA version, manually install a compatible PyTorch 2 version.\n\nThe PyTorch installation instructions currently recommend:\n1. Install [Miniconda](https://docs.anaconda.com/miniconda/) or [Anaconda](https://www.anaconda.com/download).\n2. Setup conda environment. For example, run `conda create -n <ENV_NAME> python=3.10` and `conda activate <ENV_NAME>`.\n3. Install PyTorch following the [PyTorch installation instructions](https://pytorch.org/get-started/locally/).\nCurrently, this suggests running `conda install pytorch -c pytorch`.\n\nIf you want to customize your installation, please follow the [PyTorch installation instructions](https://pytorch.org/get-started/locally/) to build from source.\n\nTo install DeepQuantum with `pip`, run\n\n```bash\npip install deepquantum\n# or for developers\npip install deepquantum[dev]\n# or use tsinghua source\npip install deepquantum -i https://pypi.tuna.tsinghua.edu.cn/simple\n```\n\nAlternatively, to install DeepQuantum from source, run\n\n```bash\ngit clone https://github.com/TuringQ/deepquantum.git\ncd deepquantum\npip install -e .\n# or use tsinghua source\npip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple\n```\n\n# Getting Started\n\nTo begin, please start with the tutorial on [basics](./docs/basics.ipynb).\n\nBelow are some minimal demos to help you get started.\n\n- Quantum circuit\n\n```python\nimport deepquantum as dq\ncir = dq.QubitCircuit(2)\ncir.h(0)\ncir.cnot(0, 1)\ncir.rx(1, 0.2)\ncir.observable(0)\nprint(cir())\nprint(cir.expectation())\n```\n\n- Quantum circuit based on matrix product state\n\nYou can simply set `mps=True` in `QubitCircuit` and adjust the bond dimension `chi` to control the complexity.\n\n```python\ncir = dq.QubitCircuit(2, mps=True, chi=4)\ncir.h(0)\ncir.cnot(0, 1)\ncir.rx(1, 0.2)\ncir.observable(0)\nprint(cir())\nprint(cir.expectation())\n```\n\n- Photonic quantum circuit with the Fock backend, based on Fock basis state\n\n```python\ncir = dq.QumodeCircuit(2, [1,1])\ncir.dc([0,1])\ncir.ps(0, 0.1)\ncir.bs([0,1], [0.2,0.3])\nprint(cir())\nprint(cir.measure())\n```\n\n- Photonic quantum circuit with the Fock backend, based on Fock state tensor\n\n```python\ncir = dq.QumodeCircuit(2, [(1, [1,1])], basis=False)\ncir.dc([0,1])\ncir.ps(0, 0.1)\ncir.bs([0,1], [0.2,0.3])\nprint(cir())\nprint(cir.measure())\n```\n\n- Photonic quantum circuit with the Gaussian backend\n\n```python\ncir = dq.QumodeCircuit(2, 'vac', cutoff=10, backend='gaussian')\ncir.s(0, 0.1)\ncir.d(1, 0.1)\ncir.bs([0,1], [0.2,0.3])\nprint(cir())\nprint(cir.measure())\nprint(cir.photon_number_mean_var(wires=0))\nprint(cir.measure_homodyne(wires=1))\n```\n\n# License\n\nDeepQuantum is open source, released under the Apache License, Version 2.0.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "DeepQuantum for quantum computing",
    "version": "3.3.0",
    "project_urls": {
        "Documentation": "https://dqapi.turingq.com/",
        "Homepage": "https://deepquantum.turingq.com/",
        "Issues": "https://github.com/TuringQ/deepquantum/issues",
        "Repository": "https://github.com/TuringQ/deepquantum.git"
    },
    "split_keywords": [
        "quantum computing",
        " quantum machine learning",
        " photonic quantum computing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9f84811ff020848ebad9d07e1079e59f7e0daf17e4842d0f0a70b6e9ddcba8b2",
                "md5": "6b5e0137f0bfe90d0d160e633875169b",
                "sha256": "cb8f0164c0520b42ee65e69e17c4279b9538b039bd5cb5872158aff18ca7ce7c"
            },
            "downloads": -1,
            "filename": "deepquantum-3.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6b5e0137f0bfe90d0d160e633875169b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 155068,
            "upload_time": "2024-09-27T09:54:17",
            "upload_time_iso_8601": "2024-09-27T09:54:17.297451Z",
            "url": "https://files.pythonhosted.org/packages/9f/84/811ff020848ebad9d07e1079e59f7e0daf17e4842d0f0a70b6e9ddcba8b2/deepquantum-3.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "03bbc3d8c19c4abb46a3a7bb0808a108454b0d3155cbc0ff7831b819b113b332",
                "md5": "4a7b5db797bb8ce10245f23e6aa6f304",
                "sha256": "9bb012aaba4fb669ff2c2507d10afa3a6b635bb3eacf2c71616c0eb2ba33b518"
            },
            "downloads": -1,
            "filename": "deepquantum-3.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4a7b5db797bb8ce10245f23e6aa6f304",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 148483,
            "upload_time": "2024-09-27T09:54:18",
            "upload_time_iso_8601": "2024-09-27T09:54:18.592853Z",
            "url": "https://files.pythonhosted.org/packages/03/bb/c3d8c19c4abb46a3a7bb0808a108454b0d3155cbc0ff7831b819b113b332/deepquantum-3.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-27 09:54:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TuringQ",
    "github_project": "deepquantum",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "deepquantum"
}
        
Elapsed time: 0.97319s