repo
stringclasses
885 values
file
stringclasses
741 values
content
stringlengths
4
215k
https://github.com/Z-928/Bugs4Q
Z-928
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit.wrapper import available_backends, get_backend from qiskit.wrapper import execute as q_execute q = QuantumRegister(2, name='q') c = ClassicalRegister(2, name='c') qc = QuantumCircuit(q,c) qc.h(q[0]) qc.h(q[1]) qc.cx(q[0], q[1]...
https://github.com/LauraGentini/QRL
LauraGentini
__author__ = 'QRL_team' import numpy as np from gym import spaces from itertools import permutations from qiskit import ( QuantumCircuit, execute, Aer) from qiskit.circuit.library import ( HGate, XGate, CXGate) class QTicTacToeEnv: def __init__(self, grid_size): "...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import pulse from qiskit.providers.fake_provider import FakeArmonk backend = FakeArmonk() with pulse.build(backend) as drive_sched: d0 = pulse.drive_channel(0) a0 = pulse.acquire_channel(0) pulse.play(pulse.library.Constant(10, 1.0), d0) pulse.delay(20, d0) pulse.shift_phas...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.tools.visualization import circuit_drawer q = QuantumRegister(1) c = ClassicalRegister(1) qc = QuantumCircuit(q, c) qc.h(q) qc.measure(q, c) circuit_drawer(qc, output='mpl', style={'backgroundcolor': '#EEEEEE'})
https://github.com/minnukota381/Quantum-Computing-Qiskit
minnukota381
from qiskit import * from qiskit.visualization import plot_bloch_multivector, visualize_transition, plot_histogram # Create a quantum circuit with 2 qubits # The default initial state of qubits will be |0> or [1,0] qc = QuantumCircuit(2) #Applying the CZ gate qc.cz(0,1) #Draw the circuit qc.draw('mpl') ...
https://github.com/abhishekchak52/quantum-computing-course
abhishekchak52
%matplotlib inline import hashlib import numpy as np import matplotlib.pyplot as plt # Importing standard Qiskit libraries and configuring account from qiskit import QuantumCircuit, execute from qiskit.circuit import Parameter from qiskit.providers.aer import QasmSimulator, StatevectorSimulator from qiskit.visu...
https://github.com/Qiskit/feedback
Qiskit
from qiskit.circuit.random import random_circuit circuit = random_circuit(2, 2, seed=0).decompose(reps=1) display(circuit.draw("mpl")) from qiskit.quantum_info import SparsePauliOp observable = SparsePauliOp("XZ") print(f">>> Observable: {observable.paulis}") from qiskit.primitives import Estimator est...
https://github.com/PabloMartinezAngerosa/QAOA-uniform-convergence
PabloMartinezAngerosa
from tsp_qaoa import test_solution from qiskit.visualization import plot_histogram import networkx as nx import numpy as np import json import csv # Array of JSON Objects header = ['instance','p','distance', 'mean'] length_p = 3 length_instances = 2 with open('qaoa_multiple_p_distance.csv', 'w', encodin...
https://github.com/GabrielPontolillo/QiskitPBT
GabrielPontolillo
import random from qiskit import QuantumCircuit from QiskitPBT.case_studies.deutsch_jozsa.deutsch_jozsa import deutsch_jozsa_circ from QiskitPBT.case_studies.deutsch_jozsa.dj_helpers import RandomOracleInputGenerator from QiskitPBT.property import Property class DeutschJozsaLowerRegisterMinus(Property): #...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit.circuit.library import RealAmplitudes from qiskit.algorithms.optimizers import COBYLA from qiskit.algorithms.minimum_eigensolvers import NumPyMinimumEigensolver, SamplingVQE from qiskit.primitives import Sampler from qiskit_optimization.converters import LinearEqualityToPenalty from qiskit_optimization...
https://github.com/ggridin/QiskitTests
ggridin
import qiskit from qiskit.providers import JobStatus from QCTest import get_test_qc, get_qc_random_generator from QuantumPlatform import QuantumPlatform def get_quantum_circuit(): return get_test_qc() def main(): wait_for_results = True try: platform_backend = QuantumPlatform(qisk...
https://github.com/Z-928/Bugs4Q
Z-928
from qiskit import Aer, QuantumCircuit from qiskit.circuit.library import PhaseEstimation qc= QuantumCircuit(3,3) # dummy unitary circuit unitary_circuit = QuantumCircuit(1) unitary_circuit.h(0) # QPE qc.append(PhaseEstimation(2, unitary_circuit), list(range(3))) qc.measure(list(range(3)), list(range(3))) back...
https://github.com/microsoft/qiskit-qir
microsoft
#-------------------------------------------------------------------------------------------------------------- # This module contains basic gates that can be used while developing circuits on IBM QExperience #-----------------------------------------------------------------------------------------------------------...
https://github.com/swe-bench/Qiskit__qiskit
swe-bench
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017. # # 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/apcarrik/qiskit-dev
apcarrik
### Pauli Operators from qiskit.opflow import I, X, Y, Z # Pauli operators print(I,X,Y,Z) print(1.5*I) # can carry a coefficient print(2.5*X) print(X+2.0*Y) # can be used in a sum print(X ^ Y ^ Z) # tensor products use ^ print(X @ Y @ Z) # composition uses @ # complicated objects print((X + Y) ^ (Y + Z)) #...
https://github.com/Z-928/Bugs4Q
Z-928
from qiskit import * qc = QuantumCircuit(2) qc.h(i) qc.crz (PI/4, 0, 1)
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
# Necessary imports import matplotlib.pyplot as plt import numpy as np from IPython.display import clear_output from qiskit import QuantumCircuit from qiskit.algorithms.optimizers import COBYLA from qiskit.circuit.library import ZFeatureMap, RealAmplitudes from qiskit.utils import algorithm_globals from sklearn...
https://github.com/GIRISHBELANI/QC_Benchmarks_using_dm-simulator
GIRISHBELANI
""" Shor's Order Finding Algorithm Benchmark - QSim """ import math import sys import time import numpy as np from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister sys.path[1:1] = ["_common", "_common/qsim", "shors/_common", "quantum-fourier-transform/qsim"] sys.path[1:1] = ["../../_commo...
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) # You can reverse the order of the qubits. from qiskit.quantum_info import DensityMatrix qc = QuantumCircuit(2) qc.h([0, 1]) qc.t...
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/mmetcalf14/Hamiltonian_Downfolding_IBM
mmetcalf14
from qiskit import Aer, IBMQ, execute from qiskit import transpile, assemble from qiskit.tools.monitor import job_monitor from qiskit.tools.monitor import job_monitor import matplotlib.pyplot as plt from qiskit.visualization import plot_histogram, plot_state_city """ Qiskit backends to execute the quantum circ...
https://github.com/ElePT/qiskit-algorithms-test
ElePT
# This code is part of Qiskit. # # (C) Copyright IBM 2020, 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/Z-928/Bugs4Q
Z-928
open Microsoft.Quantum.Intrinsic; open Microsoft.Quantum.Math; operation GlobalPhaseI(q:Qubit):Unit is Adj+Ctl{ X(q); Z(q); Y(q); } namespace Quantum.Kata.SingleQubitGates{ open Microsoft.Quantum.Intrinsic; open Microsoft.Quantum.Math; operation GlobalPhaseI(q:Qubit):Unit is Adj+Ctl{ ...
https://github.com/omarcostahamido/qiskit_app_carbon_design
omarcostahamido
import os from flask import Flask, jsonify, request import json import requests # New QISKit libraries from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit from qiskit import execute from qiskit import IBMQ from qiskit import BasicAer from qiskit.providers.aer import noise from noisedev imp...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import pulse d0 = pulse.DriveChannel(0) d1 = pulse.DriveChannel(1) with pulse.build() as pulse_prog: with pulse.align_right(): # this pulse will start at t=0 pulse.play(pulse.Constant(100, 1.0), d0) # this pulse will start at t=80 pulse.play(pulse.Constant(20,...
https://github.com/TheGupta2012/QPE-Algorithms
TheGupta2012
from qiskit import * import matplotlib.pyplot as plt from qiskit.extensions import UnitaryGate from qiskit.circuit import add_control from IPython.display import display from qiskit.tools.visualization import plot_histogram import numpy as np import sys sys.path.append("..") from Modules.faster_basic_qpe ...
https://github.com/HQSquantumsimulations/qoqo-qiskit
HQSquantumsimulations
from qiskit import Aer, IBMQ, execute from qiskit import transpile, assemble from qiskit.tools.monitor import job_monitor from qiskit.tools.monitor import job_monitor import matplotlib.pyplot as plt from qiskit.visualization import plot_histogram, plot_state_city """ Qiskit backends to execute the quantum circ...
https://github.com/pedroripper/qiskit_tutoriais
pedroripper
from qiskit import * # Primeiramente vamos iniciar um circuito circuitoQ = QuantumCircuit(1,1) # No qiskit os qubits são inicializados por default com o estado |0> # Podemos ver isso plotando a esfera de bloch que representa ele from qiskit.tools.visualization import plot_bloch_multivector simulator = ...
https://github.com/swe-train/qiskit__qiskit
swe-train
# This code is part of Qiskit. # # (C) Copyright IBM 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 deriv...
https://github.com/rishikhurana2/FourQuantumAlgorithms
rishikhurana2
"""Qiskit code for running Simon's algorithm on quantum hardware for 2 qubits and b = '11' """ # importing Qiskit from qiskit import IBMQ, BasicAer from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, execute # import basic plot tools from qiskit.visualization import plot_histogram ...
https://github.com/dimple12M/Qiskit-Certification-Guide
dimple12M
from qiskit import QuantumCircuit import numpy as np qc = QuantumCircuit(3) qc.ccx(0,1,2) qc.draw(output="mpl") qc.decompose().draw(output="mpl") qc = QuantumCircuit(2) qc.y(0) qc.z(1) qc.h(0) qc.swap(0,1) qc.draw(output="mpl") qc.decompose().draw(output="mpl") qc.decompose().decompose().draw(out...
https://github.com/muehlhausen/vqls-bachelor-thesis
muehlhausen
""" Import all required libraries. """ from qiskit import ( QuantumCircuit, QuantumRegister, ClassicalRegister, IBMQ, Aer, execute, transpile, assemble ) from qiskit.circuit import Gate, Instruction from qiskit.quantum_info.operators import Operator from qiskit.extensions import ZGate, YGate, XGa...
https://github.com/hritiksauw199/Optimized-Shor-Algorithm-for-factoring
hritiksauw199
#initialization import matplotlib.pyplot as plt import numpy as np import math # importing Qiskit from qiskit import IBMQ, Aer, transpile, assemble from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister # import basic plot tools from qiskit.visualization import plot_histogram qpe = Quantum...
https://github.com/swe-bench/Qiskit__qiskit
swe-bench
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 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/BOBO1997/osp_solutions
BOBO1997
# -*- 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 from qiskit.providers.fake_provider import FakeBoeblingen backend = FakeBoeblingen() ghz = QuantumCircuit(5) ghz.h(0) ghz.cx(0,range(1,5)) circ = transpile(ghz, backend, scheduling_method="asap") circ.draw(output='mpl')
https://github.com/maximusron/qgss_2021_labs
maximusron
# General Imports import numpy as np # Visualisation Imports import matplotlib.pyplot as plt # Scikit Imports from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.svm import SVC from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler,...
https://github.com/TanveshT/IBM-Quantum-Challenge
TanveshT
# Cell 1 import numpy as np from qiskit import Aer, QuantumCircuit, execute from qiskit.visualization import plot_histogram from IPython.display import display, Math, Latex from may4_challenge import plot_state_qsphere from may4_challenge.ex1 import minicomposer from may4_challenge.ex1 import check1, check2,...
https://github.com/jonasmaziero/computacao_quantica_qiskit
jonasmaziero
import numpy as np import matplotlib from matplotlib import pyplot as plt import math th = np.arange(0, 2*math.pi, 0.1) prE3 = 2*(1-(math.sqrt(2)*(np.sin(th/2)**2))/(1+math.sqrt(2))) matplotlib.rcParams.update({'font.size':10}) plt.figure(figsize = (5,3), dpi = 100) plt.plot(th, prE3) plt.xlabel(r'$\theta$')...
https://github.com/trevorpiltch/Grovers-Algorithm
trevorpiltch
from qiskit import * def oracle(n, target_binary): """Creates an oracle based on the implementation here: https://github.com/SaashaJoshi/grovers-algorithm""" circuit = QuantumCircuit(n + 1) for index, value in reversed(list(enumerate(target_binary))): if value == '0': circuit.x...
https://github.com/qiskit-community/qiskit-aqt-provider
qiskit-community
# This code is part of Qiskit. # # (C) Alpine Quantum Technologies GmbH 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 modi...
https://github.com/gustavomirapalheta/Quantum-Computing-with-Qiskit
gustavomirapalheta
# Setup básico !pip install qiskit -q !pip install qiskit[visualization] -q import qiskit as qk !pip install qiskit-aer -q import qiskit_aer as qk_aer import numpy as np np.set_printoptions(precision=3, suppress=True) from matplotlib import pyplot as plt %matplotlib inline import pandas as pd import ...
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/benkoehlL/Qiskit_Playground
benkoehlL
from qiskit import Aer, execute, QuantumRegister, ClassicalRegister,\ QuantumCircuit from qiskit.visualization import plot_bloch_multivector from matplotlib.pyplot import plot, draw, show # list all the available simulation environments for backend in Aer.backends(): print(backend.name()...
https://github.com/danieljaffe/quantum-algorithms-qiskit
danieljaffe
"""Qiskit code for running Simon's algorithm on quantum hardware for 2 qubits and b = '11' """ # importing Qiskit from qiskit import IBMQ, BasicAer from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, execute # import basic plot tools from qiskit.visualization import plot_histogram ...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
import numpy as np from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import Aer, execute from qiskit.circuit import Gate from qiskit.visualization import plot_histogram, plot_bloch_multivector # Define no. of input qubits n = 4 circ = QuantumCircuit(n+1, n) circ.reset(range(n...
https://github.com/JavaFXpert/qiskit-plotting-app
JavaFXpert
# Do the necessary import for our program %matplotlib inline from qiskit import * from qiskit.aqua.algorithms import Grover from qiskit.aqua.components.oracles import LogicalExpressionOracle from qiskit.tools.visualization import plot_histogram import ipywidgets as widgets import matplotlib.pyplot as plt from I...
https://github.com/DanKim44/CodingWithQiskitS2
DanKim44
#Coding With Qiskit S2E7 Shor's Algorithm %matplotlib inline # Importing standard Qiskit libraries and configuring account from qiskit import QuantumCircuit, execute, Aer from qiskit.compiler import transpile, assemble from qiskit.tools.jupyter import * from qiskit.tools.visualization import plot_histogram fro...
https://github.com/qclib/qclib
qclib
# Copyright 2021 qclib project. # 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 in w...
https://github.com/PabloMartinezAngerosa/QAOA-uniform-convergence
PabloMartinezAngerosa
from tsp_qaoa import test_solution from qiskit.visualization import plot_histogram import networkx as nx import numpy as np job_2, G, UNIFORM_CONVERGENCE_SAMPLE = test_solution() plot_histogram(job_2.result().get_counts(), color='midnightblue', title="New Histogram", figsize=(30, 5)) plot_histogram(job...
https://github.com/shesha-raghunathan/DATE2019-qiskit-tutorial
shesha-raghunathan
pip install qiskit # Useful packages for the next gates experiments import numpy as np from qiskit import QuantumCircuit, QuantumRegister from qiskit import execute from qiskit.tools.visualization import circuit_drawer from qiskit import Aer backend = Aer.get_backend('unitary_simulator') # Pauli X : bit-f...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister # Build a quantum circuit circuit = QuantumCircuit(3, 3) circuit.x(1) circuit.h(range(3)) circuit.cx(0, 1) circuit.measure(range(3), range(3)); print(circuit) circuit.draw() # Matplotlib Drawing circuit.draw(output='mpl') # Dra...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
import numpy as np from qiskit import QuantumCircuit, transpile from qiskit.providers.fake_provider import FakeVigoV2 from qiskit.visualization import plot_circuit_layout from qiskit.tools.monitor import job_monitor from qiskit.providers.fake_provider import FakeVigoV2 import matplotlib.pyplot as plt ghz = Qua...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import IBMQ IBMQ.load_account() provider = IBMQ.get_provider(hub="ibm-q", group="open", project="main") program_id = "qaoa" qaoa_program = provider.runtime.program(program_id) print(f"Program name: {qaoa_program.name}, Program id: {qaoa_program.program_id}") print(qaoa_program.parameters()) ...
https://github.com/qiskit-community/qiskit-aqt-provider
qiskit-community
# This code is part of Qiskit. # # (C) Alpine Quantum Technologies GmbH 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 modi...
https://github.com/rubenandrebarreiro/ibm-qiskit-quantum-explorers-2023-2024
rubenandrebarreiro
# build your code here answer1 = [1] # run this cell to submit your answer # import the grader for the exercise 1 of the lab/badge 5 from qc_grader.challenges.quantum_explorers23 import grade_badge5_ex1 # expected result type: List grade_badge5_ex1(answer1) # build your code here answer2 = [2] # run ...
https://github.com/Z-928/Bugs4Q
Z-928
from qiskit.circuit import Parameter from qiskit import pulse from qiskit.test.mock.backends.almaden import * phase = Parameter('phase') with pulse.build(FakeAlmaden()) as phase_test_sched: pulse.shift_phase(phase, pulse.drive_channel(0)) phase_test_sched.instructions # ()
https://github.com/Harcipan/QAI_GroverSim
Harcipan
from qiskit import transpile, QuantumCircuit import qiskit.quantum_info as qi from qiskit_aer import AerSimulator from qiskit_aer.noise import NoiseModel, amplitude_damping_error from qiskit.visualization import plot_histogram # CNOT matrix operator with qubit-0 as control and qubit-1 as target g_op = qi.Op...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import execute, pulse d0 = pulse.DriveChannel(0) with pulse.build() as pulse_prog: pulse.play(pulse.Constant(100, 1.0), d0) pulse_prog.draw()
https://github.com/ahkatlio/QHSO_Basics_of_Qiskit
ahkatlio
import sys sys.path.append('../') from circuits import sampleCircuitA, sampleCircuitB1, sampleCircuitB2,\ sampleCircuitB3, sampleCircuitC, sampleCircuitD, sampleCircuitE,\ sampleCircuitF from entanglement import Ent import warnings warnings.filterwarnings('ignore') labels = [ 'Circuit A', 'Ci...
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/qiskit-community/community.qiskit.org
qiskit-community
from qiskit import * # z measurement of qubit 0 measure_z = QuantumCircuit(1,1) measure_z.measure(0,0); # x measurement of qubit 0 measure_x = QuantumCircuit(1,1) measure_x.h(0) measure_x.measure(0,0); qc = QuantumCircuit(1) qc.h(0) # the hadamard qc.x(0) # x gate qc.y(0) # y gate qc.z(0) # z ...
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) # You can reverse the order of the qubits. from qiskit.quantum_info import DensityMatrix qc = QuantumCircuit(2) qc.h([0, 1]) qc.t...
https://github.com/shesha-raghunathan/DATE2019-qiskit-tutorial
shesha-raghunathan
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import execute # Choose the drawer you like best: from qiskit.tools.visualization import matplotlib_circuit_drawer as draw #from qiskit.tools.visualization import circuit_drawer as draw from qiskit import IBMQ IBMQ.load_accounts...
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/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute, assemble, Aer from qiskit.tools.visualization import plot_histogram from math import pi import matplotlib.pyplot as plt q = QuantumRegister(1,'q') c = ClassicalRegister(1,'c') qc = QuantumCircuit(q, c) qc.h(0) qc.measure(0,0) qc....
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/swe-train/qiskit__qiskit
swe-train
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 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/abbarreto/qiskit2
abbarreto
import sympy from sympy import * import numpy as np from numpy import random import math import scipy init_printing(use_unicode=True) from matplotlib import pyplot as plt %matplotlib inline from sympy.physics.quantum.dagger import Dagger from sympy.physics.quantum import TensorProduct as tp from mpmath impor...
https://github.com/jdanielescanez/quantum-solver
jdanielescanez
#!/usr/bin/env python3 # Author: Daniel Escanez-Exposito from crypto.six_state.participant import Participant from qiskit import QuantumCircuit from numpy.random import rand from qiskit import transpile ## The Receiver entity in the Six-State implementation ## @see https://qiskit.org/textbook/ch-algorithms...
https://github.com/2lambda123/Qiskit-qiskit
2lambda123
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 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/Z-928/Bugs4Q
Z-928
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit.wrapper import available_backends, get_backend from qiskit.wrapper import execute as q_execute q = QuantumRegister(2, name='q') c = ClassicalRegister(2, name='c') qc = QuantumCircuit(q,c) qc.h(q[0]) qc.h(q[1]) qc.cx(q[0], q[1]...
https://github.com/magn5452/QiskitQaoa
magn5452
#------------------------------------------------------------------------------ # Qaoa.py # # Implementation of the Quantum Approximate Optimization Algorithm (QAOA) [1],[2] # specifically tailored for solving the MaxCut problem on graphs [3]. # This class facilitates the creation of QAOA circuits with # variou...
https://github.com/nicomeyer96/qiskit-torch-module
nicomeyer96
# This code is part of Qiskit-Torch-Module. # # If used in your project please cite this work as described in the README file. # # 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://w...
https://github.com/quantumjim/pewpew_qiskit_workshops
quantumjim
%matplotlib notebook import pew pew.init() screen = pew.Pix() # create a border of B=2 pixels for A in range(8): for B in [0,7]: screen.pixel(A,B,2) screen.pixel(B,A,2) # the player is a B=3 pixel X,Y = 4,6 screen.pixel(X,Y,3) while True: # loop which checks for user input and...
https://github.com/swe-bench/Qiskit__qiskit
swe-bench
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017. # # 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/jonasmaziero/computacao_quantica_qiskit
jonasmaziero
pip install qiskit pip install qiskit-ignis import qiskit qiskit.IBMQ.save_account('17efde49764005e8eeb00dd065d44bc208778be72d44b475e508d20504818786f842988b0e506515c78debdd1b0c4b570717863db5e4f85569fb43c4c8626b8a', overwrite = True) qiskit.IBMQ.load_account() import numpy as np import ma...
https://github.com/daimurat/qiskit-implementation
daimurat
# Import requisite modules import math import operator import logging import traceback import datetime import sys import numpy as np import matplotlib.pyplot as plt %matplotlib inline # Import Qiskit packages import qiskit from qiskit import Aer from qiskit.circuit.library import TwoLocal from qiskit.a...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import BasicAer, transpile, QuantumRegister, ClassicalRegister, QuantumCircuit qr = QuantumRegister(1) cr = ClassicalRegister(1) qc = QuantumCircuit(qr, cr) qc.h(0) qc.measure(0, 0) qc.x(0).c_if(cr, 0) qc.measure(0, 0) qc.draw('mpl')
https://github.com/hamburgerguy/Quantum-Algorithm-Implementations
hamburgerguy
"""The following is python code utilizing the qiskit library that can be run on extant quantum hardware using 5 qubits for factoring the integer 15 into 3 and 5. Using period finding, for a^r mod N = 1, where a = 11 and N = 15 (the integer to be factored) the problem is to find r values for this identity such that...
https://github.com/swe-bench/Qiskit__qiskit
swe-bench
# This code is part of Qiskit. # # (C) Copyright IBM 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 modifications or...
https://github.com/swe-bench/Qiskit__qiskit
swe-bench
# Copyright 2022-2023 Ohad Lev. # 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, # or in the root directory of this package("LICE...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import QuantumCircuit from qiskit.quantum_info import Clifford, random_clifford qc = QuantumCircuit(3) cliff = random_clifford(2) qc.append(cliff, [0, 1]) qc.ccx(0, 1, 2) qc.draw('mpl')
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
import matplotlib.pyplot as plt from qiskit import QuantumCircuit, transpile from qiskit.providers.fake_provider import FakeAuckland backend = FakeAuckland() ghz = QuantumCircuit(15) ghz.h(0) ghz.cx(0, range(1, 15)) depths = [] gate_counts = [] non_local_gate_counts = [] levels = [str(x) for x in range(4)...
https://github.com/miamico/Quantum_Generative_Adversarial_Networks
miamico
%%capture %pip install qiskit %pip install qiskit_ibm_provider %pip install qiskit-aer # Importing standard Qiskit libraries from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, QuantumCircuit, transpile, Aer from qiskit_ibm_provider import IBMProvider from qiskit.tools.jupyter import * from...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit.circuit import QuantumCircuit,\ ParameterVector theta = ParameterVector('θ', 3) qc = QuantumCircuit(3) qc.h([0,1,2]) qc.p(theta[0],0) qc.p(theta[1],1) qc.p(theta[2],2) qc.draw() import math b_qc = qc.bind_parameters({theta: [math.pi/8, ...
https://github.com/AMevans12/Quantum-Codes-Qiskit-Module-
AMevans12
my_list = [1,3,5,2,4,2,5,8,0,7,6] #classical computation method def oracle(my_input): winner =7 if my_input is winner: response = True else: response = False return response for index, trial_number in enumerate(my_list): if oracle(trial_number) is True: pri...
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/noamsgl/IBMAscolaChallenge
noamsgl
%%capture %pip install qiskit %pip install qiskit_ibm_provider %pip install qiskit-aer # Importing standard Qiskit libraries from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, QuantumCircuit, transpile, Aer from qiskit_ibm_provider import IBMProvider from qiskit.tools.jupyter import * from...
https://github.com/weiT1993/qiskit_helper_functions
weiT1993
import sys, math, logging import numpy as np from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, QiskitError class HWEA: """ Class to implement a hardware efficient ansatz for the QAOA algorithm. Based on the community detection circuit implemented by Francois-Marie Le Régent. ...
https://github.com/abhik-99/Qiskit-Summer-School
abhik-99
!pip install -U -r grading_tools/requirements.txt from IPython.display import clear_output clear_output() import numpy as np; pi = np.pi from qiskit import QuantumCircuit, Aer, execute from qiskit.visualization import plot_histogram from copy import deepcopy as make_copy def prepare_hets_circuit(depth, ang...
https://github.com/theflyingrahul/qiskitsummerschool2020
theflyingrahul
#!/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/JamesTheZhang/Qiskit2023
JamesTheZhang
from qiskit.circuit import ClassicalRegister, QuantumRegister, QuantumCircuit, Parameter theta = Parameter('θ') qr = QuantumRegister(1, 'q') qc = QuantumCircuit(qr) qc.ry(theta, 0) qc.draw('mpl') tele_qc = qc.copy() bell = QuantumRegister(2, 'Bell') alice = ClassicalRegister(2, 'Alice') bob = ClassicalRe...
https://github.com/swe-bench/Qiskit__qiskit
swe-bench
# This code is part of Qiskit. # # (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 modifications or deriv...
https://github.com/peiyong-addwater/Hackathon-QNLP
peiyong-addwater
import collections import pickle from tqdm.notebook import tqdm import warnings warnings.filterwarnings("ignore") import os from random import shuffle import re import spacy from discopy.tensor import Tensor from discopy import Word from discopy.rigid import Functor import seaborn as sns import pandas as p...
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/Harcipan/QAI_GroverSim
Harcipan
import numpy as np from qiskit import QuantumCircuit from qiskit.quantum_info import Kraus, SuperOp from qiskit.visualization import plot_histogram from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager from qiskit_aer import AerSimulator # Import from Qiskit Aer noise module from qiski...
https://github.com/swe-bench/Qiskit__qiskit
swe-bench
# This code is part of Qiskit. # # (C) Copyright IBM 2021, 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/hugoecarl/TSP-Problem-Study
hugoecarl
with open('in-exemplo.txt', 'r') as f: print(f.read()) with open('out-exemplo.txt', 'r') as f: print(f.read()) import time import matplotlib.pyplot as plt import pandas as pd import os import subprocess %matplotlib inline #Roda entradas def roda_com_entrada(executavel, arquivo_in, envs = '1', d...
https://github.com/alpine-quantum-technologies/qiskit-aqt-provider-rc
alpine-quantum-technologies
# This code is part of Qiskit. # # (C) Copyright IBM 2019, Alpine Quantum Technologies 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....