repo
stringclasses
885 values
file
stringclasses
741 values
content
stringlengths
4
215k
https://github.com/jonasmaziero/computacao_quantica_qiskit
jonasmaziero
%run init.ipynb S = Matrix([[1,0],[0,1j]]); Sd = Matrix([[1,0],[0,-1j]]); H = (1/sqrt(2))*Matrix([[1,1],[1,-1]])#; S, H S*H*S from qiskit import * def qc_mzi_sim(ph): # quantum circuit for the Mach-Zehnder interferometer qr = QuantumRegister(1); qc = QuantumCircuit(qr) qc.u(math.pi/2, math.pi/2, -ma...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import QuantumCircuit, transpile ghz = QuantumCircuit(15) ghz.h(0) ghz.cx(0, range(1, 15)) ghz.draw(output='mpl')
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
import random from qiskit.quantum_info import Statevector secret = random.randint(0,7) # the owner is randomly picked secret_string = format(secret, '03b') # format the owner in 3-bit string oracle = Statevector.from_label(secret_string) # let the oracle know the owner from qiskit.algorithms import Amplific...
https://github.com/Shashankaubaru/NISQ-TDA
Shashankaubaru
# noqa: E501,E402,E401,E128 # flake8 disable errors # -*- coding: utf-8 -*- # Copyright 2018 IBM. # # 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/lice...
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/indian-institute-of-science-qc/qiskit-aakash
indian-institute-of-science-qc
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/swe-bench/Qiskit__qiskit
swe-bench
# 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/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/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/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/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/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit_optimization.problems import QuadraticProgram # define a problem qp = QuadraticProgram() qp.binary_var("x") qp.integer_var(name="y", lowerbound=-1, upperbound=4) qp.maximize(quadratic={("x", "y"): 1}) qp.linear_constraint({"x": 1, "y": -1}, "<=", 0) print(qp.prettyprint()) from qiskit_optimizati...
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_lv0 = transpile(ghz, bac...
https://github.com/qonwaygameoflife/qonwaygameoflife
qonwaygameoflife
import numpy as np from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import Aer, execute from qiskit.tools.qi.qi import partial_trace def liveliness(nhood): v=nhood a = v[0][0][0]+v[0][1][0]+v[0][2][0]+v[1][0][0]+v[1][2][0]+v[2][0][0]+v[2][1][0]+v[2][2][0] return a...
https://github.com/QuSTaR/kaleidoscope
QuSTaR
# -*- coding: utf-8 -*- # This code is part of Kaleidoscope. # # (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....
https://github.com/jonasmaziero/computacao_quantica_qiskit
jonasmaziero
https://github.com/qiskit-community/community.qiskit.org
qiskit-community
#Import general libraries (needed for functions) import numpy as np import matplotlib.pyplot as plt #Import Qiskit classes classes import qiskit from qiskit.providers.aer.noise import NoiseModel from qiskit.providers.aer.noise.errors.standard_errors import depolarizing_error, thermal_relaxation_error #Import...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import QuantumCircuit from qiskit.quantum_info import Operator from qiskit.transpiler.passes import UnitarySynthesis circuit = QuantumCircuit(1) circuit.rx(0.8, 0) unitary = Operator(circuit).data unitary_circ = QuantumCircuit(1) unitary_circ.unitary(unitary, [0]) synth = UnitarySynthesis(basi...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
import numpy as np import matplotlib.pyplot as plt from qiskit import QuantumRegister, QuantumCircuit from qiskit.circuit.library import IntegerComparator from qiskit.algorithms import IterativeAmplitudeEstimation, EstimationProblem from qiskit_aer.primitives import Sampler # set problem parameters n_z = 2 ...
https://github.com/minnukota381/Quantum-Computing-Qiskit
minnukota381
%matplotlib inline # Importing standard Qiskit libraries and configuring account from qiskit import QuantumCircuit, execute, Aer, IBMQ from qiskit.compiler import transpile, assemble from qiskit.tools.jupyter import * from qiskit.visualization import * # Loading your IBM Q account(s) provider = IBMQ.load_account...
https://github.com/0xCAB0/shor_algorithm
0xCAB0
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 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/Ilan-Bondarevsky/qiskit_algorithm
Ilan-Bondarevsky
import sys sys.path.insert(0, "D:/myProjects/AfekaCodeProjects/codeProjects/FinalProject_qiskit/qiskit_algorithm/qft_results.ipynb") from shor_algorithm.shor_algo_adder_method import qft_dagger, qft, set_start_state import numpy as np import matplotlib.pyplot as plt from qiskit import BasicAer, execute from qiski...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import pulse with pulse.build(name='my_example') as my_program: # Add instructions here pass my_program from qiskit.pulse import DriveChannel channel = DriveChannel(0) from qiskit.providers.fake_provider import FakeValencia backend = FakeValencia() with pulse.build(backend=bac...
https://github.com/codigoscupom/QuantumAlgs
codigoscupom
# -*- 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/swe-bench/Qiskit__qiskit
swe-bench
# 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/jacobfeder/quantum_cadets
jacobfeder
import numpy as np import matplotlib.pyplot as plt from scipy import signal from qiskit import * from qiskit.circuit import ControlledGate, Gate, Instruction, Qubit, QuantumRegister, QuantumCircuit from qiskit.visualization import plot_histogram from qiskit.circuit.library.standard_gates import C4XGate, TGate, XG...
https://github.com/mlvqc/Byskit
mlvqc
from qiskit.tools.jupyter import * from qiskit import IBMQ IBMQ.load_account() #provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main') provider = IBMQ.get_provider(hub='ibm-q-oxford', group='on-boarding', project='on-boarding-proj') from qiskit import QuantumRegister, ClassicalRegister from q...
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), ] ) print(f"Number of qubits: {...
https://github.com/victor-onofre/Quantum_Algorithms
victor-onofre
import numpy as np import networkx as nx import matplotlib.pyplot as plt from scipy.optimize import minimize from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer style = {'backgroundcolor': 'lightyellow'} # Style of the drawing of the quantum circuit Graph_Example_1 = nx.Graph(...
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/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit_nature.drivers.second_quantization import GaussianForcesDriver from qiskit_nature.problems.second_quantization import VibrationalStructureProblem from qiskit_nature.settings import settings settings.dict_aux_operators = True driver = GaussianForcesDriver(logfile="aux_files/CO2_freq_B3LYP_631g.log") ...
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 = ['p', 'state', 'probability', 'mean'] length_p = 10 with open('qaoa_multiple_p.csv', 'w', encoding='UTF8') as f: writer = ...
https://github.com/PavanCyborg/Quantum-Algorithms-Benchmarking
PavanCyborg
#Assign these values as per your requirements. global min_qubits,max_qubits,skip_qubits,max_circuits,num_shots,Noise_Inclusion min_qubits=1 max_qubits=3 skip_qubits=1 max_circuits=3 num_shots=1000 use_XX_YY_ZZ_gates = True Noise_Inclusion = False saveplots = False Memory_utilization_plot = True Type_...
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/indian-institute-of-science-qc/qiskit-aakash
indian-institute-of-science-qc
# 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/qiskit-translations-staging
qiskit-community
# External imports from pylab import cm from sklearn import metrics import numpy as np import matplotlib.pyplot as plt # Qiskit imports from qiskit import QuantumCircuit from qiskit.circuit import ParameterVector from qiskit.visualization import circuit_drawer from qiskit.algorithms.optimizers import SPSA f...
https://github.com/bibscore/qiskit_kindergarten
bibscore
import os from qiskit import * import qiskit.tools.visualization as qt from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from numpy import pi import matplotlib.pyplot as plt %matplotlib inline qreg_q = QuantumRegister(3, 'q') creg_c = ClassicalRegister(3, 'c') circuit = QuantumCircuit(q...
https://github.com/AlphaMiyaL/Qiskit-Quantum-Journey
AlphaMiyaL
import qiskit qiskit.__qiskit_version__ from qiskit import IBMQ IBMQ.save_account('d3d29913a9b505c699f877ab1ade9d7729ee46bf49670047e44a106ff692c5efec8ff03873c1fe6f1d4e76e090e6177ab37bd7c5beb08c2fa1096316c0dc1006') IBMQ.load_account()
https://github.com/muehlhausen/vqls-bachelor-thesis
muehlhausen
# all libraries used by some part of the VQLS-implementation from qiskit import ( QuantumCircuit, QuantumRegister, ClassicalRegister, Aer, execute, transpile, assemble ) from qiskit.circuit import Gate, Instruction from qiskit.quantum_info.operators import Operator from qiskit.extensions import ZGate...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import QuantumCircuit, transpile, schedule from qiskit.visualization.timeline import draw from qiskit.providers.fake_provider import FakeBoeblingen qc = QuantumCircuit(2) qc.h(0) qc.cx(0,1) qc = transpile(qc, FakeBoeblingen(), scheduling_method='alap', layout_method='trivial') draw(qc)
https://github.com/derivation/ThinkQuantum
derivation
import numpy as np from numpy import pi import matplotlib.pyplot as plt import matplotlib.image as mpimg filename = './schrodin_yang.png' im = mpimg.imread(filename) fig, ax = plt.subplots() ax.imshow(im) from skimage.transform import resize n_pixels = 2**5 im = resize(im, (n_pixels, n_pixels)) fig, a...
https://github.com/qBraid/qBraid
qBraid
# Copyright (C) 2024 qBraid # # This file is part of the qBraid-SDK # # The qBraid-SDK is free software released under the GNU General Public License v3 # or later. You can redistribute and/or modify it under the terms of the GPL v3. # See the LICENSE file in the project root or <https://www.gnu.org/licenses/gpl-...
https://github.com/tuf65651/quantum-research
tuf65651
#!/usr/bin/env python # coding: utf-8 # In[13]: get_ipython().run_line_magic('matplotlib', 'inline') # Importing standard Qiskit libraries and configuring account from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, IBMQ from qiskit.compiler import transpile, assemble from q...
https://github.com/jonasmaziero/computacao_quantica_qiskit
jonasmaziero
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/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/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/joe5218/Quantum-Distortions
joe5218
from qiskit import IBMQ, QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import execute, QuantumRegister from qiskit.qasm import pi from qiskit.tools.visualization import plot_histogram, circuit_drawer from qiskit import execute, Aer, BasicAer import numpy as np import random import keras from ke...
https://github.com/swe-bench/Qiskit__qiskit
swe-bench
"""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/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.draw('mpl')
https://github.com/mathelatics/QGSS-2023-From-Theory-to-Implementations
mathelatics
import qiskit qiskit.__qiskit_version__ from math import pi import numpy as np import scipy as sp import matplotlib.pyplot as plt %matplotlib inline # importing Qiskit from qiskit import BasicAer, IBMQ from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import execute from q...
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/2lambda123/Qiskit-qiskit
2lambda123
# -*- 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/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import QuantumCircuit, transpile, schedule from qiskit.visualization.pulse_v2 import draw 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(qc, FakeBoe...
https://github.com/swe-train/qiskit__qiskit
swe-train
# 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/AbeerVaishnav13/Quantum-Programs
AbeerVaishnav13
from qiskit import QuantumCircuit alice_key = '11100100010001001001001000001111111110100100100100010010010001010100010100100100101011111110001010100010010001001010010010110010' alice_bases = '11000110011000100001100101110000111010011001111111110100010111010100000100011001101010100001010010101011010001011001110011...
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/2lambda123/Qiskit-qiskit
2lambda123
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 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...
https://github.com/mmetcalf14/Hamiltonian_Downfolding_IBM
mmetcalf14
# -*- 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/2lambda123/Qiskit-qiskit
2lambda123
# This code is part of Qiskit. # # (C) Copyright IBM 2023, 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...
https://github.com/Tojarieh97/VQE
Tojarieh97
%load_ext autoreload %autoreload 2 from qiskit.circuit.library.standard_gates import RXGate, RZGate, RYGate, CXGate, CZGate, SGate, HGate from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister import numpy as np def get_linear_entangelment_ansatz(num_of_qubits, thetas, input_state, circuit_dep...
https://github.com/IceKhan13/purplecaffeine
IceKhan13
import os from qiskit.circuit.random import random_circuit from qiskit.quantum_info.random import random_pauli from qiskit.primitives import Estimator from purplecaffeine.core import Trial, LocalStorage n_qubits = 4 depth = 3 shots = 2000 circuit = random_circuit(n_qubits, depth) circuit.draw(fold=-1) ...
https://github.com/indian-institute-of-science-qc/qiskit-aakash
indian-institute-of-science-qc
# 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/qiskit-translations-staging
qiskit-community
import torch from qiskit.utils import algorithm_globals algorithm_globals.random_seed = 123456 _ = torch.manual_seed(123456) # suppress output import numpy as np num_dim = 2 num_discrete_values = 8 num_qubits = num_dim * int(np.log2(num_discrete_values)) from scipy.stats import multivariate_normal c...
https://github.com/yaleqc/vqe-error-mitigation
yaleqc
#Assign these values as per your requirements. global min_qubits,max_qubits,skip_qubits,max_circuits,num_shots,Noise_Inclusion min_qubits=4 max_qubits=15 #reference files are upto 12 Qubits only skip_qubits=2 max_circuits=3 num_shots=4092 gate_counts_plots = True Noise_Inclusion = False saveplots = False...
https://github.com/nahumsa/Introduction-to-IBM_Qiskit
nahumsa
import scipy as sp import numpy as np import matplotlib.pyplot as plt import qiskit from qiskit import QuantumCircuit, transpile, Aer, IBMQ from qiskit.providers.aer.noise import NoiseModel from qiskit.utils import QuantumInstance # Loading your IBM Q account(s) provider = IBMQ.load_account() def run_obs...
https://github.com/Qiskit/qiskit-neko
Qiskit
# This code is part of Qiskit. # # (C) Copyright IBM 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 deriv...
https://github.com/shesha-raghunathan/DATE2019-qiskit-tutorial
shesha-raghunathan
from IPython.display import YouTubeVideo YouTubeVideo('BYKc2RnQMqo', width=858, height=540) !pip install qiskit --quiet !pip install qiskit-aer --quiet !pip install pylatexenc --quiet # @markdown ### **1. Import `Qiskit` and essential packages** { display-mode: "form" } from qiskit import QuantumCircuit, tran...
https://github.com/aryashah2k/Quantum-Computing-Collection-Of-Resources
aryashah2k
import matplotlib.pyplot as plt %matplotlib inline import numpy as np from qiskit import * from qiskit.tools.visualization import plot_histogram from IPython.display import display, Math, Latex def Decrement(n): U = QuantumCircuit(n) control = [x for x in range(n-1)] for k in range(n-1): ...
https://github.com/quantumyatra/quantum_computing
quantumyatra
from qiskit import QuantumRegister, ClassicalRegister from qiskit import QuantumCircuit, execute, Aer, IBMQ from qiskit.visualization import plot_histogram, plot_bloch_multivector import numpy as np import pylab as plt def NOT(input_bit): # initialize the QC q = QuantumRegister(1) c = ...
https://github.com/abbarreto/qiskit3
abbarreto
%run init.ipynb # tem algum problema com a funcao produto tensorial do sympy (implementar eu mesmo ...) k000 = Matrix([1,0,0,0,0,0,0,0]); k001 = Matrix([0,1,0,0,0,0,0,0]) k010 = Matrix([0,0,1,0,0,0,0,0]); k011 = Matrix([0,0,0,1,0,0,0,0]) k100 = Matrix([0,0,0,0,1,0,0,0]); k101 = Matrix([0,0,0,0,0,1,0,0]) k110 = M...
https://github.com/mcoggins96/Quantum-Computing-UK-Repository
mcoggins96
from qiskit import IBMQ from qiskit.aqua.algorithms import Grover from qiskit.aqua.components.oracles import TruthTableOracle IBMQ.enable_account('ENTER API KEY HERE') provider = IBMQ.get_provider(hub='ibm-q') backend = provider.get_backend('ibmq_qasm_simulator') expression = '11000001' oracle = TruthTab...
https://github.com/Pitt-JonesLab/mirror-gates
Pitt-JonesLab
from transpile_benchy.metrics.gate_counts import ( DepthMetric, TotalMetric, TotalSwaps, ) from qiskit.circuit.library import iSwapGate from qiskit.transpiler import CouplingMap from mirror_gates.pass_managers import Mirage, QiskitLevel3 from mirror_gates.utilities import SubsMetric from mirror_gat...
https://github.com/tomtuamnuq/compare-qiskit-ocean
tomtuamnuq
import logging from itertools import product import networkx as nx import matplotlib.pyplot as plt from qiskit import IBMQ, QuantumCircuit, execute, transpile from qiskit.test.mock import FakeMumbai as FakeDevice from qiskit.providers.aer.noise import NoiseModel from qiskit.visualization import plot_histogr...
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 ## The Sender entity in the Six-State implementation ## @see https://qiskit.org/textbook/ch-algorithms/quantum-key-distribution.html class Sender(Participant): #...
https://github.com/indian-institute-of-science-qc/qiskit-aakash
indian-institute-of-science-qc
# 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/NesyaLab/qaoa
NesyaLab
import warnings warnings.filterwarnings('ignore') import os path = os.getcwd() os.chdir(os.path.dirname(path)) from classes import Problems instance = Problems.Problems(verbose=True) instance.get_draw() print(instance.G == instance.get_graph()) print(instance.get_graph()) print(instance.G.nod...
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/JessicaJohnBritto/Quantum-Computing-and-Information
JessicaJohnBritto
# initialization import numpy as np import matplotlib # importing Qiskit from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, IBMQ, BasicAer, assemble, transpile from qiskit.quantum_info import Statevector # import basic plot tools ...
https://github.com/pedroripper/qiskit_tutoriais
pedroripper
# Importando módulos from qiskit import * from qiskit.tools.visualization import plot_histogram # Inicializando o circuito nQubits = 2 nBits = 2 circuitoQuantico = QuantumCircuit(nQubits, nBits) # Para aplicar uma porta no circuito devemos seguir o seguinte exemplo onde aplicamos uma Hadamard Gate circu...
https://github.com/matheusmtta/Quantum-Machine-Learning
matheusmtta
import numpy as np import pennylane as qml from pennylane.optimize import NesterovMomentumOptimizer n = 6 backend = qml.device("default.qubit", wires = n) def layerBlock(wgt): for q_i in range(n): qml.Rot(wgt[q_i, 0], wgt[q_i, 1], wgt[q_i, 2], wires = q_i) for q_i in range(n): ...
https://github.com/goodrahstar/hello-quantum-world
goodrahstar
pip install pylatexenc !pip install qiskit from qiskit import IBMQ, Aer, QuantumCircuit, ClassicalRegister, QuantumRegister, execute from qiskit.providers.ibmq import least_busy from qiskit.quantum_info import Statevector from qiskit.visualization import plot_histogram # Create a Quantum Register called "qr...
https://github.com/minnukota381/Quantum-Computing-Qiskit
minnukota381
from qiskit import QuantumCircuit qc = QuantumCircuit(1) qc.x(0) qc.y(0) qc.draw('mpl') from qiskit.visualization import visualize_transition visualize_transition(qc)
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/rodneyosodo/variational-quantum-classifier-on-heartattack
rodneyosodo
# Basis encoding example with PennyLane import pandas as pd import pennylane as qml from pennylane import numpy as np # import the template from pennylane.templates.layers import StronglyEntanglingLayers from sklearn.utils import shuffle from sklearn.preprocessing import normalize from pennylane.templates.embed...
https://github.com/jmamczynska/QiskitLabs
jmamczynska
from qiskit import * from qiskit.visualization import plot_histogram from qiskit.visualization import plot_state_qsphere, plot_bloch_vector from qiskit.quantum_info import Statevector import numpy as np sim = Aer.get_backend('aer_simulator') qr = QuantumRegister(3) qc_3qx = QuantumCircuit(qr) ### your...
https://github.com/a24l/IBM_Qiskit_QGSS
a24l
# 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/shesha-raghunathan/DATE2019-qiskit-tutorial
shesha-raghunathan
from datasets import * from qiskit_aqua.utils import split_dataset_to_data_and_labels, map_label_to_class_name from qiskit import Aer from qiskit_aqua.input import SVMInput from qiskit_aqua import run_algorithm, QuantumInstance from qiskit_aqua.algorithms import QSVMVariational from qiskit_aqua.components.optimiz...
https://github.com/alexyev/quantum_options_pricing
alexyev
#!pip install qiskit #!pip install qiskit_finance import matplotlib.pyplot as plt %matplotlib inline import numpy as np from qiskit import Aer, QuantumCircuit from qiskit.utils import QuantumInstance from qiskit.algorithms import IterativeAmplitudeEstimation, EstimationProblem from qiskit.circuit.library ...
https://github.com/Qubico-Hack/tutorials
Qubico-Hack
!pip install qiskit !pip install qiskit-aer import numpy as np import matplotlib.pyplot as plt import torch from torch.autograd import Function from torchvision import datasets, transforms import torch.optim as optim import torch.nn as nn import torch.nn.functional as F import qiskit from qiskit impo...
https://github.com/Qiskit/feedback
Qiskit
import numpy as np from qiskit.providers.basicaer import BasicAer from qiskit.utils import QuantumInstance from qiskit.algorithms import VQE from qiskit.algorithms.optimizers import L_BFGS_B from qiskit.opflow.gradients import Gradient from qiskit_nature.algorithms import AdaptVQE, VQEUCCFactory from qiskit_na...
https://github.com/SaashaJoshi/IBM-Qiskit-Summer-School-2020
SaashaJoshi
!pip install -U -r grading_tools/requirements.txt from IPython.display import clear_output clear_output() # our backend is the Pulse Simulator from resources import helper from qiskit.providers.aer import PulseSimulator backend_sim = PulseSimulator() # sample duration for pulse instructions dt = 1e-9 ...
https://github.com/mmetcalf14/Hamiltonian_Downfolding_IBM
mmetcalf14
# -*- 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/swe-train/qiskit__qiskit
swe-train
# This code is part of Qiskit. # # (C) Copyright IBM 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 deriv...
https://github.com/Axect/QuantumAlgorithms
Axect
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/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import QuantumCircuit from qiskit.quantum_info import Operator from qiskit.transpiler.passes import UnitarySynthesis circuit = QuantumCircuit(1) circuit.rx(0.8, 0) unitary = Operator(circuit).data unitary_circ = QuantumCircuit(1) unitary_circ.unitary(unitary, [0]) synth = UnitarySynthesis(basi...
https://github.com/GroenteLepel/qiskit-quantum-knn
GroenteLepel
# -*- 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/quantumjim/qreative
quantumjim
import sys sys.path.append('../') import CreativeQiskit grid = CreativeQiskit.random_grid(5,4) grid.neighbours( (2,2) ) grid_stats,grid_data = grid.get_samples(shots=3) for sample in grid_stats: print(grid_stats[sample],'shots returned the grid state\n') print(sample,'\n') for sample in grid_...
https://github.com/1chooo/Quantum-Oracle
1chooo
from qiskit import QuantumRegister, QuantumCircuit qrx = QuantumRegister(3, 'x') qry = QuantumRegister(1, 'y') qc = QuantumCircuit(qrx, qry) qc.cx(qrx[0], qry) qc.draw("mpl")
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit.utils import algorithm_globals from qiskit.algorithms.minimum_eigensolvers import QAOA, NumPyMinimumEigensolver from qiskit.algorithms.optimizers import COBYLA from qiskit.primitives import Sampler from qiskit_optimization.algorithms import ( MinimumEigenOptimizer, RecursiveMinimumEigenOptimiz...