repo stringclasses 885
values | file stringclasses 741
values | content stringlengths 4 215k |
|---|---|---|
https://github.com/2lambda123/Qiskit-qiskit | 2lambda123 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 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/GabrielPontolillo/Quantum_Algorithm_Implementations | GabrielPontolillo | from qiskit import QuantumCircuit
def create_bell_pair():
qc = QuantumCircuit(2)
qc.h(1)
qc.cx(1, 0)
return qc
def encode_message(qc, qubit, msg):
if len(msg) != 2 or not set([0,1]).issubset({0,1}):
raise ValueError(f"message '{msg}' is invalid")
if msg[1] == "1":
#... |
https://github.com/magn5452/QiskitQaoa | magn5452 | import numpy as np
from matplotlib import pyplot as plt
from qiskit import QuantumCircuit, Aer, transpile, assemble
from qiskit.circuit import Gate
from qiskit.circuit import Parameter
from qiskit.extensions import UnitaryGate, HamiltonianGate
from qiskit.providers.aer import StatevectorSimulator
from qiskit.vis... |
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/indian-institute-of-science-qc/qiskit-aakash | indian-institute-of-science-qc | # -*- coding: utf-8 -*-
# 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.... |
https://github.com/sebasmos/QuantumVE | sebasmos | #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 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/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit
# Create a circuit with a register of three qubits
circ = QuantumCircuit(3)
# H gate on qubit 0, putting this qubit in a superposition of |0> + |1>.
circ.h(0)
# A CX (CNOT) gate on control qubit 0 and target qubit 1 generating a Bell state.
circ.cx(0, 1)
# CX (CNOT) gate on cont... |
https://github.com/swe-train/qiskit__qiskit | swe-train | # 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 | 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-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/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/PabloMartinezAngerosa/QAOA-uniform-convergence | PabloMartinezAngerosa |
from thirdParty.classical import rand_graph, classical, bitstring_to_path, calc_cost
from utils import mapeo_grafo
import qiskit
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
f... |
https://github.com/abbarreto/qiskit2 | abbarreto | %run init.ipynb
rx,ry,rz = symbols('r_x r_y r_z')
rho1qb = (1/2)*(id(2) + rx*pauli(1) + ry*pauli(2) + rz*pauli(3))
rho1qb
pI,pX,pZ,pY = symbols('p_I p_X p_Z p_Y')
K0 = sqrt(pI)*id(2); K1 = sqrt(pX)*pauli(1); K2 = sqrt(pZ)*pauli(3); K3 = sqrt(pY)*pauli(2)
rho_p = K0*rho1qb*K0 + K1*rho1qb*K1 + K2*rho1qb*K2 + ... |
https://github.com/rubenandrebarreiro/summer-school-on-quantum-computing-software-for-near-term-quantum-devices-2020 | rubenandrebarreiro | #initialization
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import math
# importing Qiskit
from qiskit import IBMQ, BasicAer
from qiskit.providers.ibmq import least_busy
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute
# import basic plot tools
from ... |
https://github.com/tanishabassan/QAOA-Maxcut | tanishabassan | import numpy as np
from matplotlib import pyplot as plt
from qiskit import Aer
from qiskit.visualization import plot_histogram
from scipy.optimize import minimize
from VehicleRouting.standard.factories.MaxCutFactories import TwoConnectedMaxCutFactory
from VehicleRouting.standard.problems.MaxCutProblem import Ma... |
https://github.com/jvscursulim/qamp_fall22_project | jvscursulim | import matplotlib.pyplot as plt
from neqr import NEQR
from qiskit import execute
from qiskit.providers.aer.backends import AerSimulator
from qiskit.quantum_info import Statevector
from skimage import data
from skimage.color import rgb2gray
from skimage.transform import resize
neqr_class = NEQR()
backend = ... |
https://github.com/urwin419/QiskitChecker | urwin419 | from qiskit import QuantumCircuit
def create_bell_pair():
qc = QuantumCircuit(2)
qc.h(1)
qc.cx(1, 0)
return qc
def encode_message(qc, qubit, msg):
if len(msg) != 2 or not set([0,1]).issubset({0,1}):
raise ValueError(f"message '{msg}' is invalid")
if msg[1] == "1":
q... |
https://github.com/jenglick/scipy22-qiskit-runtime-tutorial | jenglick | # Import the module needed to access Qiskit Runtime
from qiskit_ibm_runtime import QiskitRuntimeService
# Save account on disk.
# QiskitRuntimeService.save_account(channel="ibm_quantum", token=<IBM Quantum API token>)
# Load your IBM Quantum account or enable the account if it's not previously saved.
service ... |
https://github.com/Naphann/Solving-TSP-Grover | Naphann | #initialization
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
# importing Qiskit
from qiskit import IBMQ, BasicAer, Aer
from qiskit.providers.ibmq import least_busy
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute
# import basic plot tools
from qiskit.t... |
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/ncitron/qiskit-hack | ncitron | class QuantComp:
def __init__(qboard, classical):
qboard.classical = classical
def convert(cboard):
ret = []
for i in range(len(cboard)):
if cboard[i] == 1:
hold = str(bin(i))
while(len(hold) < 7):
hold = ... |
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/quantastica/qiskit-toaster | quantastica | from qiskit import Aer, QuantumCircuit, execute
from qiskit.compiler import transpile, assemble
from quantastica.qiskit_toaster import ToasterBackend
import time
import logging
import os
backend = ToasterBackend.get_backend("qasm_simulator")
# backend = Aer.get_backend("qasm_simulator")
default_options = {
... |
https://github.com/unif2/Quantum-Computing-Mentorship-Task-4-Code | unif2 | import numpy as np
from numpy import kron
import qiskit as qk
def decomposition(H):
"""Decompose any 4x4 Hermitian matrix into a sum of tensor products of two Pauli matrices
"""
identity = np.array([[1, 0],[ 0, 1]], dtype=np.complex128)
x = np.array([[0, 1], [ 1, 0]], dtype=np.complex128)
... |
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 | import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
from qiskit import QuantumCircuit
from qiskit.algorithms import IterativeAmplitudeEstimation, EstimationProblem
from qiskit.circuit.library import LinearAmplitudeFunction
from qiskit_aer.primitives import Sampler
from qiskit_finance.circui... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | # Create circuit to test transpiler on
from qiskit import QuantumCircuit
from qiskit.circuit.library import GroverOperator, Diagonal
oracle = Diagonal([1]*7 + [-1])
qc = QuantumCircuit(3)
qc.h([0,1,2])
qc = qc.compose(GroverOperator(oracle))
# Use Statevector object to calculate the ideal output
from qiskit.q... |
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/daimurat/qiskit-implementation | daimurat | # データ取得に必要なpandas, pandas_datareaderのインストール
!pip install pandas pandas_datareader
import numpy as np
import pandas as pd
import pandas_datareader.data as web
import datetime
import matplotlib.pyplot as plt
from qiskit import Aer
from qiskit.circuit.library import QFT
from qiskit.aqua import QuantumInstance... |
https://github.com/Axect/QuantumAlgorithms | Axect | from qiskit import QuantumCircuit,Aer, execute
from qiskit.visualization import plot_histogram
import numpy as np
import matplotlib.pyplot as plt
def check_computational_basis(basis):
n = int(np.log2(len(basis)))
qc = QuantumCircuit(n,n)
initial_state = np.array(basis) / np.linalg.norm(basis)
... |
https://github.com/henrik-dreyer/MPS-in-Qiskit | henrik-dreyer | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 5 17:51:05 2019
@author: henrikdreyer
Indexing convention for all tensors
2-A-3
|
1
1
|
2-A-3
"""
from ncon import ncon
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister
fr... |
https://github.com/sebasmos/QuantumVE | sebasmos | import numpy as np
import qiskit.pulse as pulse
from qiskit.circuit import Parameter
from qiskit_experiments.calibration_management.backend_calibrations import BackendCalibrations
from qiskit import IBMQ, schedule
API_KEY = "5bd4ecfdc74e6680da7c79998259781431661e5326ae2f88eea95dee8f74b87530ba63fbca8105404d... |
https://github.com/DaisukeIto-ynu/KosakaQ | DaisukeIto-ynu | # -*- 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/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/VedDharkar/IBM_QISKIT_EXAM_C1000-112 | VedDharkar |
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 import *
# Loading your IBM Q account(s)
#provider = IBMQ.load_account()
q = Q... |
https://github.com/adarsh1chand/Qiskit-Mentorship-Program-2021 | adarsh1chand | import numpy as np
#Operator Imports
from qiskit import QuantumRegister, QuantumCircuit
from qiskit.opflow import X, Y, Z, I, Zero, StateFn, CircuitStateFn, SummedOp, ListOp, PauliExpectation, PauliSumOp
from qiskit.opflow.gradients import Gradient, Hessian
from qiskit.circuit import Parameter
from qiskit.utils... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from __future__ import annotations
import numpy as np
import networkx as nx
num_nodes = 4
w = np.array([[0., 1., 1., 0.],
[1., 0., 1., 1.],
[1., 1., 0., 1.],
[0., 1., 1., 0.]])
G = nx.from_numpy_array(w)
layout = nx.random_layout(G, seed=10)
colors = ['r', 'g', ... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | # You can make the bars more transparent to better see the ones that are behind
# if they overlap.
import numpy as np
from qiskit.quantum_info import Statevector
from qiskit.visualization import plot_state_city
from qiskit import QuantumCircuit
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc = QuantumCir... |
https://github.com/MonitSharma/qiskit-projects | MonitSharma | #imports
import qiskit
import numpy as np
from qiskit.visualization import plot_histogram
# model
class Model:
simulator = qiskit.Aer.get_backend('qasm_simulator')
def draw_current_circuit(self):
print(self.add_circuit.draw())
# initialize 2 qubits
def __init__(self):
... |
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/MonitSharma/Qiskit-Summer-School-and-Quantum-Challenges | MonitSharma | from qiskit import QuantumCircuit, QuantumRegister
from qiskit.quantum_info import SparsePauliOp
def heisenberg_hamiltonian(
length: int, jx: float = 1.0, jy: float = 0.0, jz: float = 0.0
) -> SparsePauliOp:
terms = []
for i in range(length - 1):
if jx:
terms.append(("XX", [i... |
https://github.com/2lambda123/Qiskit-qiskit | 2lambda123 | # 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/Chibikuri/qwopt | Chibikuri | import sys
sys.path.append('../../')
import unittest
import numpy as np
from qwopt.compiler.op_creater import OperationCreator
from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister
from qiskit import Aer, execute, transpile
STATE_VECTOR = Aer.get_backend('statevector_simulator')
QASM = Aer.get... |
https://github.com/cjsproject/qiskit_learning | cjsproject | %matplotlib inline
# Importing standard Qiskit libraries
from qiskit import QuantumCircuit, execute, Aer, IBMQ
from qiskit.compiler import transpile, assemble
from qiskit.tools.jupyter import *
from qiskit.visualization import *
from ibm_quantum_widgets import *
# Loading your IBM Q account(s)
provider = IBMQ... |
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()
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-bench/Qiskit__qiskit | swe-bench | # 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.
#
# Any modifications or deriv... |
https://github.com/qiskit-community/qiskit-bip-mapper | qiskit-community | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or deriv... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit.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/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience | PacktPublishing | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created Nov 2020
@author: hassi
"""
# Import the required math
import numpy as np
import random #To create random state vector
import cmath #To juggle complex exponentials
from math import sqrt, pi, sin, cos
from IPython.core.display import display
... |
https://github.com/shesha-raghunathan/DATE2019-qiskit-tutorial | shesha-raghunathan | """A quantum tic tac toe running in command line"""
from qiskit import Aer
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import CompositeGate
from qiskit import execute
import numpy as np
from composite_gates import cry,cnx,any_x,bus_or,x_bus
class Move():
def __init_... |
https://github.com/jonasmaziero/computacao_quantica_qiskit | jonasmaziero | |
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/abbarreto/qiskit4 | abbarreto | |
https://github.com/LFL-Lab/metal-library | LFL-Lab | # Qiskit Metal imports
import qiskit_metal as metal
from ... import OpenToGround
from ... import RouteMeander
# Custom Components imports
from metal_library.components.inductive_coupler import InductiveCoupler
class QubitCavity():
def __init__(self, design, options: dict component_name: str, )
... |
https://github.com/ronitd2002/IBM-Quantum-challenge-2024 | ronitd2002 | %pip install git+https://github.com/qiskit-community/Quantum-Challenge-Grader.git --upgrade
# qc-grader should be 0.18.12 (or higher)
import qc_grader
qc_grader.__version__
### Install Qiskit and relevant packages, if needed
### IMPORTANT: Make sure you are on 3.10 > python < 3.12
%pip install qiskit[visual... |
https://github.com/shesha-raghunathan/DATE2019-qiskit-tutorial | shesha-raghunathan | from game_engines.quantum_slot import quantum_slot_machine
quantum_slot_machine()
|
https://github.com/swe-bench/Qiskit__qiskit | swe-bench | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or deriv... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
from qiskit.tools.visualization import plot_histogram
import random
circ = QuantumCircuit(40, 40)
# Initialize with a Hadamard layer
circ.h(range(40))
# Apply some random CNOT and T gates
qubit_indices = [i for i in range(40)... |
https://github.com/quantastica/qiskit-forest | quantastica | # 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/2lambda123/Qiskit-qiskit | 2lambda123 | # 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/qiskit-community/qiskit-pocket-guide | qiskit-community | from qiskit.quantum_info import Statevector
from qiskit.quantum_info import Statevector, \
Operator, state_fidelity
sv_a = Statevector.from_label('+')
sv_b = sv_a.evolve(Operator.from_label('T'))
print(state_fidelity(sv_a, sv_b))
|
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 GmbH 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/LICENS... |
https://github.com/swe-train/qiskit__qiskit | swe-train | # 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/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/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/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit, transpile, schedule
from qiskit.visualization.pulse_v2 import draw, IQXSimple
from qiskit.providers.fake_provider import FakeBoeblingen
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
qc = transpile(qc, FakeBoeblingen(), layout_method='trivial')
sched = schedule(... |
https://github.com/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/Qubico-Hack/tutorials | Qubico-Hack | !pip install qiskit torch torchvision matplotlib
!pip install qiskit-machine-learning
!pip install torchviz
!pip install qiskit[all]
!pip install qiskit == 0.45.2
!pip install qiskit_algorithms == 0.7.1
!pip install qiskit-ibm-runtime == 0.17.0
!pip install qiskit-aer == 0.13.2
#Quentum net draw
!pip insta... |
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 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or deriv... |
https://github.com/mmetcalf14/Hamiltonian_Downfolding_IBM | mmetcalf14 | # -*- 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/MonitSharma/Qiskit-Summer-School-and-Quantum-Challenges | MonitSharma | # Importing standard Qiskit libraries
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit import Aer, assemble
from qiskit.visualization import plot_histogram, plot_bloch_multivector, plot_state_qsphere, plot_state_city, plot_state_paulivec, plot_state_hinton
# Ignore warnings
impor... |
https://github.com/liudingshan/QiskitGrovers | liudingshan | import qiskit as qis
from qiskit.tools.visualization import plot_bloch_multivector
import matplotlib.pyplot as plt
from qiskit.tools.visualization import plot_histogram
import math as math
# Define Registers
qr = qis.QuantumRegister(3)
cr = qis.ClassicalRegister(3)
# Make Circuit
circuit = qis.QuantumCircu... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | #!/usr/bin/env python3
# Author: Daniel Escanez-Exposito, Andrea Hernández Martín
from qiskit import QuantumCircuit
from crypto.six_state.sender import Sender
from crypto.six_state.receiver import Receiver
import binascii
SIX_STATE_SIMULATOR = 'SIX-STATE SIMULATOR'
## An implementation of the Six-State p... |
https://github.com/2lambda123/Qiskit-qiskit | 2lambda123 | # 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/QuTech-Delft/quantuminspire | QuTech-Delft | import numpy as np
import os
from qiskit import transpile, QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit_aer import Aer
from qiskit.providers.basic_provider import BasicProvider
from qiskit.visualization import circuit_drawer, plot_histogram
from IPython.display import display, Math, Latex
f... |
https://github.com/mathelatics/QGSS-2023-From-Theory-to-Implementations | mathelatics | from qiskit import QuantumCircuit, QuantumRegister
from qiskit.quantum_info import SparsePauliOp
def heisenberg_hamiltonian(
length: int, jx: float = 1.0, jy: float = 0.0, jz: float = 0.0
) -> SparsePauliOp:
terms = []
for i in range(length - 1):
if jx:
terms.append(("XX", [i... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | # Useful additional packages
import matplotlib.pyplot as plt
import numpy as np
from math import pi
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, transpile
from qiskit.tools.visualization import circuit_drawer
from qiskit.quantum_info import state_fidelity
from qiskit import BasicAer
... |
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/1chooo/Quantum-Oracle | 1chooo | # %% [markdown]
# # 第3章原始程式碼
# %%
#Program 3.1a Apply X-gate to qubit
from qiskit import QuantumCircuit
qc = QuantumCircuit(2)
qc.x(1)
qc.draw('mpl')
# %%
#Program 3.1b Show Bloch sphere of qubit w/wo X-gate
from qiskit.quantum_info import Statevector
state = Statevector.from_instruction(qc)
state.draw(... |
https://github.com/kerenavnery/qmail | kerenavnery | from qiskit import *
from channel_class import Channel
n_master = 2 # two qubits, the one on alice side
n_slave = 1 # two quantum channels and one qubit on bobs side
master_offset = 0
slave_offset = n_master
circ = QuantumCircuit(n_master + n_slave)
channel = Channel(slave_offset, 5000, remote_port = 50... |
https://github.com/2lambda123/Qiskit-qiskit | 2lambda123 | # 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 deriva... |
https://github.com/hephaex/Quantum-Computing-Awesome-List | hephaex | import numpy as np
import cirq
def main():
circuit = make_bell_test_circuit()
print("Circuit:")
print(circuit)
#Run Simulation
sim = cirq.Simulator()
repetitions = 1000
print("Simulating {} repetitions".format(repetitions))
result = sim.run(program=circuit, repetitions=... |
https://github.com/swe-train/qiskit__qiskit | swe-train | # 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.
#
# Any modifications or deriv... |
https://github.com/jonasmaziero/computacao_quantica_qiskit | jonasmaziero | |
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/JohnBurke4/qaoa_testing_framework | JohnBurke4 | from Image_Reader import ImageReader
from DCT_Classic import DCT
import Quantum_Subroutines
import os
import Image_Compression
import cv2
import matplotlib.pyplot as plt
import numpy as np
from qiskit import QuantumCircuit, Aer, transpile
from qiskit_aer.backends.aerbackend import AerBackend
from qiskit.provi... |
https://github.com/abbarreto/qiskit3 | abbarreto |
0.4*7.6
|
https://github.com/epelaaez/QuantumLibrary | epelaaez | def dswap_test_circuit(qc1: QuantumCircuit, qc2: QuantumCircuit) -> QuantumCircuit:
""" Construct the destructive SWAP test circuit given two circuits.
Args:
qc1(qiskit.QuantumCircuit): Quantum circuit for the
first state.
qc2(qiskit.QuantumCircuit): Quantum circuit for the
... |
https://github.com/abbarreto/qiskit4 | abbarreto |
hub=qc-spring-22-2, group=group-5 and project=recPrYILNAOsYMWIV |
https://github.com/arnavdas88/QuGlassyIsing | arnavdas88 | !pip install qiskit
J = 4.0
B_x = 2.0
B_z = 0.0
import numpy as np
from qiskit.providers.aer import AerSimulator, QasmSimulator
from qiskit.algorithms.optimizers import COBYLA
from qiskit.circuit.library import TwoLocal
from qiskit.aqua.operators import *
from qiskit.aqua import set_qiskit_aqua_logging, Q... |
https://github.com/BoschSamuel/QizGloria | BoschSamuel | # -- coding: utf-8 --
# 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... |
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/GabrielPontolillo/Quantum_Algorithm_Implementations | GabrielPontolillo | import unittest
import cirq
from cirq.ops import H, X, I
import random
import matplotlib.pyplot as plt
import numpy as np
from numpy.random import randint
import hypothesis.strategies as st
from hypothesis import given, settings
def generate_binary(len):
return randint(2, size=len)
def encode_mes... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import transpile
from qiskit import QuantumCircuit
from qiskit.providers.fake_provider import FakeVigoV2
backend = FakeVigoV2()
qc = QuantumCircuit(2, 1)
qc.h(0)
qc.x(1)
qc.cp(np.pi/4, 0, 1)
qc.h(0)
qc.measure([0], [0])
qc_basis = transpile(qc, backend)
qc_basis.draw(output='mpl') |
https://github.com/anpaschool/QC-School-Fall2020 | anpaschool | References
1. https://qiskit.org/textbook/preface.html
2. https://www.youtube.com/watch?v=IT-O-KSWlaE
3. https://www.youtube.com/watch?v=m4zs_fqS0Zw
|
https://github.com/ionq-samples/qiskit-getting-started | ionq-samples | #import Aer here, before calling qiskit_ionq_provider
from qiskit import Aer
from qiskit_ionq import IonQProvider
#Call provider and set token value
ionq_provider = IonQProvider(token='your token')
ionq_provider.backends()
import numpy as np
from qiskit import execute
from qiskit import QuantumCircui... |
https://github.com/Axect/QuantumAlgorithms | Axect | import qiskit
qiskit.__qiskit_version__
# useful additional packages
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# importing Qiskit
from qiskit import BasicAer, IBMQ
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute
from qiskit.compiler import transpi... |
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') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.