Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare the qutip-qip-0.3.1 release #233

Merged
merged 11 commits into from
Apr 21, 2024
3 changes: 2 additions & 1 deletion .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ jobs:
- uses: psf/black@stable
with:
options: "--check --diff"
src: "./src"
src: "./src"
version: "~= 24.0"
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
# For the sdist we should be as conservative as possible with our
# Python version. This should be the lowest supported version. This
# means that no unsupported syntax can sneak through.
python-version: '3.7'
python-version: '3.11'

- name: Install pip build
run: |
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
name: Install Python
with:
# This is about the build environment, not the released wheel version.
python-version: '3.7'
python-version: '3.11'

- name: Install pip build
run: |
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.7'
python-version: '3.11'

- name: Verify this is not a dev version
shell: bash
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'

- name: Install Pandoc
run: |
Expand All @@ -27,7 +27,8 @@ jobs:

- name: Install qutip-qip from GitHub
run: |
python -mpip install -e .[full]
python -mpip install qutip==4.7.3
python -mpip install -e .
# Install in editable mode so it doesn't matter if we import from
# inside the installation directory, otherwise we can get some errors
# because we're importing from the wrong location.
Expand Down
37 changes: 13 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
strategy:
matrix:
include:
- case-name: [email protected].0a1
- case-name: [email protected].0
os: ubuntu-latest
qutip-version: '==5.0.0a1'
qutip-version: '==5.0.0'
pyqir-version: ''
python-version: '3.10'
python-version: '3.11'
- case-name: [email protected]
os: ubuntu-latest
qutip-version: '@qutip-4.7.X'
Expand All @@ -26,37 +26,31 @@ jobs:
os: ubuntu-latest
qutip-version: '@master'
pyqir-version: ''
python-version: '3.11'
- case-name: [email protected]
os: windows-latest
qutip-version: '==4.6.*'
qiskit-version: ''
pyqir-version: ''
python-version: '3.8'
python-version: '3.12'
- case-name: [email protected]
os: macOS-latest
qutip-version: '==4.7.*'
qiskit-version: ''
pyqir-version: ''
python-version: '3.9'
python-version: '3.11'
- case-name: qiskit+qir
os: windows-latest
qutip-version: ''
qiskit-version: '==0.36.*'
qiskit-version: '==0.46.*'
pyqir-version: '==0.6.2'
python-version: '3.8'
python-version: '3.9'
- case-name: qiskit+qir
os: macOS-latest
qutip-version: ''
qiskit-version: '==0.36.*'
qiskit-version: '==0.46.*'
pyqir-version: '==0.6.2'
python-version: '3.9'
- case-name: qiskit+qir
os: ubuntu-latest
qutip-version: ''
qiskit-version: '==0.36.*'
qiskit-version: '==0.46.*'
pyqir-version: '==0.6.2'
python-version: '3.7'
python-version: '3.9'

steps:
- uses: actions/checkout@v3
Expand All @@ -75,15 +69,9 @@ jobs:
python -m pip install numpy scipy cython
python -m pip install 'git+https://github.com/qutip/qutip.git${{ matrix.qutip-version }}'

# For qutip-v5 qutip.control is replaced by qutip-qtrl
- name: Install qutip-qtrl from PyPI
if: ${{ matrix.qutip-version == '@master'}}
run: |
python -m pip install 'git+https://github.com/qutip/qutip-qtrl.git'

- name: Install Qiskit from PyPI
if: ${{ matrix.qiskit-version != '' }}
run: python -m pip install 'qiskit${{ matrix.qiskit-version }}'
run: python -m pip install 'qiskit${{ matrix.qiskit-version }}' 'qiskit-aer==0.14.0.1'

- name: Install PyQIR from PyPI
if: ${{ matrix.pyqir-version != '' }}
Expand Down Expand Up @@ -112,11 +100,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -mpip install -r doc/requirements.txt
pip install qutip==4.7.3
pip install .
- name: Test code snippets in the documentation
run: |
Expand Down
23 changes: 19 additions & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
# File: .readthedocs.yaml
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build from the doc/ directory with Sphinx
# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.10"
apt_packages:
- pandoc
jobs:
pre_build:
# Each command is executed in a new shell process
- cd doc; python source/tutorials-website/create_tutorials_html.py

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: doc/source/conf.py

# Explicitly set the version of Python and its requirements
# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
version: 3.8
install:
- requirements: doc/requirements.txt
- method: pip
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The qutip-qip package, QuTiP quantum information processing, aims at providing b
Compared to other libraries for quantum information processing, qutip-qip puts additional emphasis on the physics layer and the interaction with the QuTiP package.
The package offers two different approaches for simulating quantum circuits, one with `QubitCircuit` calculating unitary evolution under quantum gates by matrix product, another called `Processor` using open system solvers in QuTiP to simulate noisy quantum device.

If you would like to know the future development plan and ideas, have a look at the [discussion panel](https://github.com/qutip/qutip-qip/discussions) as well as the [qutip documentation for ideas](https://qutip.org/docs/latest/development/ideas.html).
If you would like to know the future development plan and ideas, have a look at the [discussion panel](https://github.com/qutip/qutip-qip/discussions) as well as the [qutip documentation for ideas](https://qutip.readthedocs.io/en/stable/development/ideas.html).

Quick start
-----------
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.0
0.3.1
5 changes: 3 additions & 2 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
numpy==1.22.4
scipy==1.10.0
qutip==4.7.0
qutip==4.7.3
cython==0.29.30
sphinx==5.0.2
sphinx_rtd_theme==1.0.0
Expand All @@ -11,4 +11,5 @@ docutils==0.17.1
sphinxcontrib-bibtex==2.4.2
pyqir-generator==0.6.2
pyqir-parser==0.6.2
qiskit==0.37.2
qiskit==0.46.1
qiskit-aer==0.14.0.1
17 changes: 17 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@ Changelog
*********


Version 0.3.1 (April 21, 2024)
++++++++++++++++++++++++++++++

Improvements
------------
- Update qiskit support version to ``0.46.*`` (`#232 <https://github.com/qutip/qutip-qip/pull/232>`_)

Bug Fixes
---------
- Remove comments after meaningful statements in QASM reader. (`#218 <https://github.com/qutip/qutip-qip/pull/218>`_ by NoriyukiK-1qbit)
- Fix circuit plot error for gates with classical controls when ``reverse_states=False``. (`#221 <https://github.com/qutip/qutip-qip/pull/221>`_ by Kevin P. O'Brien)
- Update the RTD configuration file to execute ``create_tutorials_html.py`` (`#222 <https://github.com/qutip/qutip-qip/pull/222>`_, reported by Ramyashri Padmanabhakumar)
- Remove the unnecessary use of circuit.propagatos (`#226 <https://github.com/qutip/qutip-qip/pull/226>`_)
- Use CSR as default for ``expand_operator`` (`#227 <https://github.com/qutip/qutip-qip/pull/227>`_)
- Update the parsing mode for ``read_qasm`` (`#224 <https://github.com/qutip/qutip-qip/pull/224>`_ reported by kevinab107)


Version 0.3.0 (July 19, 2023)
+++++++++++++++++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,5 @@ def qutip_qip_version():
# -- Options for intersphinx ---------------------------------------

intersphinx_mapping = {
'qutip': ('https://qutip.org/docs/latest/', None),
'qutip': ('https://qutip.readthedocs.io/en/stable/', None),
}
2 changes: 1 addition & 1 deletion doc/source/contribution-code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Contributing to the source code
Build up an development environment
===================================

Please follow the instruction on the `QuTiP contribution guide <https://qutip.org/docs/latest/development/contributing.html#building>`_ to
Please follow the instruction on the `QuTiP contribution guide <https://qutip.readthedocs.io/en/stable/development/contributing.html#building>`_ to
build a conda environment.
You don't need to build ``qutip`` in the editable mode unless you also want to contribute to `qutip`.
Instead, you need to install ``qutip-qip`` by downloading the source code and run
Expand Down
2 changes: 1 addition & 1 deletion doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Prerequisites
This package is built upon QuTiP, of which the installation guide can be found at on `QuTiP Installation <http://qutip.org/docs/latest/installation.html>`_.
The only difference is that C++ compilers are not required here
since there is no run-time compiling for qutip-qip.
The minimal Python version supported is Python 3.7.
The minimal Python version supported is Python 3.9.


In particular, following packages are necessary for running qutip-qip
Expand Down
2 changes: 1 addition & 1 deletion doc/source/tutorials-website/tutorials.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>

<h4 id="quantum-information-processing">Quantum information processing</h4>
<p>This section contains tutorials for QuTiP Version 5. You can find the tutorials for QuTiP Version 4 <a href="https://qutip.org/qutip-tutorials/">here</a>. To check the version of QuTiP, you can use the <code>qutip.about()</code> command.</p>
<p>This section contains tutorials for QuTiP Version 5. You can find the tutorials for QuTiP Version 4 <a href="https://qutip.org/qutip-tutorials/index-v4">here</a>. To check the version of QuTiP, you can use the <code>qutip.about()</code> command.</p>

<h5 id="qip-circuits">Quantum circuits and algorithms</h5>
<ul>
Expand Down
1 change: 0 additions & 1 deletion doc/source/w-state.qasm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Name of Experiment: W-state v1

OPENQASM 2.0;
include "qelib1.inc";


qreg q[3];
Expand Down
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ where = src

[options.extras_require]
graphics = matplotlib>=1.3.0
control = qutip-qtrl
tests =
pytest>=5.2
full =
%(graphics)s
%(tests)s
%(control)s
qiskit =
qiskit>=0.36.2
qiskit<1.0.0
qiskit_aer
1 change: 0 additions & 1 deletion src/qutip_qip/algorithms/qft.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
This module provides the circuit implementation for Quantum Fourier Transform.
"""


import numpy as np
from ..operations import Gate, snot, cphase, swap, expand_operator
from ..circuit import QubitCircuit
Expand Down
1 change: 1 addition & 0 deletions src/qutip_qip/circuit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Circuit representation and simulation at the gate level."""

from .circuit import *
from .circuit_latex import *
from .circuitsimulator import *
Expand Down
1 change: 1 addition & 0 deletions src/qutip_qip/circuit/_decompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Those decomposition functions should be moved to the
individual gate classes.
"""

import numpy as np
from ..operations import Gate

Expand Down
5 changes: 4 additions & 1 deletion src/qutip_qip/circuit/circuit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Quantum circuit representation and simulation.
"""

from collections.abc import Iterable
from itertools import product
import inspect
Expand Down Expand Up @@ -1013,7 +1014,9 @@ def latex_code(self):
gate.classical_controls
and (n - self.N) in gate.classical_controls
):
control_tag = n - gate.targets[0]
control_tag = (-1 if self.reverse_states else 1) * (
gate.targets[0] - n
)
col.append(r" \ctrl{%d} " % control_tag)

elif not gate.controls and not gate.targets:
Expand Down
1 change: 1 addition & 0 deletions src/qutip_qip/compat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
For the compatibility between qutip-v5 and v4.
"""

from itertools import chain
from functools import reduce
from packaging.version import parse as parse_version
Expand Down
1 change: 1 addition & 0 deletions src/qutip_qip/compiler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Compilers for the hardware models in :obj:`device`"""

from .instruction import Instruction
from .scheduler import Scheduler
from .gatecompiler import GateCompiler
Expand Down
1 change: 1 addition & 0 deletions src/qutip_qip/decompose/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Unitary decomposition. (experimental)"""

from .decompose_single_qubit_gate import *
1 change: 1 addition & 0 deletions src/qutip_qip/device/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Simulation of quantum hardware.
"""

from .processor import Processor, Model
from .modelprocessor import ModelProcessor
from .spinchain import (
Expand Down
1 change: 1 addition & 0 deletions src/qutip_qip/noise.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Noise of quantum hardware."""

import numbers
import warnings
from collections.abc import Iterable
Expand Down
1 change: 1 addition & 0 deletions src/qutip_qip/operations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Operations on quantum circuits.
"""

from .gates import *
from .gateclass import *
from .measurement import *
Loading
Loading