repo
stringclasses
885 values
file
stringclasses
741 values
content
stringlengths
4
215k
https://github.com/MonitSharma/Qiskit-Summer-School-and-Quantum-Challenges
MonitSharma
### Install Qiskit and relevant packages, if needed ### IMPORTANT: Make sure you are using python 3.10 or 3.11 for compatibility of the required packages %pip install qiskit[visualization]==1.0.2 %pip install qiskit-ibm-runtime %pip install qiskit-aer %pip install qiskit-transpiler-service %pip install graphviz ...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import pulse dc = pulse.DriveChannel d0, d1, d2, d3, d4 = dc(0), dc(1), dc(2), dc(3), dc(4) with pulse.build(name='pulse_programming_in') as pulse_prog: pulse.play([1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1], d0) pulse.play([1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0...
https://github.com/1chooo/Quantum-Oracle
1chooo
#program 5.1a Define classical oracle f1 and test it def f1(x): return '1' print(f1('000'),f1('001'),f1('010'),f1('011'),f1('100'),f1('101'),f1('110'),f1('111')) #program 5.1b Define classical oracle f2 and test it def f2(x): if x[0]=='0': return '0' else: return '1' print(f2('000'),f2('001'),...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import QuantumCircuit from qiskit.algorithms import AmplificationProblem # the state we desire to find is '11' good_state = ['11'] # specify the oracle that marks the state '11' as a good solution oracle = QuantumCircuit(2) oracle.cz(0, 1) # define Grover's algorithm problem = AmplificationPro...
https://github.com/mgg39/qiskit-networks
mgg39
# -*- 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/epelaaez/QuantumLibrary
epelaaez
from qiskit import QuantumCircuit, Aer, execute from math import pi import numpy as np from qiskit.visualization import plot_bloch_multivector, plot_histogram qc = QuantumCircuit(2) qc.h(0) qc.h(1) qc.cx(0,1) qc.draw() statevector_backend = Aer.get_backend('statevector_simulator') final_state = execute(qc...
https://github.com/xtophe388/QISKIT
xtophe388
import getpass, time from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit from qiskit import available_backends, execute, register, least_busy # import basic plot tools from qiskit.tools.visualization import plot_histogram, circuit_drawer APItoken = getpass.getpass('Please input your token and...
https://github.com/jonasmaziero/computacao_quantica_qiskit
jonasmaziero
%run init.ipynb %run init.ipynb p = symbols('p') Ubf = Matrix([[sqrt(1-p),-sqrt(p),0,0],[0,0,sqrt(p),sqrt(1-p)],[0,0,sqrt(1-p),-sqrt(p)],[sqrt(p),sqrt(1-p),0,0]]) Ubf Ubf*Ubf.T, Ubf.T*Ubf g = symbols('gamma') Uad = Matrix([[sqrt(1-g),0,0,sqrt(g)],[0,1,0,0],[0,0,1,0],[-sqrt(g),0,0,sqrt(1-g)]]) Uad, Uad*U...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit_aer.utils import approximate_quantum_error, approximate_noise_model import numpy as np # Import Aer QuantumError functions that will be used from qiskit_aer.noise import amplitude_damping_error, reset_error, pauli_error from qiskit.quantum_info import Kraus gamma = 0.23 error = amplitude_dampi...
https://github.com/carstenblank/dc-qiskit-algorithms
carstenblank
# Copyright 2021 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 applicable law or agreed to in...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
# Import requisite modules import math import datetime import numpy as np import matplotlib.pyplot as plt %matplotlib inline # Import Qiskit packages from qiskit.algorithms.minimum_eigensolvers import NumPyMinimumEigensolver, QAOA, SamplingVQE from qiskit.algorithms.optimizers import COBYLA from qiskit.c...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
import json 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 import ParameterVector from qiskit.circuit.library import ZFeatureMap from qiskit.quantum_info import Spar...
https://github.com/toticavalcanti/qiskit_examples
toticavalcanti
from qiskit import IBMQ IBMQ.save_account('seu token') from qiskit import * qr = QuantumRegister(2) cr = ClassicalRegister(2) circuit = QuantumCircuit(qr, cr) %matplotlib inline circuit.draw() circuit.h(0) circuit.draw(output='mpl') circuit.cx(0,1) # order is: control(0) and target(1) circui...
https://github.com/maryrbarros2/QuantumAlgorithms_Qiskit
maryrbarros2
import numpy as np from qiskit import QuantumCircuit, transpile from qiskit.providers.aer import QasmSimulator from qiskit.visualization import plot_histogram # Create a Quantum Circuit acting on a quantum register of three qubits circ = QuantumCircuit(3) #default, each qubit in the register is initialized to...
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/renatawong/classical-shadow-vqe
renatawong
''' (C) 2023 Renata Wong Electronic structure problem with classical shadows, as presented in https://arxiv.org/abs/2103.07510 This code uses Qiskit as platform. The shadow is constructed based on derandomized Hamiltonian. The molecules tested are: H2 (6-31s basis), LiH (sto3g basis), BeH2 (sto3g), H2O (sto3g),...
https://github.com/kaelynj/Qiskit-HubbardModel
kaelynj
%matplotlib inline import sys sys.path.append('./src') # 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 * import matplotlib.p...
https://github.com/C2QA/bosonic-qiskit
C2QA
from qiskit import QuantumCircuit from . import circuit_constructor, circuit_eq def test_circuit_constructor(): gates_list = ["h", "hs", "hs", "i", "i", "h"] result = circuit_constructor(gates_list) result_dag = circuit_constructor(gates_list, True) expected = QuantumCircuit(6) expected...
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/bagmk/Quantum_Machine_Learning_Express
bagmk
from qiskit import * from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit import IBMQ, Aer, execute,assemble,QuantumCircuit, aqua from qiskit.visualization import plot_histogram, plot_bloch_vector, plot_bloch_multivector from qiskit.quantum_info import Statevector from qiskit.extension...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
# If you introduce a list with less colors than bars, the color of the bars will # alternate following the sequence from the list. import numpy as np from qiskit.quantum_info import DensityMatrix from qiskit import QuantumCircuit from qiskit.visualization import plot_state_paulivec qc = QuantumCircuit(2) qc....
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import IBMQ, transpile from qiskit import QuantumCircuit from qiskit_aer import AerSimulator from qiskit.tools.visualization import plot_histogram from qiskit.providers.fake_provider import FakeVigo device_backend = FakeVigo() # Construct quantum circuit circ = QuantumCircuit(3, 3) circ.h(0) ci...
https://github.com/AlphaMiyaL/Qiskit-Quantum-Journey
AlphaMiyaL
#Qiskit Categories #Terra - Foundation, where we build and test our circuit #Aer - Simulator, simulation of circuit theoretically #Ignis - Masks noise, helps understand/mitigate error #energy relaxation - scenario - leave qbit in energized state, will eventually relax to zero state #Measurement error mitigation ...
https://github.com/abbarreto/qiskit3
abbarreto
from qiskit_ibm_runtime import QiskitRuntimeService # Save an IBM Quantum account. QiskitRuntimeService.save_account(channel='ibm_quantum', #channel='ibm_cloud', token='17efde49764005e8eeb00dd065d44bc208778be72d44b475e508d20504818786f842988b0e506...
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/shesha-raghunathan/DATE2019-qiskit-tutorial
shesha-raghunathan
from os import listdir as ld files = [ff for ff in ld('bronze') if ff[:1] == 'B'] sols = [ff for ff in ld('bronze-solutions') if ff[:1] == 'B'] files.sort() sols.sort() for ss in files: print('- ['+ss+'](bronze/'+ss+')') tt = [ff for ff in sols if ff[:3]==ss[:3]] if len(tt) > 0: print('...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit.utils import algorithm_globals algorithm_globals.random_seed = 42 from qiskit.circuit import Parameter from qiskit import QuantumCircuit params1 = [Parameter("input1"), Parameter("weight1")] qc1 = QuantumCircuit(1) qc1.h(0) qc1.ry(params1[0], 0) qc1.rx(params1[1], 0) qc1.draw("mpl") from q...
https://github.com/rickapocalypse/final_paper_qiskit_sat
rickapocalypse
from qiskit import* from qiskit.providers.aer import QasmSimulator from qiskit.tools.visualization import plot_histogram from qiskit.tools.monitor import job_monitor import matplotlib.pyplot as plt quantum_register = QuantumRegister(2) # Linhas do circuito / numeros de Qbit no circuito """ Para medir, em ...
https://github.com/EdoardoZappia/Qiskit-Primitive
EdoardoZappia
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, IBMQ, BasicAer from qiskit.visualization import plot_bloch_multivector,plot_bloch_vector, plot_histogram from qiskit.quantum_info import Statevector import numpy as np import matplotlib backend = BasicAer.get_backend('qasm_simu...
https://github.com/tanishabassan/QAOA-Maxcut
tanishabassan
import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import matplotlib.axes as axes import numpy as np from scipy import linalg as la from itertools import permutations from functools import partial import networkx as nx # importing the QISKit from qiskit import QuantumCircuit, Qu...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import QuantumCircuit qc = QuantumCircuit(2, 2) qc.h(0) qc.cx(0, 1) qc.measure([0, 1], [0, 1]) qc.draw('mpl')
https://github.com/mmetcalf14/Hamiltonian_Downfolding_IBM
mmetcalf14
from qiskit_chemistry import FermionicOperator, QMolecule from qiskit_chemistry.aqua_extensions.components.initial_states import HartreeFock from qiskit_chemistry.aqua_extensions.components.variational_forms import UCCSD from qiskit_chemistry import QMolecule as qm from qiskit_aqua.components.optimizers import CO...
https://github.com/harshagarine/QISKIT_INDIA_CHALLENGE
harshagarine
### WRITE YOUR CODE BETWEEN THESE LINES - START # import libraries that are used in the function below. from qiskit import QuantumCircuit import numpy as np ### WRITE YOUR CODE BETWEEN THESE LINES - END def build_state(): # initialize a 3 qubit circuit qc = QuantumCircuit(3) qc...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
from IPython.display import IFrame; IFrame("https://www.ibm.com/quantum", 900,500) import csv with open('ibm_lagos_calibrations_2023-09-28T17_22_25Z.csv', newline='') as csvfile: spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|') for row in spamreader: print(', '.join(row)) import ...
https://github.com/2lambda123/Qiskit-qiskit
2lambda123
# 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/Pitt-JonesLab/mirror-gates
Pitt-JonesLab
from qiskit.circuit.library import SwapGate, CXGate from qiskit.quantum_info import random_unitary from qiskit.extensions import UnitaryGate from monodromy.haar import expected_cost from qiskit.circuit.library import iSwapGate, XXPlusYYGate, CXGate import numpy as np from monodromy.render import gates_to_coverage...
https://github.com/OccumRazor/implement-quantum-algotirhms-with-qiskit
OccumRazor
from qiskit import QuantumRegister,ClassicalRegister,QuantumCircuit,Aer,execute from qiskit.providers.aer import QasmSimulator from qiskit.circuit.library.standard_gates import CU1Gate from numpy import pi from qiskit_code.classicalMethod import printCounts,Dec2Bi,modifyExpValue from qiskit_code.quantumMethod impo...
https://github.com/dlyongemallo/qiskit-zx-transpiler
dlyongemallo
import sys; sys.path.append('..') from qiskit import transpile from qiskit.circuit import QuantumCircuit from qiskit.transpiler import PassManager from qiskit.qasm2 import dumps from qiskit.qasm3 import dumps as dumps3 import pyzx as zx from zxpass import ZXPass pass_manager = PassManager(ZXPass()) # Sel...
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
import matplotlib.pyplot as plt %matplotlib inline import numpy as np from qiskit.algorithms import IterativeAmplitudeEstimation, EstimationProblem from qiskit.circuit.library import LinearAmplitudeFunction from qiskit_aer.primitives import Sampler from qiskit_finance.circuit.library import LogNormalDistribut...
https://github.com/HypsoHypso/QuantumComputingScripts
HypsoHypso
# Importing all the necessary library from qiskit import QuantumCircuit, Aer, IBMQ, QuantumRegister, ClassicalRegister, execute from qiskit.tools.jupyter import * from qiskit.visualization import * import qiskit.tools.jupyter import ipywidgets as widgets # Layout button_p = widgets.Button( description='Pl...
https://github.com/qiskit-community/qiskit-aqt-provider
qiskit-community
# This code is part of Qiskit. # # (C) Copyright 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. # ...
https://github.com/2lambda123/Qiskit-qiskit
2lambda123
# 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/swe-bench/Qiskit__qiskit
swe-bench
# 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 derivative works of this code must retain this # copyright notice, an...
https://github.com/qiskit-community/qiskit-dell-runtime
qiskit-community
from qiskit import QuantumCircuit, execute, transpile from dell_runtime import DellRuntimeProvider provider = DellRuntimeProvider() provider.remote('http://qdr-dev.oro-sandbox-small1.k8s.cec.lab.emc.com') provider.runtime.programs() RUNTIME_PROGRAM = """ from qiskit.compiler import transpile, schedule ...
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/dkp-quantum/Tutorials
dkp-quantum
%matplotlib inline # Importing standard Qiskit libraries and configuring account from qiskit import * from qiskit.visualization import * import numpy as np def encoding_x(qc): qc.cx(0,1) qc.cx(0,2) qc.barrier() def decoding_x(qc): qc.cx(0,2) qc.cx(0,1) qc.barrier() def random_...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
# You can set a color for all the bars. from qiskit import QuantumCircuit from qiskit.quantum_info import Statevector from qiskit.visualization import plot_state_paulivec qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) state = Statevector(qc) plot_state_paulivec(state, color='midnightblue', title="New PauliVec...
https://github.com/GIRISHBELANI/QC_Benchmarks_using_dm-simulator
GIRISHBELANI
min_qubits=4 max_qubits=8 max_circuits=1 num_shots=1 backend_id="dm_simulator" #hub="ibm-q"; group="open"; project="main" provider_backend = None exec_options = {} # # ========================== # # *** If using IBMQ hardware, run this once to authenticate # from qiskit import IBMQ # IBMQ.save_account('Y...
https://github.com/xtophe388/QISKIT
xtophe388
#import all the packages # Checking the version of PYTHON import sys if sys.version_info < (3,5): raise Exception('Please use Python version 3.5 or greater.') #append to system path so qiskit and Qconfig can be found from home directory sys.path.append('../qiskit-sdk-py/') # Import the QuantumProgram a...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit.algorithms.minimum_eigensolvers import NumPyMinimumEigensolver, QAOA, SamplingVQE from qiskit.algorithms.optimizers import COBYLA from qiskit.circuit.library import TwoLocal from qiskit.result import QuasiDistribution from qiskit_aer.primitives import Sampler from qiskit_finance.applications.optimizati...
https://github.com/animeshnanda1/my_QAOA_qiskit
animeshnanda1
import qiskit qiskit.__qiskit_version__ # import warnings; warnings.filterwarnings("ignore") import numpy as np import networkx as nx import matplotlib.pyplot as plt from collections import defaultdict from operator import itemgetter from scipy.optimize import minimize from qiskit import QuantumCircuit, Quan...
https://github.com/zeynepCankara/Introduction-Quantum-Programming
zeynepCankara
from random import randrange for experiment in [100,1000,10000,100000]: heads = tails = 0 for i in range(experiment): if randrange(2) == 0: heads = heads + 1 else: tails = tails + 1 print("experiment:",experiment) print("the ratio of #heads/#tails is",(heads/tails),"heads =",hea...
https://github.com/UST-QuAntiL/nisq-analyzer-content
UST-QuAntiL
import requests from qiskit import QuantumCircuit import json def get_circuit(**kwargs): adj_matrix = kwargs["adj_matrix"] betas = kwargs["betas"] gammas = kwargs["gammas"] data = json.dumps({"adj_matrix": adj_matrix, "betas": betas, "gammas": gammas, }) headers = {"Content-Type": "appli...
https://github.com/xin-0/QC-jupyter
xin-0
# circuit construction and execution: # - circuit, register, classical bit, executor, simulator from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, BasicAer # Visualization: # - basis amplitudes, bloch vector from qiskit.visualization import plot_histogram, plot_bloch_multivecto...
https://github.com/MonitSharma/Learn-Quantum-Machine-Learning
MonitSharma
import pennylane as qml from pennylane import numpy as np dev_fock = qml.device("strawberryfields.fock", wires=2, cutoff_dim=2) @qml.qnode(dev_fock, diff_method="parameter-shift") def photon_redirection(params): qml.FockState(1, wires=0) qml.Beamsplitter(params[0], params[1], wires=[0, 1]) return...
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 CNOT gate qc.cx(1,0) #Draw the circuit # qc.draw() qc...
https://github.com/qiskit-community/community.qiskit.org
qiskit-community
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, Aer, execute def NOT(input): q = QuantumRegister(1) # a qubit in which to encode the inout c = ClassicalRegister(1) # a bit to store the output qc = QuantumCircuit(q, c) # this is where the quantum program goes # We encode '0' a...
https://github.com/HuangJunye/Qiskit-for-GameDev
HuangJunye
# # Copyright 2019 the original author or authors. # # 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 applicab...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
import numpy as np # Import Qiskit from qiskit import QuantumCircuit, transpile from qiskit_aer import AerSimulator # Construct quantum circuit circ = QuantumCircuit(2, 2) circ.h(0) circ.cx(0, 1) circ.measure([0,1], [0,1]) # Select the AerSimulator from the Aer provider simulator = AerSimulator(method='...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. """Unit tests for PEC.""" import warnings from functools import partial from typing import List, Optional import cirq import numpy as np import ...
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/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit import pulse d0 = pulse.DriveChannel(0) x90 = pulse.Gaussian(10, 0.1, 3) x180 = pulse.Gaussian(10, 0.2, 3) with pulse.build() as hahn_echo: with pulse.align_equispaced(duration=100): pulse.play(x90, d0) pulse.play(x180, d0) pulse.play(x90, d0) hahn_echo.draw()
https://github.com/jonasmaziero/computacao_quantica_qiskit
jonasmaziero
%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/Rassska/QuantumPack
Rassska
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from numpy import pi qreg_q = QuantumRegister(2, 'q') creg_c = ClassicalRegister(2, 'c') circuit = QuantumCircuit(qreg_q, creg_c) circuit.reset(qreg_q[0]) circuit.h(qreg_q[0]) circuit.reset(qreg_q[1]) circuit.cx(qreg_q[0], qreg_q[1]) cir...
https://github.com/quantum-melbourne/qiskit-challenge-22
quantum-melbourne
import matplotlib.pyplot as plt import numpy as np from qiskit.utils import algorithm_globals seed = 12345 algorithm_globals.random_seed = seed from qiskit_machine_learning.datasets import ad_hoc_data train_features, train_labels, test_features, test_labels, adhoc_total = ad_hoc_data( training_size=2...
https://github.com/Chibikuri/Quantum-Othello
Chibikuri
import kivy from kivy.app import App from kivy.uix.label import Label from kivy.uix.gridlayout import GridLayout from kivy.uix.textinput import TextInput from kivy.uix.button import Button from kivy.uix.screenmanager import ScreenManager, Screen from kivy.graphics import * from kivy.uix.splitter import Splitte...
https://github.com/tuf65651/quantum-research
tuf65651
# %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 qiskit.tools.jupyter import * from qiskit.visualization import * from datetime import da...
https://github.com/ohadlev77/sat-circuits-engine
ohadlev77
# 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
import datetime import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt plt.rcParams.update({"text.usetex": True}) plt.rcParams["figure.figsize"] = (6,4) mpl.rcParams["figure.dpi"] = 200 from qiskit_ibm_runtime import Estimator, Session, QiskitRuntimeService, Options from qiskit.quantum_in...
https://github.com/jtiosue/QAOAPython
jtiosue
import qiskit, time from numpy import pi # define pi so that in string gates we can have pi as an angle. # Because we use eval for string gates. For example, gate = "rz(pi/2, 1)". name = "IBM" simulators = simulator, unitary_simulator, state_simulator = ( "qasm_simulator", "unitary_simulator", "stat...
https://github.com/swe-bench/Qiskit__qiskit
swe-bench
# This code is part of Qiskit. # # (C) Copyright IBM 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 deriv...
https://github.com/jonasmaziero/computacao_quantica_qiskit
jonasmaziero
%run init.ipynb 1 + cos(2*pi/3) + 1j*sin(2*pi/3) + cos(4*pi/3) + 1j*sin(4*pi/3) 1 + cos(4*pi/3) + 1j*sin(4*pi/3) + cos(8*pi/3) + 1j*sin(8*pi/3) cos(2*pi/3), cos(4*pi/3)
https://github.com/DaisukeIto-ynu/KosakaQ
DaisukeIto-ynu
# 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/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/JackHidary/quantumcomputingbook
JackHidary
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/riddheshMarkandeya/shors-algorithm-quantum
riddheshMarkandeya
import math import numpy as np from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, Aer, execute from qiskit.quantum_info.operators import Operator from qiskit.circuit.library import CU1Gate from qiskit.visualization import plot_histogram from fractions import Fraction # Provided helper funct...
https://github.com/lynnlangit/learning-quantum
lynnlangit
#!/usr/bin/env python # coding: utf-8 # # Solving linear systems of equations using HHL and its Qiskit implementation # In this tutorial, we introduce the HHL algorithm, derive the circuit, and implement it using Qiskit. We show how to run the HHL on a simulator and on a five qubit device. # ## Contents # 1....
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/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/Z-928/Bugs4Q
Z-928
# https://github.com/Qiskit/qiskit-terra/issues/2373 # Importing needed libraries from qiskit import * from qiskit.mapper import Layout import numpy as np import matplotlib as mp import matplotlib.pyplot as plt from scipy.optimize import curve_fit # Enable use of real device IBMQ.load_accounts() backend...
https://github.com/kerenavnery/qmail
kerenavnery
from qiskit import * from qiskit.quantum_info import Statevector #From Marc import parser #From Luca import socket from SocketChannel2 import SocketChannel class Channel: def __init__(self,slave_offset=0, myport=000, remote_port=000): self._state_vector = None self._arr_qub...
https://github.com/abhilash1910/EuroPython-21-QuantumDeepLearning
abhilash1910
!pip install pennylane # example of training a gan on mnist from numpy import expand_dims from numpy import zeros from numpy import ones from numpy import vstack from numpy.random import randn from numpy.random import randint import tensorflow as tf from keras.datasets.mnist import load_data from keras.opti...
https://github.com/Pitt-JonesLab/slam_decomposition
Pitt-JonesLab
%matplotlib widget import logging logger = logging.getLogger() logger.setLevel(logging.INFO) from slam.basis import CircuitTemplate basis = CircuitTemplate() basis.build(3) basis.spanning_range = range(3, 4) basis.circuit.draw() from slam.cost_function import BasicCost, MakhlinFunctionalCost objecti...
https://github.com/MonitSharma/Qiskit-Summer-School-and-Quantum-Challenges
MonitSharma
from qiskit_nature.drivers import Molecule from qiskit_nature.drivers.second_quantization import ElectronicStructureMoleculeDriver, ElectronicStructureDriverType molecule = Molecule( # coordinates are given in Angstrom geometry=[ ["O", [0.0, 0.0, 0.0]], ["H", [0.758602, 0.0, 0.504284]], ...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit_nature.circuit.library import UCCSD ansatz = UCCSD() ansatz.num_spin_orbitals = 10 from qiskit_nature.second_q.circuit.library import UCCSD ansatz = UCCSD() ansatz.num_spatial_orbitals = 5 from qiskit_nature.circuit.library import UCC, UVCC ucc = UCC(qubit_converter=None, num_particles=None...
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/ElePT/qiskit-algorithms-test
ElePT
# This code is part of Qiskit. # # (C) Copyright IBM 2021, 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/ttlion/ShorAlgQiskit
ttlion
""" This is the final implementation of Shor's Algorithm using the circuit presented in section 2.3 of the report about the first simplification introduced by the base paper used. As the circuit is completely general, it is a rather long circuit, with a lot of QASM instructions in the generated Assembly code, wh...
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_state_qsphere qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) state = Statevector(qc) plot_state_qsphere(state)
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/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/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/BOBO1997/osp_solutions
BOBO1997
import numpy as np import matplotlib.pyplot as plt from pprint import pprint import pickle import time import datetime # Import qubit states Zero (|0>) and One (|1>), and Pauli operators (X, Y, Z) from qiskit.opflow import Zero, One from qiskit import QuantumCircuit, QuantumRegister, IBMQ, execute, transpile,...
https://github.com/Andres8bit/IBMQ-Quantum-Qiskit
Andres8bit
import numpy as np # Importing standard Qiskit libraries from qiskit import QuantumCircuit, transpile, Aer, IBMQ from qiskit.tools.jupyter import * from qiskit.visualization import * from ibm_quantum_widgets import * from qiskit.providers.aer import QasmSimulator # Loading your IBM Quantum account(s) provid...
https://github.com/qiskit-community/qiskit-translations-staging
qiskit-community
from qiskit_optimization import QuadraticProgram problem = QuadraticProgram("sample") problem.binary_var("x") problem.binary_var("y") problem.maximize(linear={"x": 1, "y": -2}) print(problem.prettyprint()) from qiskit.algorithms import NumPyMinimumEigensolver from qiskit_optimization.algorithms import Mini...
https://github.com/msramalho/Teach-Me-Quantum
msramalho
import math # importing Qiskit from qiskit import Aer, IBMQ from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, execute from qiskit.backends.ibmq import least_busy # useful additional packages from qiskit.wrapper.jupyter import * from qiskit.tools.visualization import plot_histogram IB...
https://github.com/xtophe388/QISKIT
xtophe388
# useful additional packages import matplotlib.pyplot as plt %matplotlib inline import numpy as np from math import pi import sys # importing the QISKit from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import available_backends, execute, register, get_backend # importing A...
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/BryceFuller/qiskit_camp
BryceFuller
#!/usr/bin/env python # coding: utf-8 # Python import math # Local # External import numpy as np from qiskit import QuantumCircuit, QuantumRegister import qiskit.aqua def PrepareMultiDeterminantState(weights, determinants, normalize=True, mode='basic'): ''' Constructs multideterminant s...