repo stringclasses 885
values | file stringclasses 741
values | content stringlengths 4 215k |
|---|---|---|
https://github.com/GabrielPontolillo/Quantum_Algorithm_Implementations | GabrielPontolillo | from qiskit import QuantumCircuit
def create_bell_pair():
qc = QuantumCircuit(2)
qc.h(1)
### added h gate ###
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 inva... |
https://github.com/snow0369/qiskit_tutorial_2021_summerschool | snow0369 | from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, transpile
from qiskit.providers.aer import AerProvider
from qiskit.tools.visualization import plot_histogram
import random
import numpy as np
def ghz(n):
# 객체의 선언
qr_ghz = QuantumRegister(n)
cr_ghz = ClassicalRegister(... |
https://github.com/arnavdas88/QuGlassyIsing | arnavdas88 | import time
import numpy as np
from matplotlib import pyplot as plt
from IPython.display import clear_output
%matplotlib inline
class potts:
def __init__(self, L,q): #Create Potts model
self.L=L #lattice length/width
self.size=L**2 #model size
self.q=q #number of states
self.h=np.zer... |
https://github.com/aryashah2k/Quantum-Computing-Collection-Of-Resources | aryashah2k | #
# your code is here
#
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, execute, Aer
from math import pi, cos, sin
from random import randrange
# quantum circuit with three qubits and three bits
q = QuantumRegister(3,"q")
c = ClassicalRegister(3,"c")
qc = QuantumCircuit(q,c)
# ro... |
https://github.com/2lambda123/Qiskit-qiskit | 2lambda123 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or deriv... |
https://github.com/quantumofme/pavia-qiskit-tutorials | quantumofme | import qiskit as qk
import numpy as np
from scipy.linalg import expm
import matplotlib.pyplot as plt
import math
# Single qubit operators
sx = np.array([[0.0, 1.0],[1.0, 0.0]])
sy = np.array([[0.0, -1.0*1j],[1.0*1j, 0.0]])
sz = np.array([[1.0, 0.0],[0.0, -1.0]])
idt = np.array([[1.0, 0.0],[0.0, 1.0]])
i... |
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/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/magn5452/QiskitQaoa | magn5452 | from operator import xor
import numpy as np
from qiskit import QuantumCircuit
from qiskit.extensions import HamiltonianGate
from qiskit_nature.operators.second_quantization import SpinOp
from VehicleRouting.framework.qaoa.CircuitStrategy import InitialStrategy, MixerStrategy
from VehicleRouting.standard.qaoa.... |
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/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/mmetcalf14/Hamiltonian_Downfolding_IBM | mmetcalf14 | # -*- 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.
#
#... |
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/iqm-finland/qiskit-on-iqm | iqm-finland | # Copyright 2022-2023 Qiskit on IQM developers
#
# 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... |
https://github.com/biswaroopmukherjee/Quantum-Waddle | biswaroopmukherjee | import numpy as np
import time
import networkx as nx
import matplotlib.pyplot as plt
import random
from qiskit import (QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer)
%matplotlib inline
from qiskit import IBMQ
from qiskit.tools.monitor import job_monitor
IBMQ.load_account()
IBMQ.providers()
... |
https://github.com/theRealNoah/qiskit-grovers-3by3 | theRealNoah | # Quantum Computing and Communications Term Project
# Spring 2021 by Noah Hamilton
# Inspired by https://qiskit.org/textbook/ch-algorithms/grover.html#sudoku
# This is the code for the implementation of the Grover's Algorithm solving a
# 3x3 Binary Sudoku.
# Problem Environment + Rules
# Each Column must co... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | import qiskit.qasm3
program = """
OPENQASM 3.0;
include "stdgates.inc";
input float[64] a;
qubit[3] q;
bit[2] mid;
bit[3] out;
let aliased = q[0:1];
gate my_gate(a) c, t {
gphase(a / 2);
ry(a) c;
cx c, t;
}
gate my_phase(a) c {
ctrl ... |
https://github.com/SultanMS/Quantum-Neural-Network | SultanMS | # Quantum NNN: Ver 0.1, By Sultan Almuhammadi and Sarah Alghamdi
# Date: Dec 1, 2021
from sklearn import model_selection, datasets, svm
from qiskit import QuantumCircuit, Aer, IBMQ, QuantumRegister, ClassicalRegister
import qiskit
import numpy as np
import copy
import matplotlib.pyplot as plt1
import matplotli... |
https://github.com/Rodri-rf/playing_with_quantum_computing | Rodri-rf | """Example usage of the Quantum Inspire backend with the Qiskit SDK.
A simple example that demonstrates how to use the SDK to create
a circuit to demonstrate conditional gate execution.
For documentation on how to use Qiskit we refer to
[https://qiskit.org/](https://qiskit.org/).
Specific to Quantum Inspire is the... |
https://github.com/ElePT/qiskit-algorithms-test | ElePT | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or... |
https://github.com/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
provider = IonQProvider(token='My token')
provider.backends()
from qiskit import QuantumCircuit
# Create a bell state circuit.
qc = QuantumCircuit(2, ... |
https://github.com/xtophe388/QISKIT | xtophe388 | # useful additional packages
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
# useful math functions
from math import pi, cos, acos, sqrt
import sys
# importing the QISKit
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import available_backends,... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import pulse
from qiskit.providers.fake_provider import FakeArmonk
backend = FakeArmonk()
with pulse.build(backend) as drive_sched:
d0 = pulse.drive_channel(0)
a0 = pulse.acquire_channel(0)
pulse.play(pulse.library.Constant(10, 1.0), d0)
pulse.delay(20, d0)
pulse.shift_phas... |
https://github.com/qiskit-community/qiskit-jku-provider | qiskit-community | # -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=missing-docstring,redefined-builtin
import unittest
import os
from qiskit import QuantumCircuit... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | # You can choose different colors for the real and imaginary parts of the density matrix.
from qiskit import QuantumCircuit
from qiskit.quantum_info import DensityMatrix
from qiskit.visualization import plot_state_city
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
state = DensityMatrix(qc)
plot_state_city(st... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit_nature.units import DistanceUnit
from qiskit_nature.second_q.drivers import PySCFDriver
driver = PySCFDriver(
atom="H 0 0 0; H 0 0 0.735",
basis="sto3g",
charge=0,
spin=0,
unit=DistanceUnit.ANGSTROM,
)
problem = driver.run()
print(problem)
hamiltonian = problem.hamiltoni... |
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/2lambda123/Qiskit-qiskit | 2lambda123 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or... |
https://github.com/MonitSharma/Qiskit-Summer-School-and-Quantum-Challenges | MonitSharma | ### Install Qiskit and relevant packages, if needed
### IMPORTANT: Make sure you are on 3.10 > python < 3.12
%pip install qiskit[visualization]==1.0.2
%pip install qiskit-ibm-runtime
%pip install qiskit-aer
%pip install graphviz
%pip install qiskit-serverless -U
%pip install qiskit-transpiler-service -U
%pip in... |
https://github.com/joemoorhouse/quantum-mc | joemoorhouse | from math import pi
from qiskit import QuantumRegister, QuantumCircuit, AncillaRegister
from .qft import qft, iqft, cqft, ciqft, ccu1
from qiskit.circuit.library import SXdgGate
# Modified version of qarithmetic https://github.com/hkhetawat/QArithmetic
##########################################################... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | import qiskit.qasm3
program = """
OPENQASM 3.0;
include "stdgates.inc";
input float[64] a;
qubit[3] q;
bit[2] mid;
bit[3] out;
let aliased = q[0:1];
gate my_gate(a) c, t {
gphase(a / 2);
ry(a) c;
cx c, t;
}
gate my_phase(a) c {
ctrl ... |
https://github.com/nmoran/qiskit-qdrift-quid19 | nmoran | import numpy as np
import matplotlib.pyplot as plt
import math
from qiskit import Aer, IBMQ, QuantumRegister, QuantumCircuit
from qiskit.providers.ibmq import least_busy
from qiskit.providers.aer import noise
# lib from Qiskit Aqua
from qiskit.aqua.operators.common import evolution_instruction
from qiskit.a... |
https://github.com/shesha-raghunathan/DATE2019-qiskit-tutorial | shesha-raghunathan | import numpy as np
from qiskit import Aer
from qiskit.transpiler import PassManager
from qiskit_aqua import Operator, QuantumInstance
from qiskit_aqua.algorithms.adaptive import VQE
from qiskit_aqua.algorithms.classical import ExactEigensolver
from qiskit_aqua.components.optimizers import L_BFGS_B
from qiskit_... |
https://github.com/swe-bench/Qiskit__qiskit | swe-bench | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
#... |
https://github.com/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/qiskit-community/qiskit-translations-staging | qiskit-community | import numpy as np
from qiskit import QuantumCircuit
from qiskit.quantum_info import DensityMatrix
from qiskit.visualization import plot_state_hinton
qc = QuantumCircuit(2)
qc.h([0, 1])
qc.cz(0,1)
qc.ry(np.pi/3 , 0)
qc.rx(np.pi/5, 1)
state = DensityMatrix(qc)
plot_state_hinton(state, title="New Hinton Plo... |
https://github.com/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/jonasmaziero/computacao_quantica_qiskit | jonasmaziero | %run init.ipynb
|
https://github.com/mathelatics/QGSS-2023-From-Theory-to-Implementations | mathelatics | my_list = [1,2,3 ,4,5, 6,8,8,3,23,7,75,54,3]
def my_oracle(my_input):
winner=7
if my_input is winner:
response = True
else:
response = False
return response
for index, trial_number in enumerate(my_list):
if my_oracle(trial_number) is True:
print('Winner fo... |
https://github.com/mathelatics/QGSS-2023-From-Theory-to-Implementations | mathelatics | import qiskit
qiskit.__qiskit_version__
#initialization
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
# importing Qiskit
from qiskit import IBMQ, BasicAer
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute
from qiskit.compiler import transpile
from qiski... |
https://github.com/CQCL/pytket-qiskit | CQCL | # Copyright 2019 Cambridge Quantum Computing
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
https://github.com/zhangx1923/QISKit_Deve_Challenge | zhangx1923 | # Import your solution function
from challenge_submission import compiler_function
# Import submission evaluation and scoring functions
from challenge_evaluation import evaluate, score
# Possibly useful other helper function
from challenge_evaluation import qasm_to_dag_circuit, load_coupling, get_layout
# S... |
https://github.com/GroenteLepel/qiskit-quantum-knn | GroenteLepel | import numpy as np
import qiskit as qk
from qiskit.utils import QuantumInstance
import pytest
from qiskit_quantum_knn.qknn import QKNeighborsClassifier
def test_get_all_contrasts():
assert True
def test_calculate_fidelities():
ex_counts = {
'00 0': 10,
'00 1': 1,
'01... |
https://github.com/brhn-4/CMSC457 | brhn-4 | from qutip import *
# 5-qubit system
N = 5
identity = qeye(2)
X = sigmax()
Y = sigmay()
Z = sigmaz()
def pauli_i(N, i, pauli):
# pauli: X Y Z
tmp = [identity for m in range(N)]
tmp[i]=pauli
return tensor(tmp)
n=3
paulix_n = pauli_i(N, n, X)
H0 = 0
for n in range(N):
H0 +=... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | import numpy as np
from qiskit import QuantumCircuit, transpile
from qiskit.quantum_info import Kraus, SuperOp
from qiskit_aer import AerSimulator
from qiskit.tools.visualization import plot_histogram
# Import from Qiskit Aer noise module
from qiskit_aer.noise import (NoiseModel, QuantumError, ReadoutError,
... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | # You can choose different colors for the real and imaginary parts of the density matrix.
from qiskit import QuantumCircuit
from qiskit.quantum_info import DensityMatrix
from qiskit.visualization import plot_state_city
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
state = DensityMatrix(qc)
plot_state_city(st... |
https://github.com/maryrbarros2/QuantumAlgorithms_Qiskit | maryrbarros2 | from qiskit import QuantumCircuit, assemble, Aer
from qiskit.visualization import plot_histogram
from qiskit_textbook.widgets import binary_widget
binary_widget(nbits=6)
n = 8
n_q = n #number of qubits in the circuit.
n_b = n #number of output bits we will extract from the circuit at the end.
qc_output = Qua... |
https://github.com/yatharth0610/Quantum-Algorithms-qiskit- | yatharth0610 | from qiskit import *
from qiskit.tools.jupyter import *
from qiskit.visualization import *
import matplotlib.pyplot as plotter
import numpy as np
from IPython.display import display, Math, Latex
%matplotlib inline
# Loading your IBM Q account(s)
provider = IBMQ.load_account()
# The '0' state
plot_bloch_vect... |
https://github.com/QuSTaR/kaleidoscope | QuSTaR | # -*- coding: utf-8 -*-
# This file 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/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/SaashaJoshi/IBM-Qiskit-Summer-School-2020 | SaashaJoshi | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifi... |
https://github.com/hephaex/Quantum-Computing-Awesome-List | hephaex | # Do the necessary imports
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, BasicAer, IBMQ
from qiskit.visualization import plot_histogram, plot_bloch_multivector
### Creating 3 qubit and 2 classical bits in each separate register
qr = QuantumRegister(3)
crz = Cla... |
https://github.com/IlliaOvcharenko/quantum-search | IlliaOvcharenko | import sys, os
sys.path.append(os.getcwd())
import matplotlib
matplotlib.use('Agg')
import math
import numpy as np
import matplotlib.pyplot as plt
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qi... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumCircuit
top = QuantumCircuit(1)
top.x(0);
bottom = QuantumCircuit(2)
bottom.cry(0.2, 0, 1);
tensored = bottom.tensor(top)
tensored.draw('mpl') |
https://github.com/qiskit-community/qiskit-dell-runtime | qiskit-community | # 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_nature.second_q.problems import BaseProblem
dummy_hamiltonian = None
base_problem = BaseProblem(dummy_hamiltonian)
print(base_problem.properties)
from qiskit_nature.second_q.properties import AngularMomentum
print("AngularMomentum is in problem.properties:", AngularMomentum in base_problem.prop... |
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/Pitt-JonesLab/slam_decomposition | Pitt-JonesLab | """
This file contains functions that are written utils/gates/snail_death_gate.py
Refactoring note, should call functions from there instead of writing them here
"""
import matplotlib.pyplot as plt
import numpy as np
c_ampArray = np.linspace(0, 0.8, 81)
g_ampArray = np.linspace(0, 0.8, 81)
from slam.utils... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit.dagcircuit import DAGCircuit
from qiskit.converters import circuit_to_dag
from qiskit.visualization import dag_drawer
q = QuantumRegister(3, 'q')
c = ClassicalRegister(3, 'c')
circ = QuantumCircuit(q, c)
circ.h(q[0])
circ.cx(q[0... |
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_city
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0,1)
# plot using a Statevector
state = Statevector(qc)
plot_state_city(state) |
https://github.com/Bikramaditya0154/Quantum-Simulation-of-the-ground-state-of-Hydrogen-molecule-using-Variational-Quantum-Eigensolver- | Bikramaditya0154 | from qiskit.algorithms import VQE
from qiskit_nature.algorithms import (GroundStateEigensolver,
NumPyMinimumEigensolverFactory)
from qiskit_nature.drivers import Molecule
from qiskit_nature.drivers.second_quantization import (
ElectronicStructureMoleculeDriver, ElectronicS... |
https://github.com/qismib/TraNQI | qismib |
#importing packages
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 import transpile, assemble
fro... |
https://github.com/qclib/qclib | qclib | # 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/AlluSu/Grover-Search | AlluSu | '''
Demonstrating Grover's search algorithm.
Scenario: We have a phone book containing names and numbers. Because the phone book is sorted alphabetically by names,
it is easy to find a persons phone number by persons name. However, a more difficult task would be if we want to find a person by a phone number.
Numb... |
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/Tojarieh97/VQE | Tojarieh97 | from qiskit.circuit.library.standard_gates import RXGate, RZGate, CXGate, CZGate
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
def anzats_circ1(thetas, D2, in_state):
qr = QuantumRegister(4, name="q")
qc = QuantumCircuit(qr)
qc.initialize(in_state)
for d in rang... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | # You can choose different colors for the real and imaginary parts of the density matrix.
from qiskit import QuantumCircuit
from qiskit.quantum_info import DensityMatrix
from qiskit.visualization import plot_state_city
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
state = DensityMatrix(qc)
plot_state_city(st... |
https://github.com/aryashah2k/Quantum-Computing-Collection-Of-Resources | aryashah2k | import numpy as np
from qiskit import *
qc = QuantumCircuit(3)
# Apply H-gate to each qubit:
for qubit in range(3):
qc.h(qubit)
# See the circuit:
qc.draw('mpl')
# Let's see the result
backend = Aer.get_backend('statevector_simulator')
out = execute(qc,backend).result().get_statevector()
print(out)
... |
https://github.com/ranaarp/Qiskit-Meetup-content | ranaarp | import numpy as np
from qiskit import BasicAer
from qiskit.visualization import plot_histogram
from qiskit.aqua import QuantumInstance
from qiskit.aqua.algorithms import Grover
from qiskit.aqua.components.oracles import LogicalExpressionOracle, TruthTableOracle
input_3sat = '''
c example DIMACS-CNF 3-SAT
p cn... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | import numpy as np
import matplotlib.pyplot as plt
try:
import cplex
from cplex.exceptions import CplexError
except:
print("Warning: Cplex not found.")
import math
from qiskit.utils import algorithm_globals
from qiskit.algorithms.minimum_eigensolvers import SamplingVQE
from qiskit.algorithms.o... |
https://github.com/lancecarter03/QiskitLearning | lancecarter03 | from qiskit import *
%matplotlib inline
from qiskit.tools.visualization import plot_histogram
secretNumber = '111000'
circuit = QuantumCircuit(len(secretNumber)+1, len(secretNumber))
circuit.h(range(len(secretNumber)))
circuit.x(len(secretNumber))
circuit.h(len(secretNumber))
circuit.barrier()
for ii, y... |
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/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/mareksubocz/QRBM-qiskit | mareksubocz | 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.visualization import *
# Concentrating on the first... |
https://github.com/wyqian1027/Qiskit-Fall-Fest-USC-2022 | wyqian1027 | from qiskit import QuantumCircuit, execute, Aer
from qiskit.opflow import One, Zero, Plus, Minus
from qiskit.opflow import I, X, Y, Z, S, H
from qiskit.visualization import plot_bloch_multivector, plot_bloch_vector, plot_histogram
from math import pi, sqrt, acos, asin, e, log, sin, cos
from numpy import angle
Z... |
https://github.com/geduardo/Q-Snake-Qiskitcamp-Europe-2019 | geduardo | import pew_circuit as pew
from qiskit import QuantumCircuit, execute, Aer
#from aether import QuantumCircuit, simulate
import pygame
import numpy as np
simulator = Aer.get_backend('qasm_simulator')
shot=1
def Qand(First_bool,Second_bool):
First_bool=bool(First_bool)
Second_bool=bool(Second_bool) ... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | #!/usr/bin/env python3
# Author: Daniel Escanez-Exposito
from crypto.six_state.participant import Participant
from qiskit import QuantumCircuit
from numpy.random import rand
from qiskit import transpile
## The Receiver entity in the Six-State implementation
## @see https://qiskit.org/textbook/ch-algorithms... |
https://github.com/bagmk/Quantum_Machine_Learning_Express | bagmk | # Practical Implementation of a Quantum String Matching Algorithm
# S. Faro, F.P. Marino, and A. Scardace
# QUASAR 2024
%%capture
!pip install ibm-cloud-sdk-core==3.18.2
!pip install qiskit==0.45.1
!pip install qiskit-aer==0.13.1
!pip install pylatexenc==2.10
from numpy import log2, sqrt
from numpy import ... |
https://github.com/usamisaori/qLipschitz | usamisaori | from sklearn import datasets
import numpy as np
import matplotlib.pyplot as plt
from qiskit.quantum_info import DensityMatrix
def getDensityMatrix(circuit):
return DensityMatrix(circuit).data
from qCircuit import createInputCircuit, createModelCircuit, createNoisyModelCircuit
from qLipschitz import QLi... |
https://github.com/ace314/Quantum-Multi-collision-Problem | ace314 | #initialization
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
# 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 qiskit.tools.... |
https://github.com/Sanjay-995/Qiskit-Developer-Prep-Guide | Sanjay-995 | from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, Aer, execute
from qiskit.quantum_info import Statevector
from qiskit.visualization import plot_bloch_multivector, plot_histogram
import numpy as np
from numpy import pi
import math
from math import sqrt
import matplotlib as mpl
%matplo... |
https://github.com/EdoardoZappia/Qiskit-Primitive | EdoardoZappia | #!pip install qiskit
#import qiskit.tools.jupyter
#%qiskit_version_table
#%qiskit_copyright
#pip install qcircuit
#pip install pdflatex
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute
import numpy as np
import qiskit.quantum_info as qi
import qiskit
from qiskit import Ae... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | import numpy as np
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import BasicAer
from qiskit.compiler import transpile
from qiskit.quantum_info.operators import Operator, Pauli
from qiskit.quantum_info import process_fidelity
from qiskit.extensions import RXGate, XGate, CXG... |
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/ColibrITD-SAS/mpqp | ColibrITD-SAS | from math import sqrt, pi
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
import oracle_simple
import composed_gates
def get_circuit(n, oracles):
"""
Build the circuit composed by the oracle black box and the other quantum gates.
:param n: The number of qubits (not including... |
https://github.com/JessicaJohnBritto/Quantum-Computing-and-Information | JessicaJohnBritto | # Importing Packages
import matplotlib.pyplot as plt
import numpy as np
from qiskit import IBMQ, Aer
from qiskit.providers.ibmq import least_busy
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, transpile, assemble
from qiskit.visualization import plot_histogram
# Input Secret Number
s =... |
https://github.com/kuehnste/QiskitTutorial | kuehnste | # Importing standard Qiskit libraries
from qiskit import QuantumCircuit, execute, Aer
from qiskit.visualization import *
from qiskit.quantum_info import state_fidelity
# Magic function to render plots in the notebook after the cell executing the plot command
%matplotlib inline
def run_on_qasm_simulator(quantum_... |
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 | import qiskit.qasm3
program = """
OPENQASM 3.0;
include "stdgates.inc";
input float[64] a;
qubit[3] q;
bit[2] mid;
bit[3] out;
let aliased = q[0:1];
gate my_gate(a) c, t {
gphase(a / 2);
ry(a) c;
cx c, t;
}
gate my_phase(a) c {
ctrl ... |
https://github.com/jcylim/QiskitProject | jcylim | # -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""Demo basic optimization: Remove Zero Rotations and Remove Double CNOTs.
Note: if you have only cloned the Qiskit r... |
https://github.com/thyung/qiskit_factorization | thyung | import numpy as np
from numpy import pi
from qiskit import QuantumCircuit, Aer, transpile
from qiskit.visualization import plot_histogram, plot_bloch_multivector
from qiskit.circuit import QuantumRegister, ClassicalRegister
from qiskit.circuit.library import QFT
sim = Aer.get_backend('statevector_simulator')
... |
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='my token')
ionq_provider.backends()
import numpy as np
from qiskit import execute
from qiskit import QuantumCircuit,... |
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/Chibikuri/qwopt | Chibikuri | import numpy as np
import copy
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import IBMQ, Aer, execute
from .op_creater import OperationCreator
from qiskit import transpile
np.set_printoptions(linewidth=1000, precision=3)
class CircuitComposer:
'''
If you use goo... |
https://github.com/swe-bench/Qiskit__qiskit | swe-bench | # This code is part of Qiskit.
#
# (C) Copyright IBM 2020, 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or... |
https://github.com/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/Slope86/QiskitExtension | Slope86 | import math
from qiskit_extension.quantum_circuit2 import QuantumCircuit2 as qc2
from qiskit_extension.state_vector2 import StateVector2 as sv2
# Create a 4bits quantum circuit
circ_init = qc2(4)
# Make ground state qubit(0,1) and qubit(2,3) entangled into two EPR pairs
circ_init.h([0,2])
circ_init.cx([0,2... |
https://github.com/qiskit-community/qiskit-translations-staging | qiskit-community | import numpy as np
from qiskit import *
# Create a Quantum Circuit acting on a quantum register of three qubits
circ = QuantumCircuit(3)
# Add a H gate on qubit $q_{0}$, putting this qubit in superposition.
circ.h(0)
# Add a CX (CNOT) gate on control qubit $q_{0}$ and target qubit $q_{1}$, putting
# the qu... |
https://github.com/anpaschool/quantum-computing | anpaschool | |
https://github.com/AbdulahAmer/PHYS-31415-Summer-2021 | AbdulahAmer | # Do not forget to Import Qiskit
from qiskit.visualization import *
from qiskit import *
S_simulator=Aer.backends(name='statevector_simulator')[0]
M_simulator=Aer.backends(name='qasm_simulator')[0]
from math import pi
# lets make a fucntions called rotate we do this in python by using def and
# t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.