deepquantum


Namedeepquantum JSON
Version 3.3.1 PyPI version JSON
download
home_pageNone
SummaryDeepQuantum for quantum computing
upload_time2024-10-25 11:32:43
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/06/ee/30fbedf749f382d8ba5647de135a8fcac3cf63e10e19d0d8231ccb1f7545/deepquantum-3.3.1.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.1",
    "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": "df9bc8995da7ea83c01ea5405c544933542e0781fa176099cece507a93af7661",
                "md5": "3f92883d65d9f196cf7ea0e6dfbc277b",
                "sha256": "6efffe8dfd09185e09ac073c205531ee3cdbc26b92c85149469cba680545d45d"
            },
            "downloads": -1,
            "filename": "deepquantum-3.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f92883d65d9f196cf7ea0e6dfbc277b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 156146,
            "upload_time": "2024-10-25T11:32:41",
            "upload_time_iso_8601": "2024-10-25T11:32:41.551552Z",
            "url": "https://files.pythonhosted.org/packages/df/9b/c8995da7ea83c01ea5405c544933542e0781fa176099cece507a93af7661/deepquantum-3.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "06ee30fbedf749f382d8ba5647de135a8fcac3cf63e10e19d0d8231ccb1f7545",
                "md5": "dcbe725407b37119d8f502e56a7f8bdb",
                "sha256": "5934306c61d5bd2d14f6a41d47ed397a2dcedab39454370331b5991663b7765f"
            },
            "downloads": -1,
            "filename": "deepquantum-3.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "dcbe725407b37119d8f502e56a7f8bdb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 149439,
            "upload_time": "2024-10-25T11:32:43",
            "upload_time_iso_8601": "2024-10-25T11:32:43.280096Z",
            "url": "https://files.pythonhosted.org/packages/06/ee/30fbedf749f382d8ba5647de135a8fcac3cf63e10e19d0d8231ccb1f7545/deepquantum-3.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-25 11:32:43",
    "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.50269s