Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.2%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Basic Info
  • Host: GitHub
  • Owner: SWE-Gym-Raw
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 139 MB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • Open Issues: 6
  • Releases: 0
Created about 1 year ago · Last pushed 11 months ago
Metadata Files
Readme Contributing License Code of conduct Citation Codeowners Security

README.md

Qiskit

License <!--- long-description-skip-begin --> Current Release Extended Support Release Downloads Coverage Status PyPI - Python Version Minimum rustc 1.70 Downloads<!--- long-description-skip-end --> DOI

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.

This library is the core component of Qiskit, which contains the building blocks for creating and working with quantum circuits, quantum operators, and primitive functions (Sampler and Estimator). It also contains a transpiler that supports optimizing quantum circuits, and a quantum information toolbox for creating advanced operators.

For more details on how to use Qiskit, refer to the documentation located here:

https://docs.quantum.ibm.com/

Installation

[!WARNING] Do not try to upgrade an existing Qiskit 0.* environment to Qiskit 1.0 in-place. Read more.

We encourage installing Qiskit via pip:

bash pip install qiskit

Pip will handle all dependencies automatically and you will always install the latest (and well-tested) version.

To install from source, follow the instructions in the documentation.

Create your first quantum program in Qiskit

Now that Qiskit is installed, it's time to begin working with Qiskit. The essential parts of a quantum program are: 1. Define and build a quantum circuit that represents the quantum state 2. Define the classical output by measurements or a set of observable operators 3. Depending on the output, use the primitive function sampler to sample outcomes or the estimator to estimate values.

Create an example quantum circuit using the QuantumCircuit class:

```python import numpy as np from qiskit import QuantumCircuit

1. A quantum circuit for preparing the quantum state |000> + i |111>

qcexample = QuantumCircuit(3) qcexample.h(0) # generate superpostion qcexample.p(np.pi/2,0) # add quantum phase qcexample.cx(0,1) # 0th-qubit-Controlled-NOT gate on 1st qubit qc_example.cx(0,2) # 0th-qubit-Controlled-NOT gate on 2nd qubit ```

This simple example makes an entangled state known as a GHZ state $(|000\rangle + i|111\rangle)/\sqrt{2}$. It uses the standard quantum gates: Hadamard gate (h), Phase gate (p), and CNOT gate (cx).

Once you've made your first quantum circuit, choose which primitive function you will use. Starting with sampler, we use measure_all(inplace=False) to get a copy of the circuit in which all the qubits are measured:

```python

2. Add the classical output in the form of measurement of all qubits

qcmeasured = qcexample.measure_all(inplace=False)

3. Execute using the Sampler primitive

from qiskit.primitives import StatevectorSampler sampler = StatevectorSampler() job = sampler.run([qcmeasured], shots=1000) result = job.result() print(f" > Counts: {result[0].data["meas"].getcounts()}") `` Running this will give an outcome similar to{'000': 497, '111': 503}which is00050% of the time and11150% of the time up to statistical fluctuations. To illustrate the power of Estimator, we now use the quantum information toolbox to create the operator $XXY+XYX+YXX-YYY$ and pass it to therun()function, along with our quantum circuit. Note the Estimator requires a circuit _**without**_ measurement, so we use theqc_example` circuit we created earlier.

```python

2. Define the observable to be measured

from qiskit.quantuminfo import SparsePauliOp operator = SparsePauliOp.fromlist([("XXY", 1), ("XYX", 1), ("YXX", 1), ("YYY", -1)])

3. Execute using the Estimator primitive

from qiskit.primitives import StatevectorEstimator estimator = StatevectorEstimator() job = estimator.run([(qc_example, operator)], precision=1e-3) result = job.result() print(f" > Expectation values: {result[0].data.evs}") ```

Running this will give the outcome 4. For fun, try to assign a value of +/- 1 to each single-qubit operator X and Y and see if you can achieve this outcome. (Spoiler alert: this is not possible!)

Using the Qiskit-provided qiskit.primitives.StatevectorSampler and qiskit.primitives.StatevectorEstimator will not take you very far. The power of quantum computing cannot be simulated on classical computers and you need to use real quantum hardware to scale to larger quantum circuits. However, running a quantum circuit on hardware requires rewriting to the basis gates and connectivity of the quantum hardware. The tool that does this is the transpiler, and Qiskit includes transpiler passes for synthesis, optimization, mapping, and scheduling. However, it also includes a default compiler, which works very well in most examples. The following code will map the example circuit to the basis_gates = ['cz', 'sx', 'rz'] and a linear chain of qubits $0 \rightarrow 1 \rightarrow 2$ with the coupling_map =[[0, 1], [1, 2]].

python from qiskit import transpile qc_transpiled = transpile(qc_example, basis_gates = ['cz', 'sx', 'rz'], coupling_map =[[0, 1], [1, 2]] , optimization_level=3)

Executing your code on real quantum hardware

Qiskit provides an abstraction layer that lets users run quantum circuits on hardware from any vendor that provides a compatible interface. The best way to use Qiskit is with a runtime environment that provides optimized implementations of sampler and estimator for a given hardware platform. This runtime may involve using pre- and post-processing, such as optimized transpiler passes with error suppression, error mitigation, and, eventually, error correction built in. A runtime implements qiskit.primitives.BaseSamplerV2 and qiskit.primitives.BaseEstimatorV2 interfaces. For example, some packages that provide implementations of a runtime primitive implementation are:

  • https://github.com/Qiskit/qiskit-ibm-runtime

Qiskit also provides a lower-level abstract interface for describing quantum backends. This interface, located in qiskit.providers, defines an abstract BackendV2 class that providers can implement to represent their hardware or simulators to Qiskit. The backend class includes a common interface for executing circuits on the backends; however, in this interface each provider may perform different types of pre- and post-processing and return outcomes that are vendor-defined. Some examples of published provider packages that interface with real hardware are:

  • https://github.com/qiskit-community/qiskit-ionq
  • https://github.com/qiskit-community/qiskit-aqt-provider
  • https://github.com/qiskit-community/qiskit-braket-provider
  • https://github.com/qiskit-community/qiskit-quantinuum-provider
  • https://github.com/rigetti/qiskit-rigetti

You can refer to the documentation of these packages for further instructions on how to get access and use these systems.

Contribution Guidelines

If you'd like to contribute to Qiskit, please take a look at our contribution guidelines. By participating, you are expected to uphold our code of conduct.

We use GitHub issues for tracking requests and bugs. Please join the Qiskit Slack community for discussion, comments, and questions. For questions related to running or using Qiskit, Stack Overflow has a qiskit. For questions on quantum computing with Qiskit, use the qiskit tag in the Quantum Computing Stack Exchange (please, read first the guidelines on how to ask in that forum).

Authors and Citation

Qiskit is the work of many people who contribute to the project at different levels. If you use Qiskit, please cite as per the included BibTeX file.

Changelog and Release Notes

The changelog for a particular release is dynamically generated and gets written to the release page on Github for each release. For example, you can find the page for the 0.46.0 release here:

https://github.com/Qiskit/qiskit/releases/tag/0.46.0

The changelog for the current release can be found in the releases tab: Releases The changelog provides a quick overview of notable changes for a given release.

Additionally, as part of each release, detailed release notes are written to document in detail what has changed as part of a release. This includes any documentation on potential breaking changes on upgrade and new features. See all release notes here.

Acknowledgements

We acknowledge partial support for Qiskit development from the DOE Office of Science National Quantum Information Science Research Centers, Co-design Center for Quantum Advantage (C2QA) under contract number DE-SC0012704.

License

Apache License 2.0

Owner

  • Name: SWE-Gym-Raw
  • Login: SWE-Gym-Raw
  • Kind: organization
  • Email: jingmai@pku.edu.cn

Citation (CITATION.bib)

@misc{qiskit2024,
      title={Quantum computing with {Q}iskit},
      author={Javadi-Abhari, Ali and Treinish, Matthew and Krsulich, Kevin and Wood, Christopher J. and Lishman, Jake and Gacon, Julien and Martiel, Simon and Nation, Paul D. and Bishop, Lev S. and Cross, Andrew W. and Johnson, Blake R. and Gambetta, Jay M.},
      year={2024},
      doi={10.48550/arXiv.2405.08810},
      eprint={2405.08810},
      archivePrefix={arXiv},
      primaryClass={quant-ph}
}

GitHub Events

Total
  • Delete event: 5
  • Issue comment event: 28
  • Push event: 1
  • Pull request event: 16
  • Create event: 61
Last Year
  • Delete event: 5
  • Issue comment event: 28
  • Push event: 1
  • Pull request event: 16
  • Create event: 61

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 11
  • Average time to close issues: N/A
  • Average time to close pull requests: 25 days
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.45
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 11
Past Year
  • Issues: 0
  • Pull requests: 11
  • Average time to close issues: N/A
  • Average time to close pull requests: 25 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.45
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 11
Top Authors
Issue Authors
Pull Request Authors
  • dependabot[bot] (11)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

Cargo.lock cargo
  • 184 dependencies
Cargo.toml cargo
crates/accelerate/Cargo.toml cargo
crates/circuit/Cargo.toml cargo
crates/pyext/Cargo.toml cargo
crates/qasm2/Cargo.toml cargo
crates/qasm3/Cargo.toml cargo
.binder/environment.yml pypi
pyproject.toml pypi
requirements-dev.txt pypi
  • Sphinx >=6.0,<7.2 development
  • astroid ==3.2.2 development
  • black * development
  • coverage >=4.4.0 development
  • ddt >=1.2.0, development
  • hypothesis >=4.24.3 development
  • pylint ==3.2.3 development
  • reno >=4.1.0 development
  • ruff ==0.0.267 development
  • setuptools * development
  • setuptools-rust * development
  • sphinxcontrib-katex ==0.9.9 development
  • stestr >=2.0.0, development
  • threadpoolctl * development
requirements-optional.txt pypi
  • cvxpy *
  • fixtures *
  • ipython *
  • matplotlib >=3.3
  • pillow >=4.2.1
  • pydot *
  • pylatexenc >=1.4
  • python-constraint >=1.4
  • qiskit-aer *
  • qiskit-qasm3-import >=0.5.0
  • scikit-learn >=0.20.0
  • seaborn >=0.9.0
  • testtools *
  • tweedledum *
  • z3-solver >=4.7
requirements.txt pypi
  • dill >=0.3
  • numpy >=1.17,<3
  • python-dateutil >=2.8.0
  • rustworkx >=0.15.0
  • scipy >=1.5
  • stevedore >=3.0.0
  • symengine >=0.11,<0.14
  • sympy >=1.3
  • typing-extensions *
setup.py pypi