Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (30 sloc) 1.51 KB
# 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()
You can’t perform that action at this time.