Giter Site home page Giter Site logo

qiskit / qiskit.org Goto Github PK

View Code? Open in Web Editor NEW
102.0 102.0 111.0 464.71 MB

The Qiskit official website

Home Page: https://qiskit.org

License: Apache License 2.0

HTML 0.02% JavaScript 0.23% Shell 0.18% Vue 46.17% TypeScript 50.56% SCSS 2.71% Dockerfile 0.13%
quantum-computing

qiskit.org's Introduction

Qiskit

License Current Release Extended Support Release Downloads Coverage Status PyPI - Python Version Minimum rustc 1.70 Downloads 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 quantum 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:

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:

import numpy as np
from qiskit import QuantumCircuit

# 1. A quantum circuit for preparing the quantum state |000> + i |111>
qc_example = QuantumCircuit(3)
qc_example.h(0)          # generate superpostion
qc_example.p(np.pi/2,0)  # add quantum phase
qc_example.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:

# 2. Add the classical output in the form of measurement of all qubits
qc_measured = qc_example.measure_all(inplace=False)

# 3. Execute using the Sampler primitive
from qiskit.primitives.sampler import Sampler
sampler = Sampler()
job = sampler.run(qc_measured, shots=1000)
result = job.result()
print(f" > Quasi probability distribution: {result.quasi_dists}")

Running this will give an outcome similar to {0: 0.497, 7: 0.503} which is 000 50% of the time and 111 50% 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 the run() function, along with our quantum circuit. Note the Estimator requires a circuit without measurement, so we use the qc_example circuit we created earlier.

# 2. Define the observable to be measured 
from qiskit.quantum_info import SparsePauliOp
operator = SparsePauliOp.from_list([("XXY", 1), ("XYX", 1), ("YXX", 1), ("YYY", -1)])

# 3. Execute using the Estimator primitive
from qiskit.primitives import Estimator
estimator = Estimator()
job = estimator.run(qc_example, operator, shots=1000)
result = job.result()
print(f" > Expectation values: {result.values}")

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.Sampler and qiskit.primitives.Estimator 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 them 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]].

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.BaseSampler and qiskit.primitives.BaseEstimator interfaces. For example, some packages that provide implementations of a runtime primitive implementation are:

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:

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

qiskit.org's People

Contributors

1ucian0 avatar abdonrd avatar asierarranz avatar carlosazaustre avatar delapuente avatar dependabot[bot] avatar diego-plan9 avatar eddybrando avatar francabrera avatar frankharkins avatar hushaohan avatar ismaelfaro avatar javabster avatar jaygambetta avatar justjosie avatar kallieferguson avatar korgan00 avatar lerongil avatar mariacloehb avatar marinaaisa avatar memolina2323 avatar mtreinish avatar nonhermitian avatar paaragon avatar sooluthomas avatar tansito avatar techtolentino avatar tonimc avatar vabarbosa avatar y4izus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qiskit.org's Issues

Add Github button and Install section for Aqua GUI

As Aqua's GUI has been extracted out as a separate repo/package, the GUI section of the Aqua page likely needs the following two elements:

  • A Github button pointing to https://github.com/Qiskit/qiskit-aqua-interfaces

  • An Install section for pip install qiskit-aqua-interfaces

Where can I find key for qiskit quantum gates?

the only gates I saw in youtube are Hadamart and CNOT
when:
q = QuantumRegister(2)
c = ClassicalRegister(2)
qc = QuantumCircuit(q,c)
#hadamart
qc.h(q[0])
#CNOT
qc.cx(q[0],q[1])

I want to know how to write the gate U3=U3(theta,lambada,gama) in qiskit language
but I only find it on the Internet in Qasm language as: u3(theta,lambada,gama) iv`e tried it on qiskit but there is always error messege when I try to run the program.

Qiskit main page directs to "qiskit" search results rather than the "qiskit" tag on Stack Exchange

Hi, I'm a site moderator at Quantum Computing Stack Exchange. Is there any specific reason why the "Stack Exchange" link on the Qiskit main page directs to the "qiskit" search results page rather than the "qiskit" tag page? Note that the tag page is much more helpful for keeping track of the latest Qiskit questions on Quantum Computing SE. I personally maintain the tag, and it's very unlikely that any Qiskit-based question will be skipped there. Also, tags are extremely useful for search purposes cf. QCSE: How do I search?.

I've asked about this on the Qiskit Slack channel earlier; Ali Javadi replied that this indeed should be updated and that I should raise it as an issue here. I hope this will be fixed. Thanks!

Documentation link

Currently, when you press the documentation link in the head menu, open a new windows/tab.

We need to open in same page/tab.

Host Qiskit schemas on website

A major part of the 0.6 release will be defining and implementing a set of json schema. Can we host the schemas on qiskit.org/schemas, so that the backends and anyone else who needs to validate against them has a canonical place to read them from? Each schema has, at the top of it, the address where it will be hosted:
https://github.com/Qiskit/qiskit-terra/tree/master/qiskit/schemas

Some issues:

  • The schemas may change in Qiskit-Terra master. Can the website pull the latest one when they change?
  • Can we host previous versions as well?

put citation format on website

@abdonrod can you please put a section under "Don't know quantum circuits" and name it "Citation". Then write a sentence:

"If you use Qiskit, please cite it as per the included BibTeX file." And that link should open the bibtex entry in plaintext.

--

quickstart code fails on Windows

The example at https://www.qiskit.org/documentation/quickstart.html fails on Windows when trying to run on a local simulator. The issue appears to be related to how Windows handles multi-threading. I believe that putting the example code in a "if __name__ == 'main':" block would fix the problem for Windows users and would not hurt anyone running on other platforms. See further discussion at https://quantumexperience.ng.bluemix.net/qx/community/question?questionId=7569682980de4584ede629693e74ada8

Add Community Tab on header

Create a Community tab on qiskit.org to hold items from all our community related initiatives (qiskit camp, contribution guidelines, roadmap, community groups, etc.)

Update AQUAChemistry to AquaChemistry after v0.2.1

Reference: #42 (review)

from qiskit_aqua_chemistry import AQUAChemistry
aqua_chemistry_dict = {
"driver": { "name": "PYSCF" },
"PYSCF": { "atom": "", "basis": "sto3g" },
"operator": {
"name": "hamiltonian",
"qubit_mapping": "parity",
"two_qubit_reduction": True,
"freeze_core": True,
"orbital_reduction": [-3, -2]
},
"algorithm": { "name": "VQE" },
"optimizer": { "name": "COBYLA", "maxiter": 10000 },
"variational_form": { "name": "UCCSD" },
"initial_state": { "name": "HartreeFock" }
}
molecule = "H .0 .0 -{0}; Li .0 .0 {0}"
pts = [x * 0.1 for x in range(6, 20)]
pts += [x * 0.25 for x in range(8, 16)]
pts += [4.0]
energies = np.empty(len(pts))
distances = np.empty(len(pts))
dipoles = np.empty(len(pts))
for i, d in enumerate(pts):
aqua_chemistry_dict["PYSCF"]["atom"] = molecule.format(d/2)
solver = AQUAChemistry()

Documentation link router bug

When we do click on documentation link and we go back using the browser back button, the url on the navigation bar is changed but is not redirect to the previous url.

improve Ignis example style

Remove extra spaces in the example line:

from qiskit.ignis.verification.randomized_benchmarking import randomized_benchmarking_seq, RBFitter

image

Pull chemisty out of aqua

Can we make it so that the chemistry is a tab at the top.

Think of it as Qiskit | elements | components | tutorial | documentation | tools | fun.

The elements are terra, aer, aqua, ignis. I would make this a pull down
The components are chemistry, providers, (more to come).

The tools are (vscode, gui)
So in the tools i think we need submenus for vscode, chemistry gui, ...

Remove the tutorial link

image

Can we remove the tutorial link in all elements? I think that it is not clear that these all link to the tutorials.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.