repo stringclasses 885
values | file stringclasses 741
values | content stringlengths 4 215k |
|---|---|---|
https://github.com/2lambda123/Qiskit-qiskit | 2lambda123 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or... |
https://github.com/MonitSharma/Qiskit-Summer-School-and-Quantum-Challenges | MonitSharma | import networkx as nx
import numpy as np
import plotly.graph_objects as go
import matplotlib as mpl
import pandas as pd
from IPython.display import clear_output
from plotly.subplots import make_subplots
from matplotlib import pyplot as plt
from qiskit import Aer
from qiskit import QuantumCircuit
from qiskit.v... |
https://github.com/xtophe388/QISKIT | xtophe388 | # useful additional packages
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
from qiskit_acqua_chemistry import ACQUAChemistry
import warnings
warnings.filterwarnings('ignore')
import logging
logger = logging.getLogger()
# logger.setLevel(logging.DEBUG) # uncomment it to see detailed... |
https://github.com/mathelatics/QGSS-2023-From-Theory-to-Implementations | mathelatics | import qiskit
qiskit.__qiskit_version__
#initialization
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
# importing Qiskit
from qiskit import IBMQ, BasicAer
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute
from qiskit.compiler import transpile
from qiski... |
https://github.com/CQCL/pytket-qiskit | CQCL | # Copyright 2020-2024 Quantinuum
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
https://github.com/acfilok96/Quantum-Computation | acfilok96 | import qiskit
from qiskit import *
print(qiskit.__version__)
%matplotlib inline
from qiskit.tools.visualization import plot_histogram
def find_secret_number(secter_number):
# Using Bernstein Vazirani Algorithm
secret_number = str(secter_number)
circuit = QuantumCircuit(len(secret_number)+1, ... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit
top = QuantumCircuit(1)
top.x(0);
bottom = QuantumCircuit(2)
bottom.cry(0.2, 0, 1);
tensored = bottom.tensor(top)
tensored.draw('mpl') |
https://github.com/DEBARGHYA4469/quantum-compiler | DEBARGHYA4469 | """Python implementation of Grovers algorithm through use of the Qiskit library to find the value 3 (|11>)
out of four possible values."""
#import numpy and plot library
import matplotlib.pyplot as plt
import numpy as np
# importing Qiskit
from qiskit import IBMQ, Aer, QuantumCircuit, ClassicalRegister, Qu... |
https://github.com/Interlin-q/diskit | Interlin-q | import sys
sys.path.append("..")
from diskit import *
import warnings
warnings.filterwarnings("ignore")
circuit_topo = Topology()
circuit_topo.create_qmap(3, [2, 3, 3], "sys")
circuit_topo.qmap, circuit_topo.emap
print("Total Number of Qubits in Topology : ", circuit_topo.num_qubits())
print("Total Numbe... |
https://github.com/Sanjay-995/Qiskit-Developer-Prep-Guide | Sanjay-995 | from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, Aer, execute
from qiskit.quantum_info import Statevector
from qiskit.visualization import plot_bloch_multivector, plot_histogram
import numpy as np
from numpy import pi
import math
from math import sqrt
import matplotlib as mpl
%matplo... |
https://github.com/Tojarieh97/VQE | Tojarieh97 | %load_ext autoreload
%autoreload 2
import nbimporter
from typing import Dict, Tuple, List
import numpy as np
from tqdm import tqdm
QUBITS_NUM = 4
N = 2**QUBITS_NUM
NUM_SHOTS = 1024
NUM_ITERATIONS = 50
CIRCUIT_DEPTH = 3
PARAMS_NUM = 2*QUBITS_NUM*(CIRCUIT_DEPTH+1)
from qiskit import Aer
from qiski... |
https://github.com/SanNare/qiskit-notebooks | SanNare | from qiskit import *
from qiskit.tools.visualization import plot_histogram
%matplotlib inline
secretnumber = '101001'
n = len(secretnumber)
circuit = QuantumCircuit(n+1,n)
#circuit.h([0,1,2,3,4,5])
circuit.h(range(n))
circuit.x(n)
circuit.h(n)
circuit.barrier()
for ii,yesno in enumerate(reversed(secret... |
https://github.com/abbarreto/qiskit4 | abbarreto | |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit.circuit.library import MCXGate
gate = MCXGate(4)
from qiskit import QuantumCircuit
circuit = QuantumCircuit(5)
circuit.append(gate, [0, 1, 4, 2, 3])
circuit.draw('mpl') |
https://github.com/BOBO1997/osp_solutions | BOBO1997 | import re
import numpy as np
import matplotlib.pyplot as plt
import itertools
import random
import pickle
plt.rcParams.update({'font.size': 16}) # enlarge matplotlib fonts
# Import qubit states Zero (|0>) and One (|1>), and Pauli operators (X, Y, Z)
from qiskit.opflow import Zero, One, I, X, Y, Z
from qiski... |
https://github.com/abbarreto/qiskit2 | abbarreto | %run init.ipynb
from qiskit import *
nshots = 8192
IBMQ.load_account()
provider= qiskit.IBMQ.get_provider(hub='ibm-q-research-2',group='federal-uni-sant-1',project='main')
device = provider.get_backend('ibmq_bogota')
simulator = Aer.get_backend('qasm_simulator')
from qiskit.visualization import plot_histogram
f... |
https://github.com/JohnBurke4/qaoa_testing_framework | JohnBurke4 | from qiskit import QuantumCircuit
import numpy as np
from qiskit.circuit import Parameter
class QAOAInit:
circuit = {}
def __init__(self, numQubits, layers=1, initType='x_high_eigenstate'):
self.numQubits = numQubits
self.initType = initType
self.layers = layers
... |
https://github.com/shesha-raghunathan/DATE2019-qiskit-tutorial | shesha-raghunathan | import numpy as np
import pylab
from qiskit_chemistry import QiskitChemistry
# Input dictionary to configure Qiskit Chemistry for the chemistry problem.
qiskit_chemistry_dict = {
'problem': {'random_seed': 50},
'driver': {'name': 'PYQUANTE'},
'PYQUANTE': {'atoms': '', 'basis': 'sto3g'},
'opera... |
https://github.com/shesha-raghunathan/DATE2019-qiskit-tutorial | shesha-raghunathan | from qiskit import ClassicalRegister
# Create a Classical Register with 2 bits.
c = ClassicalRegister(2)
from qiskit import QuantumRegister
# Create a Quantum Register with 2 qubits.
q = QuantumRegister(2)
from qiskit import QuantumCircuit
# Create a Quantum Circuit
qc = QuantumCircuit(q, c)
# perform a me... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit.quantum_info import SparsePauliOp
H2_op = SparsePauliOp.from_list(
[
("II", -1.052373245772859),
("IZ", 0.39793742484318045),
("ZI", -0.39793742484318045),
("ZZ", -0.01128010425623538),
("XX", 0.18093119978423156),
]
)
from qiskit.circuit.library... |
https://github.com/ElePT/qiskit-algorithms-test | ElePT | # This code is part of Qiskit.
#
# (C) Copyright IBM 2022, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or... |
https://github.com/jonasmaziero/computacao_quantica_qiskit | jonasmaziero | %run init.ipynb
2*acos(sqrt(2/3)), 2*asin(sqrt(1/3)).
cos(2*pi/3), sin(2*pi/3), cos(4*pi/3), sin(4*pi/3), cos(8*pi/3), sin(8*pi/3)
cos(2*pi/3), sin(2*pi/3), cos(4*pi/3), sin(4*pi/3), cos(8*pi/3), sin(8*pi/3)
|
https://github.com/wyqian1027/Qiskit-Fall-Fest-USC-2022 | wyqian1027 | from qiskit import QuantumCircuit, execute, Aer
from qiskit.visualization import plot_bloch_multivector, array_to_latex
from math import pi
x_gate = QuantumCircuit(1) # Create a quantum circuit with 1 qubit
x_gate.x(0)
x_gate.draw(output='mpl')
backend = Aer.get_backend('statevector_simulator')
result = exec... |
https://github.com/shantomborah/Quantum-Algorithms | shantomborah | """Performance Analysis of 5 Qubit Code under Depolarizing Error"""
import noise
import numpy as np
import matplotlib.pyplot as plt
from qiskit import QuantumCircuit, ClassicalRegister
from qiskit import Aer, execute
from qiskit.visualization import plot_histogram, plot_bloch_vector
from five_qubit_code impo... |
https://github.com/quantumjim/pewpew_qiskit_workshops | quantumjim | %matplotlib notebook
import pew # setting up tools for the pewpew
from microqiskit import QuantumCircuit, simulate # setting up tools for quantum
pew.init() # initialize the game engine...
screen = pew.Pix() # ...and the screen
qc = QuantumCircuit(2,2) # create an empty circuit with two qubits and two output... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
q = QuantumRegister(1)
c = ClassicalRegister(1)
qc = QuantumCircuit(q, c)
qc.h(q)
qc.measure(q, c)
qc.draw(output='mpl', style={'backgroundcolor': '#EEEEEE'}) |
https://github.com/abbarreto/qiskit4 | abbarreto | from qiskit import *
import numpy as np
import math
from matplotlib import pyplot as plt
import qiskit
nshots = 8192
IBMQ.load_account()
provider = qiskit.IBMQ.get_provider(hub='ibm-q', group='open', project='main')
device = provider.get_backend('ibmq_belem')
simulator = Aer.get_backend('qasm_simulator')
from... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from sklearn.datasets import load_iris
iris_data = load_iris()
print(iris_data.DESCR)
features = iris_data.data
labels = iris_data.target
from sklearn.preprocessing import MinMaxScaler
features = MinMaxScaler().fit_transform(features)
import pandas as pd
import seaborn as sns
df = pd.DataFrame(ir... |
https://github.com/GabrielPontolillo/QiskitPBT | GabrielPontolillo | # class that inherits from property based test
from qiskit import QuantumCircuit
import random
import numpy as np
import cmath
from fractions import Fraction
from qiskit.circuit.library import UnitaryGate
from qiskit.quantum_info import Operator, Statevector
from QiskitPBT.property import Property
from QiskitP... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | import numpy as np
from qiskit import QuantumCircuit
from qiskit.providers.fake_provider import FakeVigoV2
backend = FakeVigoV2()
qc = QuantumCircuit(2, 1)
qc.h(0)
qc.x(1)
qc.cp(np.pi/4, 0, 1)
qc.h(0)
qc.measure([0], [0])
qc.draw(output='mpl') |
https://github.com/anpaschool/QC-School-Fall2020 | anpaschool | import numpy as np
import matplotlib.pylab as plt
import seaborn as sns
np.sign(2*np.random.rand(10)-1).astype('int')
class Ising2D():
def __init__(self, N=10, seed=8848):
self.N = N
self.seed = seed
np.random.seed(self.seed)
# construct a lattice with random s... |
https://github.com/jenglick/scipy22-qiskit-runtime-tutorial | jenglick | from qiskit.quantum_info import SparsePauliOp
op = SparsePauliOp.from_list([("ZZII", 1)])
num_qubits = op.num_qubits
ops = [op]
print(op)
target_energy = -1
from qiskit.circuit.library import EfficientSU2
circuit = EfficientSU2(num_qubits, reps=1, entanglement="linear", insert_barriers=True)
circuit.d... |
https://github.com/vm6502q/qiskit-qrack-provider | vm6502q | # This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or... |
https://github.com/biswaroopmukherjee/Quantum-Waddle | biswaroopmukherjee | import qiskit
import numpy as np
from qiskit import(
IBMQ, QuantumCircuit, ClassicalRegister, QuantumRegister, execute,
QuantumCircuit,
execute,
Aer)
from qiskit.visualization import plot_histogram, plot_state_city
def increment_gate(circuit, qpos, qcoin):
n = len(qpos)
for i in ra... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit, execute
from qiskit.providers.fake_provider import FakeVigoV2
from qiskit.visualization import plot_gate_map
backend = FakeVigoV2()
plot_gate_map(backend) |
https://github.com/benkoehlL/Qiskit_Playground | benkoehlL | '''
This program stores the API token of IBM Quantum (can be found in the
account settings) for later use in a qiskitrc-file, loads your IBMQ account
and it lists all the versions of your qiskit installation.
'''
import qiskit
from qiskit import IBMQ
IBMQ.save_account('***********')
IBMQ.load_account
pri... |
https://github.com/swe-train/qiskit__qiskit | swe-train | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modificati... |
https://github.com/maximusron/qgss_2021_labs | maximusron | import numpy as np
# Importing standard Qiskit libraries
from qiskit import QuantumCircuit, transpile, assemble, Aer, IBMQ, execute
from qiskit.quantum_info import Statevector
from qiskit.visualization import plot_bloch_multivector, plot_histogram
from qiskit_textbook.problems import dj_problem_oracle
def lab... |
https://github.com/vindem/quantumMD | vindem |
import numpy as np
import networkx as nx
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, assemble
from qiskit.quantum_info import Statevector
from qiskit.aqua.algorithms import NumPyEigensolver
from qiskit.quantum_info import Pauli
from qiskit.aqua.operators... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit
from qiskit.transpiler.passes import RemoveBarriers
circuit = QuantumCircuit(1)
circuit.x(0)
circuit.barrier()
circuit.h(0)
circuit = RemoveBarriers()(circuit)
circuit.draw('mpl') |
https://github.com/mspronesti/qlearnkit | mspronesti | !pip install qlearnkit['pennylane']
!pip install matplotlib
import qlearnkit as ql
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from matplotlib import pyplot as plt
tag_to_ix = {"DET": 0, "NN": 1, "V": 2} # Assign each tag with a uniqu... |
https://github.com/qiskit-community/prototype-entanglement-forging | qiskit-community | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or deriv... |
https://github.com/2lambda123/Qiskit-qiskit | 2lambda123 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2020
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or ... |
https://github.com/rmlarose/qcbq | rmlarose | #!pip install qiskit
# Include the necessary imports for this program
import numpy as np
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import execute
# Create a Quantum Register with 1 qubit (wire).
qr = QuantumRegister(1)
# Create a Classical Register with 1 bit (double w... |
https://github.com/quantumyatra/quantum_computing | quantumyatra | #!/usr/bin/env python3
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import Aer, execute, BasicAer
import numpy as np
import matplotlib.pyplot as plt
def get_state_vector(qc):
backend = BasicAer.get_backend('statevector_simulator')
res = execute(qc, backend).resu... |
https://github.com/Raunak-Singh-Inventor/quantum_algorithms_in_qiskit | Raunak-Singh-Inventor | from qiskit import *
%matplotlib inline
from qiskit.tools.visualization import plot_histogram
secretnumber = "101001"
circuit = QuantumCircuit(6+1, 6)
circuit.h([0, 1, 2, 3, 4, 5, 6])
circuit.draw("mpl")
|
https://github.com/GabrielPontolillo/Quantum_Algorithm_Implementations | GabrielPontolillo | from qiskit import QuantumCircuit
def create_bell_pair():
qc = QuantumCircuit(2)
qc.h(1)
qc.cx(1, 0)
return qc
def encode_message(qc, qubit, msg):
if len(msg) != 2 or not set([0,1]).issubset({0,1}):
raise ValueError(f"message '{msg}' is invalid")
if msg[1] == "1":
#... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | %matplotlib inline
from qiskit_finance import QiskitFinanceError
from qiskit_finance.data_providers import *
import datetime
import matplotlib.pyplot as plt
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
data = RandomDataProvider(
tickers=["TICKER1", "TICKER2... |
https://github.com/2lambda123/Qiskit-qiskit | 2lambda123 | #!/usr/bin/env python3
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# An... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit, transpile
from qiskit.visualization import plot_circuit_layout
from qiskit.providers.fake_provider import FakeVigo
backend = FakeVigo()
ghz = QuantumCircuit(3, 3)
ghz.h(0)
ghz.cx(0,range(1,3))
ghz.barrier()
ghz.measure(range(3), range(3))
# Virtual -> physical
# 0 ... |
https://github.com/quantum-tokyo/qiskit-handson | quantum-tokyo | # Qiskitライブラリーを導入
from qiskit import *
# 描画のためのライブラリーを導入
import matplotlib.pyplot as plt
%matplotlib inline
# Qiskitバージョンの確認
qiskit.__qiskit_version__
# 2量子ビット回路を用意してください
# 回路を描画して確認します
qc.draw(output="mpl")
# EPRペアを作ってください(AliceとBobに1個ずつ渡すものです)
# 回路を描画して確認します
qc.draw(output="mpl")
# Alic... |
https://github.com/carstenblank/dc-qiskit-qml | carstenblank | # -*- coding: utf-8 -*-
# Copyright 2018 Carsten Blank
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
https://github.com/joshy91/PythonQiskit | joshy91 | import numpy as np
import scipy
from scipy.linalg import expm
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler, MinMaxScaler
from sklearn.decomposition import... |
https://github.com/alejomonbar/Quantum-Supply-Chain-Manager | alejomonbar | %load_ext autoreload
%autoreload 2
#pip install pennyane
#improt pennylane dependnecies
import pennylane as qml
from pennylane import numpy as np
from pennylane.optimize import NesterovMomentumOptimizer
# load the csv files
import pandas as pd
# plot the historical acc and cost
import matplotlib.pyp... |
https://github.com/moaz-aljohani/HelloQuantum | moaz-aljohani | #---------------------1-------------------------
from qiskit import QuantumCircuit as qubit # Import QuantumCircuit class from qiskit library as qubit
qc = qubit(2) # Create a quantum circuit with 2 qubits
qc.h(0) # Apply a Hadamard gate to the first qubit (qubit 0), putting it in a superposition state
qc.cx(0, ... |
https://github.com/Slope86/QiskitExtension | Slope86 | from qiskit_extension.quantum_circuit2 import QuantumCircuit2 as qc2
from qiskit_extension.state_vector2 import StateVector2 as sv2
circuit_EPR = qc2(2)
# 1. put a Hadamard gate in the qubit 0 position
circuit_EPR.h(0)
# 2. put a CNOT gate, control qubit 0, target qubit 1
circuit_EPR.cx(0, 1)
# 3. draw t... |
https://github.com/googlercolin/Qiskit-Course | googlercolin | import numpy as np
from numpy import pi
# Importing standard Qiskit libraries
from qiskit import QuantumCircuit, transpile, assemble, Aer, IBMQ, execute
from qiskit.quantum_info import Statevector
from qiskit.visualization import plot_bloch_multivector, plot_histogram
from qiskit_textbook.problems import dj_pro... |
https://github.com/dimple12M/Qiskit-Certification-Guide | dimple12M | from qiskit import QuantumCircuit,BasicAer,transpile
from qiskit.extensions import *
from qiskit.quantum_info.operators import Operator, Pauli
from qiskit.visualization import *
from math import *
import numpy as np
backend=BasicAer.get_backend('unitary_simulator')
qc=QuantumCircuit(1)
qc.h(0)
qc.x(0)
qc.h(... |
https://github.com/abhik-99/Qiskit-Summer-School | abhik-99 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifi... |
https://github.com/MonitSharma/Qiskit-Summer-School-and-Quantum-Challenges | MonitSharma | import numpy as np
# Importing standard Qiskit libraries
from qiskit import QuantumCircuit, transpile, assemble, Aer, IBMQ, execute
from qiskit.quantum_info import Statevector
from qiskit.visualization import plot_bloch_multivector, plot_histogram
from qiskit_textbook.problems import dj_problem_oracle
def lab... |
https://github.com/swe-bench/Qiskit__qiskit | swe-bench | # This code is part of Qiskit.
#
# (C) Copyright IBM 2022, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or... |
https://github.com/BOBO1997/osp_solutions | BOBO1997 | filename = "job_ids_jakarta_100step_20220412_030333_.pkl"
import pickle
with open(filename, "rb") as f:
print(pickle.load(f))
filename = "job_ids_jakarta_100step_20220413_012425_.pkl"
with open(filename, "rb") as f:
print(pickle.load(f))
|
https://github.com/MonitSharma/Qiskit-Summer-School-and-Quantum-Challenges | MonitSharma | from qiskit.circuit.library import RealAmplitudes
ansatz = RealAmplitudes(num_qubits=2, reps=1, entanglement='linear')
ansatz.draw('mpl', style='iqx')
from qiskit.opflow import Z, I
hamiltonian = Z ^ Z
from qiskit.opflow import StateFn
expectation = StateFn(hamiltonian, is_measurement=True) @ StateFn(an... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit, transpile, schedule
from qiskit.visualization.pulse_v2 import draw, IQXDebugging
from qiskit.providers.fake_provider import FakeBoeblingen
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
qc = transpile(qc, FakeBoeblingen(), layout_method='trivial')
sched = schedu... |
https://github.com/matheusmtta/Quantum-Computing | matheusmtta | from qiskit import QuantumCircuit, Aer, execute, IBMQ
from qiskit.utils import QuantumInstance
import numpy as np
from qiskit.algorithms import Shor
IBMQ.enable_account('ENTER API TOKEN HERE') # Enter your API token here
provider = IBMQ.get_provider(hub='ibm-q')
backend = Aer.get_backend('qasm_simulator')
qu... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
from qiskit.visualization import plot_bloch_multivector
qc = QuantumCircuit(2)
qc.h(0)
qc.x(1)
state = Statevector(qc)
plot_bloch_multivector(state) |
https://github.com/qiskit-community/qiskit-dell-runtime | qiskit-community | # This code is part of qiskit-runtime.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications ... |
https://github.com/2lambda123/Qiskit-qiskit | 2lambda123 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or... |
https://github.com/lancecarter03/QiskitLearning | lancecarter03 | from qiskit import *
from qiskit.tools.visualization import plot_histogram
circuit = QuantumCircuit(1,1)
circuit.draw(output='mpl', initial_state=True)
circuit.measure(0,0)
simulator = Aer.get_backend('qasm_simulator')
result = execute(circuit, backend = simulator, shots =1024).result()
counts = result.g... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit.circuit.quantumcircuitdata import CircuitInstruction
from qiskit.circuit import Measure
from qiskit.circuit.library import HGate, CXGate
qr = QuantumRegister(2)
cr = ClassicalRegister(2)
instructions = [
CircuitInstruction(... |
https://github.com/mmetcalf14/Hamiltonian_Downfolding_IBM | mmetcalf14 | from qiskit import *
from oracle_generation import generate_oracle
get_bin = lambda x, n: format(x, 'b').zfill(n)
def gen_circuits(min,max,size):
circuits = []
secrets = []
ORACLE_SIZE = size
for i in range(min,max+1):
cur_str = get_bin(i,ORACLE_SIZE-1)
(circuit, secret) = generate_oracle... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit
qc = QuantumCircuit(12)
for idx in range(5):
qc.h(idx)
qc.cx(idx, idx+5)
qc.cx(1, 7)
qc.x(8)
qc.cx(1, 9)
qc.x(7)
qc.cx(1, 11)
qc.swap(6, 11)
qc.swap(6, 9)
qc.swap(6, 10)
qc.x(6)
qc.draw('mpl') |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | import qiskit.qasm3
program = """
OPENQASM 3.0;
include "stdgates.inc";
input float[64] a;
qubit[3] q;
bit[2] mid;
bit[3] out;
let aliased = q[0:1];
gate my_gate(a) c, t {
gphase(a / 2);
ry(a) c;
cx c, t;
}
gate my_phase(a) c {
ctrl ... |
https://github.com/chunfuchen/qiskit-chemistry | chunfuchen | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.... |
https://github.com/qiskit-community/qiskit-aqua-interfaces | qiskit-community | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit, transpile, schedule
from qiskit.visualization.pulse_v2 import draw, IQXSimple
from qiskit.providers.fake_provider import FakeBoeblingen
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
qc = transpile(qc, FakeBoeblingen(), layout_method='trivial')
sched = schedule(... |
https://github.com/swe-train/qiskit__qiskit | swe-train | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or... |
https://github.com/anirban-m/qiskit-superstaq | anirban-m | import qiskit
import qiskit_superstaq
provider = qiskit_superstaq.superstaq_provider.SuperstaQProvider("YOUR API KEY")
circuit1 = qiskit.QuantumCircuit(8)
for i in range(4, 8):
circuit1.h(i)
circuit1.draw(fold=-1)
compiler_output = provider.aqt_compile(circuit1)
print(compiler_output.circuit)
com... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit
qc = QuantumCircuit(12)
for idx in range(5):
qc.h(idx)
qc.cx(idx, idx+5)
qc.cx(1, 7)
qc.x(8)
qc.cx(1, 9)
qc.x(7)
qc.cx(1, 11)
qc.swap(6, 11)
qc.swap(6, 9)
qc.swap(6, 10)
qc.x(6)
qc.draw('mpl') |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | # useful additional packages
import matplotlib.pyplot as plt
import numpy as np
import networkx as nx
from qiskit_aer import Aer
from qiskit.tools.visualization import plot_histogram
from qiskit.circuit.library import TwoLocal
from qiskit_optimization.applications import Maxcut, Tsp
from qiskit.algorithms.min... |
https://github.com/qiskit-community/qiskit-device-benchmarking | qiskit-community | # This code is part of Qiskit.
#
# (C) Copyright IBM 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or deriv... |
https://github.com/ichen17/Learning-Qiskit | ichen17 | from qiskit import *
from qiskit.tools.visualization import plot_histogram
%matplotlib inline
secretnumber = '11100011'
circuit = QuantumCircuit(len(secretnumber)+1,len(secretnumber))
circuit.h(range(len(secretnumber)))
circuit.x(len(secretnumber))
circuit.h(len(secretnumber))
circuit.barrier()
for i... |
https://github.com/mtreinish/qiskit-workshop | mtreinish | |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | import numpy as np
from qiskit import QuantumCircuit
from qiskit.quantum_info import DensityMatrix
from qiskit.visualization import plot_state_hinton
qc = QuantumCircuit(2)
qc.h([0, 1])
qc.cz(0,1)
qc.ry(np.pi/3 , 0)
qc.rx(np.pi/5, 1)
state = DensityMatrix(qc)
plot_state_hinton(state, title="New Hinton Plo... |
https://github.com/yaelbh/qiskit-sympy-provider | yaelbh | # -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""
Example showing how to use the Sympy Provider at level 0 (novice).
This example shows the most basic way to us... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | import numpy as np
import matplotlib.pyplot as plt
try:
import cplex
from cplex.exceptions import CplexError
except:
print("Warning: Cplex not found.")
import math
from qiskit.utils import algorithm_globals
from qiskit.algorithms.minimum_eigensolvers import SamplingVQE
from qiskit.algorithms.o... |
https://github.com/Juan-Varela11/BNL_2020_Summer_Internship | Juan-Varela11 | import warnings
from qiskit.tools.jupyter import *
from qiskit import IBMQ
from qiskit import assemble
from qiskit import pulse
from qiskit.pulse import pulse_lib
import numpy as np
import matplotlib.pyplot as plt
warnings.filterwarnings('ignore')
IBMQ.load_account()
provider = IBMQ.get_provider(hub='ibm-... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit
from qiskit.transpiler.passes import RemoveBarriers
circuit = QuantumCircuit(1)
circuit.x(0)
circuit.barrier()
circuit.h(0)
circuit = RemoveBarriers()(circuit)
circuit.draw('mpl') |
https://github.com/WhenTheyCry96/qiskitHackathon2022 | WhenTheyCry96 | import warnings
warnings.filterwarnings('ignore')
from qiskit_metal import designs, MetalGUI
design = designs.DesignPlanar()
design.overwrite_enabled = True
design.chips.main.size_x = '12mm'
design.chips.main.size_y = '10mm'
gui = MetalGUI(design)
from qiskit_metal.qlibrary.qubits.transmon_pocket_cl i... |
https://github.com/mnp-club/Quantum_Computing_Workshop_2020 | mnp-club | from qiskit import *
from qiskit.compiler import *
from qiskit.tools.jupyter import *
from qiskit.visualization import *
import matplotlib.pyplot as plotter
import numpy as np
from IPython.display import display, Math, Latex
%matplotlib inline
# Loading your IBM Q account(s)
provider = IBMQ.load_account()
q... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit
from qiskit.transpiler.passes import RemoveBarriers
circuit = QuantumCircuit(1)
circuit.x(0)
circuit.barrier()
circuit.h(0)
circuit = RemoveBarriers()(circuit)
circuit.draw('mpl') |
https://github.com/abbarreto/qiskit2 | abbarreto | %run init.ipynb
from qiskit import *
nshots = 8192
IBMQ.load_account()
provider = IBMQ.get_provider(hub = 'ibm-q-research-2', group = 'federal-uni-sant-1', project = 'main')
device = provider.get_backend('ibm_nairobi')
simulator = Aer.get_backend('qasm_simulator')
from qiskit.tools.monitor import job_monitor, ... |
https://github.com/drobiu/quantum-project | drobiu | import os
import math
from getpass import getpass
from coreapi.auth import TokenAuthentication
from qiskit import BasicAer, execute
from qiskit.circuit import QuantumRegister, ClassicalRegister, QuantumCircuit
from quantuminspire.credentials import get_authentication
from quantuminspire.qiskit import QI
... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit
top = QuantumCircuit(1)
top.x(0);
bottom = QuantumCircuit(2)
bottom.cry(0.2, 0, 1);
tensored = bottom.tensor(top)
tensored.draw('mpl') |
https://github.com/maximusron/qgss_2021_labs | maximusron | import networkx as nx
import numpy as np
import plotly.graph_objects as go
import matplotlib as mpl
import pandas as pd
from IPython.display import clear_output
from plotly.subplots import make_subplots
from matplotlib import pyplot as plt
from qiskit import Aer
from qiskit import QuantumCircuit
from qiskit.v... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit, transpile
from qiskit.visualization import plot_circuit_layout
from qiskit.providers.fake_provider import FakeVigo
backend = FakeVigo()
ghz = QuantumCircuit(3, 3)
ghz.h(0)
ghz.cx(0,range(1,3))
ghz.barrier()
ghz.measure(range(3), range(3))
new_circ_lv3 = transpile(ghz, bac... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | import math
from qiskit import pulse
from qiskit.providers.fake_provider import FakeOpenPulse3Q
# TODO: This example should use a real mock backend.
backend = FakeOpenPulse3Q()
d2 = pulse.DriveChannel(2)
with pulse.build(backend) as bell_prep:
pulse.u2(0, math.pi, 0)
pulse.cx(0, 1)
with pulse... |
https://github.com/qiskit-community/prototype-entanglement-forging | qiskit-community | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or deriv... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit.providers.fake_provider import FakeHanoi
backend = FakeHanoi()
config = backend.configuration()
# Basic Features
print("This backend is called {0}, and is on version {1}. It has {2} qubit{3}. It "
"{4} OpenPulse programs. The basis gates supported on this device are {5}."
"".format(c... |
https://github.com/Naphann/Solving-TSP-Grover | Naphann | import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import Aer
import numpy as np
from math import floor, ceil
%matplotlib inline
import gate_extensions
for n in range(5, 7):
print('{}-bit controls'.format(n))
for inp in range(2**n):
qr = Qua... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.