-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathIBMQuantum-qiskit
38 lines (30 loc) · 1.51 KB
/
IBMQuantum-qiskit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Experiment with IBM's Qiskit open-source framework for working with quantum computers
# on OpenShift 4.1 / OpenDataHub / CodeReady Containers
# This quickstart includes Qiskit Aqua
# (library of cross-domain quantum algorithms upon which applications for
# near-term quantum computing can be built).
# Aqua is designed to be extensible, and employs a pluggable framework where quantum algorithms can easily be added.
# It currently allows the user to experiment on chemistry, AI, optimization and finance applications
# for near-term quantum computers.
# See bit.ly/marcredhat and bit.ly/marcredhatplaylist for step-by-step instructions
# on installing Open Data Hub on CodeReady Containers/OpenShift 4.1
# You just need a physical server with RHEL 8.1 or Fedora 30.
# See qiskit tutorials at https://github.com/Qiskit/qiskit-iqx-tutorials/tree/master/qiskit/fundamentals
# See also https://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/ and
# https://community.qiskit.org/advocates/
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install numpy qiskit matplotlib
import numpy as np
from qiskit import *
%matplotlib inline
circ = QuantumCircuit(3)
# Add a H gate on qubit 0, putting this qubit in superposition.
circ.h(0)
# Add a CX (CNOT) gate on control qubit 0 and target qubit 1, putting
# the qubits in a Bell state.
circ.cx(0, 1)
# Add a CX (CNOT) gate on control qubit 0 and target qubit 2, putting
# the qubits in a GHZ state.
circ.cx(0, 2)
circ.draw()