repo stringclasses 900
values | file stringclasses 754
values | content stringlengths 4 215k |
|---|---|---|
https://github.com/ctuning/ck-qiskit | ctuning | #!/usr/bin/env python3
"""
Example used in the readme. In this example a Bell state is made and then measured.
## Running this script using the "lightweight" CK infrastructure to import QISKit library...
# 1) on local simulator:
ck virtual env --tags=lib,qiskit --shell_cmd=quantum_coin_flip.py
# 2) on... |
https://github.com/ctuning/ck-qiskit | ctuning | # 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/ctuning/ck-qiskit | ctuning | # -*- 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.
"""
The eval_hamiltonian function has been borrowed from QISKit's tools/apps/optimization.py
and slightly modified b... |
https://github.com/ctuning/ck-qiskit | ctuning | #!/usr/bin/env python3
"""
This script runs Variational-Quantum-Eigensolver using Qiskit library
Example running it partially using CK infrastructure:
ck virtual env --tag_groups='compiler,python qiskit,lib vqe,utils vqe,hamiltonian deployed,ansatz deployed,optimizer' \
--shell_cmd="$H... |
https://github.com/ctuning/ck-qiskit | ctuning | from qiskit import IBMQ
from qiskit import BasicAer as Aer
from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit
from qiskit import execute
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Rectangle
import copy
from ipywidgets import widgets
from IPy... |
https://github.com/ctuning/ck-qiskit | ctuning | import numpy as np
import IPython
import ipywidgets as widgets
import colorsys
import matplotlib.pyplot as plt
from qiskit import QuantumCircuit,QuantumRegister,ClassicalRegister
from qiskit import execute, Aer, BasicAer
from qiskit.visualization import plot_bloch_multivector
from qiskit.tools.jupyter import *
... |
https://github.com/ctuning/ck-qiskit | ctuning | # 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/ctuning/ck-qiskit | ctuning | #!/usr/bin/env python3
"""
Example used in the readme. In this example a Bell state is made and then measured.
## Running this script using the "lightweight" CK infrastructure to import QISKit library...
# 1) on local simulator:
ck virtual env --tags=lib,qiskit --shell_cmd=quantum_coin_flip.py
# 2) on... |
https://github.com/ctuning/ck-qiskit | ctuning | # 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/ctuning/ck-qiskit | ctuning | #--------------------------------------------------------------------------------------------------------------
# This module contains basic gates that can be used while developing circuits on IBM QExperience
#-----------------------------------------------------------------------------------------------------------... |
https://github.com/ctuning/ck-qiskit | ctuning | #--------------------------------------------------------------------------------------------------------------
# This module contains control unitaries that can be used while developing circuits on IBM QExperience
#-----------------------------------------------------------------------------------------------------... |
https://github.com/ctuning/ck-qiskit | ctuning | """The following is python code utilizing the qiskit library that can be run on extant quantum
hardware using 5 qubits for factoring the integer 15 into 3 and 5. Using period finding,
for a^r mod N = 1, where a = 11 and N = 15 (the integer to be factored) the problem is to find
r values for this identity such that... |
https://github.com/ctuning/ck-qiskit | ctuning | # -*- 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.
"""
The eval_hamiltonian function has been borrowed from QISKit's tools/apps/optimization.py
and slightly modified b... |
https://github.com/ctuning/ck-qiskit | ctuning | #!/usr/bin/env python3
"""
This script runs Variational-Quantum-Eigensolver using Qiskit library
Example running it partially using CK infrastructure:
ck virtual env --tag_groups='compiler,python qiskit,lib vqe,utils vqe,hamiltonian deployed,ansatz deployed,optimizer' \
--shell_cmd="$H... |
https://github.com/ctuning/ck-qiskit | ctuning | #!/usr/bin/env python3
import qiskit.tools.apps.optimization
num_of_qubits = 2
circuit_depth = 6
num_params = 2 * num_of_qubits * circuit_depth # make sure you set this correctly to the number of parameters used by the ansatz
## Previously used for Hydrogen VQE in QISKit implementation
#
d... |
https://github.com/ctuning/ck-qiskit | ctuning | #!/usr/bin/env python3
import qiskit.tools.apps.optimization
num_of_qubits = 2
circuit_depth = 6
num_params = 2 * num_of_qubits * circuit_depth # make sure you set this correctly to the number of parameters used by the ansatz
## Previously used for Hydrogen VQE in QISKit implementation
#
d... |
https://github.com/ctuning/ck-qiskit | ctuning | #!/usr/bin/env python3
import qiskit.tools.apps.optimization
num_of_qubits = 2
circuit_depth = 6
num_params = 2 * num_of_qubits * circuit_depth # make sure you set this correctly to the number of parameters used by the ansatz
## Previously used for Hydrogen VQE in QISKit implementation
#
d... |
https://github.com/ctuning/ck-qiskit | ctuning | #!/usr/bin/env python3
import qiskit.tools.apps.optimization
num_of_qubits = 2
circuit_depth = 6
num_params = 2 * num_of_qubits * circuit_depth # make sure you set this correctly to the number of parameters used by the ansatz
## Previously used for Hydrogen VQE in QISKit implementation
#
d... |
https://github.com/ctuning/ck-qiskit | ctuning | #!/usr/bin/env python3
import qiskit.tools.apps.optimization
num_of_qubits = 2
circuit_depth = 6
num_params = 2 * num_of_qubits * circuit_depth # make sure you set this correctly to the number of parameters used by the ansatz
## Previously used for Hydrogen VQE in QISKit implementation
#
d... |
https://github.com/ctuning/ck-qiskit | ctuning | #!/usr/bin/env python3
import qiskit.tools.apps.optimization
num_of_qubits = 2
circuit_depth = 6
num_params = 2 * num_of_qubits * circuit_depth # make sure you set this correctly to the number of parameters used by the ansatz
## Previously used for Hydrogen VQE in QISKit implementation
#
d... |
https://github.com/gatchan00/QPlex | gatchan00 | %config IPCompleter.greedy=True
# useful additional packages
import matplotlib.pyplot as plt
import matplotlib.axes as axes
%matplotlib inline
import numpy as np
import networkx as nx
from qiskit import BasicAer
from qiskit.tools.visualization import plot_histogram
from qiskit.aqua import Operator, ru... |
https://github.com/gatchan00/QPlex | gatchan00 | import matplotlib.pyplot as plt
import matplotlib.axes as axes
import numpy as np
import networkx as nx
from qiskit import BasicAer
from qiskit.tools.visualization import plot_histogram
from qiskit.aqua import Operator, run_algorithm
from qiskit.aqua.input import EnergyInput
from qiskit.aqua.translators.ising... |
https://github.com/gatchan00/QPlex | gatchan00 | %config IPCompleter.greedy=True
%matplotlib inline
from qplex_core import *
precision = 6
coefs_param = [2, -3]
beta = 7
a = wrapper_optimiza_f(precision, coefs_param, beta)
print(a)
#tú mandas la función 2*X-3*Y,
#La precisión para representar enteros es de 6 qbits por número (usamos los X e Y y le añad... |
https://github.com/dv-gorasiya/quantum-machine-learning | dv-gorasiya | import numpy as np
from matplotlib import pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from matplotlib.colors import ListedColormap
seed = 12345
def plot_dataset(X, y, ax, axes=[-1, 1, -1, 1], marker='o', size=50, alpha=1.0, stepsize=0.5, gr... |
https://github.com/dv-gorasiya/quantum-machine-learning | dv-gorasiya | from datasets import *
from qiskit import BasicAer
from qiskit.aqua.utils import split_dataset_to_data_and_labels, map_label_to_class_name
from qiskit.aqua.input import ClassificationInput
from qiskit.aqua import run_algorithm, QuantumInstance
from qiskit.aqua.algorithms import QSVM
from qiskit.aqua.components.... |
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/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/Raijeku/qmeans | Raijeku | !pip install qmeans
import numpy as np
import pandas as pd
from qmeans.qmeans import QuantumKMeans
from qiskit import Aer
from sklearn.datasets import load_iris
import matplotlib.pyplot as plt
backend = Aer.get_backend("aer_simulator_statevector")
X,y = load_iris(return_X_y=True)
print('Data is: ',X)
prin... |
https://github.com/Raijeku/qmeans | Raijeku | """Module for quantum k-means algorithm with a class containing sk-learn style functions resembling
the k-means algorithm.
This module contains the QuantumKMeans class for clustering according to euclidian distances
calculated by running quantum circuits.
Typical usage example::
import numpy as np
... |
https://github.com/yaelbh/qiskit-sympy-provider | yaelbh | # -*- coding: utf-8 -*-
# Copyright 2018, 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.
"""
Example showing how to use the Sympy Provider at level 0 (novice).
This example shows the most basic way to us... |
https://github.com/yaelbh/qiskit-sympy-provider | yaelbh | # -*- coding: utf-8 -*-
# Copyright 2018, 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.
"""
Example showing how to use the Sympy Provider at level 1 (intermediate).
This example shows how an intermediat... |
https://github.com/yaelbh/qiskit-sympy-provider | yaelbh | # -*- coding: utf-8 -*-
# Copyright 2018, 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.
"""
Exception for errors raised by Sympy simulators.
"""
from qiskit import QISKitError
class SympySimulator... |
https://github.com/yaelbh/qiskit-sympy-provider | yaelbh | # -*- coding: utf-8 -*-
# Copyright 2018, 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=invalid-name,missing-docstring
from test.common import QiskitSympyTestCase
import unittest
... |
https://github.com/yaelbh/qiskit-sympy-provider | yaelbh | # -*- coding: utf-8 -*-
# Copyright 2018, 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=invalid-name,missing-docstring
from test.common import QiskitSympyTestCase
import unittest
... |
https://github.com/erinaldi/bmn2-qiskit | erinaldi | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import sys
plt.style.use("../figures/paper.mplstyle")
# parameters
def read_data(
optimizer: str,
p: dict,
):
"""Read the VQE convergence data for the mini BMN model from disk
Args:
optimizer (str): The opti... |
https://github.com/erinaldi/bmn2-qiskit | erinaldi | import numpy as np
from scipy.sparse import diags
L = 8 # cutoff for Fock space
a = diags(np.sqrt(np.linspace(1,L-1,L-1)),offsets=1)
print(a.toarray())
from qiskit.opflow import MatrixOp
qubitOp = MatrixOp(primitive=a)
print(qubitOp.num_qubits)
type(qubitOp)
print(qubitOp)
a_pauli = qubitOp.to_pa... |
https://github.com/erinaldi/bmn2-qiskit | erinaldi | import sys
import numpy as np
N = 2 # cutoff for Fock space. The number of qubits used will be K = log2(N)
annOp = np.array(np.diagflat(np.sqrt(np.linspace(1,N-1,N-1)),k=1))
with np.printoptions(precision=3, suppress=True, linewidth=120, threshold=sys.maxsize): # print array lines up to character 120 and floats u... |
https://github.com/erinaldi/bmn2-qiskit | erinaldi | # Here's where the number of qubits are set. The Hamiltonian will be have a size of (N-2)x(N-2)
qubits = 8
N = (2**qubits)+2
print(f"The Hamiltonian will be a {N-2}x{N-2} matrix")
#lattice lower bound
a = -6
#lattice upper bound
b = 6
# Import necessary libraries
import numpy as np
import matplotlib.pyp... |
https://github.com/erinaldi/bmn2-qiskit | erinaldi | import numpy as np
from scipy.sparse import diags
from scipy.sparse import identity
from scipy.sparse import kron
L = 2 # cutoff for Fock space -> can not go larger than 2 in qiskit without having problems for minimal BMN
a_b = diags(np.sqrt(np.linspace(1,L-1,L-1)),offsets=1)
a_b.todense()
i_b = identit... |
https://github.com/erinaldi/bmn2-qiskit | erinaldi | # %%
import time
import fire
import numpy as np
import pandas as pd
from scipy.sparse import diags
from scipy.sparse import identity
from scipy.sparse import kron
from scipy.sparse.linalg import eigsh
from qiskit import Aer
from qiskit.opflow import MatrixOp
from qiskit.circuit.library import EfficientSU2
f... |
https://github.com/erinaldi/bmn2-qiskit | erinaldi | # %%
import time
import fire
import numpy as np
import pandas as pd
from scipy.sparse import diags
from scipy.sparse import identity
from scipy.sparse import kron
from scipy.sparse.linalg import eigsh
from qiskit import Aer
from qiskit.opflow import MatrixOp
from qiskit.circuit.library import EfficientSU2
f... |
https://github.com/erinaldi/bmn2-qiskit | erinaldi | # %%
import time
import fire
import os
import numpy as np
import pandas as pd
from scipy.sparse import diags
from scipy.sparse import identity
from qiskit import Aer
from qiskit.opflow import MatrixOp, ListOp, TensoredOp, SummedOp, I
from qiskit.circuit.library import EfficientSU2
from qiskit.algorithms impo... |
https://github.com/sintefmath/QuantumPoker | sintefmath | from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, transpile
from termcolor import colored
class Board:
def __init__(self, size=3, simulator=None):
# Initialize the quantum circuit with one qubit and classical bit for each cell
self.size = size
self.simulator = ... |
https://github.com/sintefmath/QuantumPoker | sintefmath | # Copyright SINTEF 2019
# Authors: Franz G. Fuchs <franzgeorgfuchs@gmail.com>,
# Christian Johnsen <christian.johnsen97@gmail.com>,
# Vemund Falch <vemfal@gmail.com>
from os.path import dirname, abspath
import sys
sys.path.append(dirname(abspath(__file__)))
from Python.interactive import Inte... |
https://github.com/sintefmath/QuantumPoker | sintefmath | import sys
IN_COLAB = 'google.colab' in sys.modules
if IN_COLAB:
from google.colab import output
output.enable_custom_widget_manager()
!pip install qiskit
!pip install ipympl
!rm -rf /content/QuantumPoker/
!git clone https://github.com/sintefmath/QuantumPoker
sys.path.append('/content/QuantumPo... |
https://github.com/sintefmath/QuantumPoker | sintefmath | %matplotlib inline
from os.path import dirname, abspath
import sys
sys.path.append(dirname(abspath('')))
from PokerGame import PokerGame
import matplotlib.pyplot as plt
from numpy import array
nPlayers = 3
deckOfGates = {"H": nPlayers, "X": nPlayers, "ZH": nPlayers, "CX": nPlayers}
money = array([100 for i i... |
https://github.com/t-imamichi/qiskit-utility | t-imamichi | #!/usr/bin/env python
# coding: utf-8
# Copyright 2018, 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.
'''
Translate a QASM file to a QOBJ file.
Examples:
$ python qasm2qobj.py -i input.qasm -o outpu... |
https://github.com/LuukCoopmans/Qiskit-Hackathon-QIP | LuukCoopmans | import numpy as np
from matplotlib import pyplot as plt
import os
import cv2
from qiskit import *
def rgb2gray(rgb):
return np.dot(rgb[...,:3], [0.2989, 0.5870, 0.1140])
def get_Coeff(Image, watermark=None):
""" Function that takes in an Greyscale Image matrix of any size and and optional
w... |
https://github.com/quantumjim/pewpew_qiskit_workshops | quantumjim | %matplotlib notebook
import pew # setting up tools for the pewpew
from microqiskit import QuantumCircuit, simulate # setting up tools for quantum
pew.init() # initialize the game engine...
screen = pew.Pix() # ...and the screen
qc = QuantumCircuit(2,2) # create an empty circuit with two qubits and two output... |
https://github.com/quantumjim/pewpew_qiskit_workshops | quantumjim | run controller.py
|
https://github.com/quantumjim/pewpew_qiskit_workshops | quantumjim | %matplotlib notebook
import pew # setting up tools for the pewpew
from microqiskit import QuantumCircuit, simulate # setting up tools for quantum
pew.init() # initialize the game engine...
screen = pew.Pix() # ...and the screen
qc = QuantumCircuit(2,2) # create an empty circuit with two qubits and two output... |
https://github.com/quantumjim/pewpew_qiskit_workshops | quantumjim | %matplotlib notebook
import pew # setting up tools for the pewpew
pew.init() # initialize the game engine...
screen = pew.Pix() # ...and the screen
screen.pixel(1,2,3) # put a bright pixel at (1,2)
pew.show(screen) # update screen to display the above change
pew.tick(5) # pause for 5 seconds before quitti... |
https://github.com/quantumjim/pewpew_qiskit_workshops | quantumjim | %matplotlib notebook
import pew # setting up tools for the pewpew
from microqiskit import QuantumCircuit, simulate # setting up tools for quantum
from math import pi
pew.init() # initialize the game engine...
screen = pew.Pix() # ...and the screen
qc = QuantumCircuit(1,1) # create an empty circuit with one ... |
https://github.com/quantumjim/pewpew_qiskit_workshops | quantumjim | %matplotlib notebook
import pew
pew.init()
screen = pew.Pix()
# create a border of B=2 pixels
for A in range(8):
for B in [0,7]:
screen.pixel(A,B,2)
screen.pixel(B,A,2)
# the player is a B=3 pixel
X,Y = 4,6
screen.pixel(X,Y,3)
while True: # loop which checks for user input and... |
https://github.com/quantumjim/pewpew_qiskit_workshops | quantumjim | %matplotlib notebook
# define a function that determines a brightness for any given point
# uses a seed that is a list of four numbers
def get_brightness(x,y):
qc.data.clear() # empty the circuit
# perform rotations, whose angles depend on x and y
qc.rx((2*pi/360)*(seed[0]*x-seed[1]*y)*45,0)
qc... |
https://github.com/quantumjim/pewpew_qiskit_workshops | quantumjim | %matplotlib notebook
import pew # setting up tools for the pewpew
from microqiskit import QuantumCircuit, simulate # setting up tools for quantum
pew.init() # initialize the game engine...
screen = pew.Pix() # ...and the screen
qc = QuantumCircuit(2,2) # create an empty circuit with two qubits and two output... |
https://github.com/adlrocha/cryptoq | adlrocha | from qiskit import execute, QuantumCircuit, QuantumRegister, ClassicalRegister, Aer
from qiskit.quantum_info.operators import Operator
from qiskit.quantum_info import process_fidelity
from qiskit.providers.aer import QasmSimulator
from qiskit.providers.aer.noise import NoiseModel, errors
from qiskit.aqua.component... |
https://github.com/adlrocha/cryptoq | adlrocha |
#8ec67edd7b4c8e358b08222c23234d995de520b29686a14582cf2d797ac399124c799747364b30c8b86f34b5facbcc8d72734d652645bfad82ea6a4f4a46b7b1
from qiskit import IBMQ
IBMQ.load_accounts()
|
https://github.com/adlrocha/cryptoq | adlrocha | from qiskit import execute, QuantumCircuit, QuantumRegister, ClassicalRegister, Aer
from qiskit.quantum_info.operators import Operator
from qiskit.quantum_info import process_fidelity
from qiskit.providers.aer import QasmSimulator
from qiskit.providers.aer.noise import NoiseModel, errors
from qiskit.aqua.component... |
https://github.com/anpaschool/quantum-computing | anpaschool | from qiskit import *
from math import pi
import numpy as np
from qiskit.visualization import plot_bloch_multivector,plot_state_qsphere
import matplotlib.pyplot as plt
q = np.array([1.+0.j, 0.+0.j])
plot_bloch_multivector(q)
plot_state_qsphere(q)
q = np.array([0.+0.j, 1.+0.j])
plot_bloch_multivector(q)
... |
https://github.com/anpaschool/quantum-computing | anpaschool | from qiskit import *
from math import pi
from qiskit.visualization import plot_bloch_multivector
# Let's do an X-gate on a |0> qubit
qc = QuantumCircuit(1)
qc.x(0)
qc.draw('mpl')
# Let's see the result
backend = Aer.get_backend('statevector_simulator')
out = execute(qc,backend).result().get_statevector()
... |
https://github.com/anpaschool/quantum-computing | anpaschool | from qiskit import *
from math import pi
import numpy as np
from qiskit.visualization import *
import matplotlib.pyplot as plt
qc = QuantumCircuit(1)
qc.h(0)
qc.draw(output='mpl')
# Let's see the result
backend = Aer.get_backend('statevector_simulator')
out = execute(qc,backend).result().get_statevector()... |
https://github.com/anpaschool/quantum-computing | anpaschool | from qiskit import *
from math import pi
from qiskit.visualization import plot_bloch_multivector
qc = QuantumCircuit(1)
qc.u3(pi/4,pi/4,pi/4,0)
qc.draw(output='mpl')
# Let's see the result
backend = Aer.get_backend('statevector_simulator')
out = execute(qc,backend).result().get_statevector()
plot_bloch_mul... |
https://github.com/anpaschool/quantum-computing | anpaschool | from qiskit import *
from math import pi
import numpy as np
from qiskit.visualization import plot_bloch_multivector,plot_state_qsphere
import matplotlib.pyplot as plt
q = QuantumRegister(2)
qc = QuantumCircuit(2)
qc.cx(0,1)
qc.draw(output='mpl')
backend = Aer.get_backend('unitary_simulator')
job = execu... |
https://github.com/anpaschool/quantum-computing | anpaschool | from qiskit import *
from math import pi
import numpy as np
from qiskit.visualization import *
import matplotlib.pyplot as plt
qc = QuantumCircuit(3)
qc.ccx(0,1,2)
qc.draw(output='mpl')
backend = Aer.get_backend('unitary_simulator')
job = execute(qc, backend)
result = job.result()
print(result.get_unitar... |
https://github.com/anpaschool/quantum-computing | anpaschool | from qiskit import *
from math import pi
import numpy as np
from qiskit.visualization import *
import matplotlib.pyplot as plt
from qutip import *
q = QuantumRegister(1)
qc = QuantumCircuit(q)
qc.h(0)
qc.draw(output='mpl')
backend = Aer.get_backend('unitary_simulator')
job = execute(qc, backend)
result ... |
https://github.com/anpaschool/quantum-computing | anpaschool | from qiskit import *
from math import pi
import numpy as np
from qiskit.visualization import *
import matplotlib.pyplot as plt
from qutip import *
qc = QuantumCircuit(2)
qc.h(0)
qc.draw(output='mpl')
backend = Aer.get_backend('unitary_simulator')
job = execute(qc, backend)
result = job.result()
print(re... |
https://github.com/anpaschool/quantum-computing | anpaschool | from qiskit import *
from math import pi
import numpy as np
from qiskit.visualization import *
import matplotlib.pyplot as plt
from qutip import *
q = QuantumRegister(3)
qc = QuantumCircuit(q)
qc.u3(pi/2,pi/2,pi/2,q[0])
qc.draw(output='mpl')
backend = Aer.get_backend('unitary_simulator')
job = execute(qc... |
https://github.com/anpaschool/quantum-computing | anpaschool | from qiskit import *
from math import pi
import numpy as np
from qiskit.visualization import *
import matplotlib.pyplot as plt
from qutip import *
q = QuantumRegister(2)
qc = QuantumCircuit(q)
qc.cu1(pi/2,q[0], q[1])
qc.draw(output='mpl')
backend = Aer.get_backend('unitary_simulator')
job = execute(qc, b... |
https://github.com/anpaschool/quantum-computing | anpaschool | from qiskit import *
from math import pi
import numpy as np
from qiskit.visualization import *
import matplotlib.pyplot as plt
from qutip import *
qc = QuantumCircuit(2)
qc.barrier()
qc.h(0)
qc.cx(0, 1)
qc.barrier()
qc.draw('mpl')
backend = Aer.get_backend('statevector_simulator')
out = execute(qc,back... |
https://github.com/anpaschool/quantum-computing | anpaschool | %matplotlib inline
import numpy as np
import IPython
import matplotlib.pyplot as plt
from qiskit import QuantumCircuit,ClassicalRegister,QuantumRegister
from qiskit import BasicAer
from qiskit.tools.jupyter import *
from qiskit.visualization import *
import seaborn as sns
sns.set()
from helper import *
d... |
https://github.com/anpaschool/quantum-computing | anpaschool | from qiskit import *
from math import pi
import numpy as np
from qiskit.visualization import *
import matplotlib.pyplot as plt
from qutip import *
qc = QuantumCircuit(2)
qc.h(1)
qc.barrier()
qc.cu1(np.pi/2, 0, 1)
qc.barrier()
qc.h(0)
qc.barrier()
qc.swap(0,1)
qc.draw('mpl')
backend = Aer.get_backend(... |
https://github.com/anpaschool/quantum-computing | anpaschool | |
https://github.com/anpaschool/quantum-computing | anpaschool | |
https://github.com/anpaschool/quantum-computing | anpaschool | # Useful additional packages
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
from math import pi
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute
from qiskit import Aer, IBMQ
from qiskit.compiler import transpile, assemble
from qiskit.visualization import *
... |
https://github.com/dhanton/quantum-chess | dhanton | import itertools
from qiskit import *
from . import qutils
from qchess.point import Point
from qchess.piece import *
from qchess.pawn import Pawn
from qchess.engines.base_engine import BaseEngine
class QiskitEngine(BaseEngine):
def __init__(self, qchess, width, height):
self.qchess = qchess... |
https://github.com/dhanton/quantum-chess | dhanton | import math
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.quantum_info.operators import Operator
from qiskit import Aer
from qiskit import execute
from qiskit.tools.visualization import plot_histogram
backend = Aer.get_backend('qasm_simulator')
MAX_QUBIT_MEMORY = backend.MAX_QUBIT_MEMORY
... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | from qiskit import QuantumCircuit
from QCLG_lvl3.oracles.secret_number_oracle import SecretNUmberOracle
class BernsteinVazirani:
@classmethod
def bernstein_vazirani(cls, random_binary, eval_mode: bool) -> QuantumCircuit:
# Construct secret number oracle
secret_number_oracle = Sec... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 19 19:13:26 2023
@author: abdullahalshihry
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 18 19:15:12 2023
@author: abdullahalshihry
"""
import qiskit as qs
import qiskit.visualization as qv
import ran... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | """Python implementation of Grovers algorithm through use of the Qiskit library to find the value 3 (|11>)
out of four possible values."""
#import numpy and plot library
import matplotlib.pyplot as plt
import numpy as np
# importing Qiskit
from qiskit import IBMQ, Aer, QuantumCircuit, ClassicalRegister, Qu... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | #!/usr/bin/env python3
# Author: Daniel Escanez-Exposito
from qiskit import QuantumCircuit
from algorithms.qalgorithm import QAlgorithm
## A Quantum Algorithm to obtain random numbers for QuantumSolver
class QRand(QAlgorithm):
## Constructor
def __init__(self):
## The name of the algorithm
se... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | '''
This is a implementation of the quantum teleportation algorithm
'''
from qiskit import *
from qiskit.visualization import plot_histogram
import os, shutil, numpy
from matplotlib.pyplot import plot, draw, show
LaTex_folder_Quantum_Teleportation = str(os.getcwd())+'/Latex_quantum_gates/Quantum_Teleportatio... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | import qiskit
from .common_gates import *
import random
def superdense_coding_circuit(msg):
qc = qiskit.QuantumCircuit(2)
phi_plus = phi_plus_gate()
qc.append(phi_plus, [0, 1])
qc.barrier()
if msg[1] == '1':
qc.z(0)
if msg[0] == '1':
qc.x(0)
qc.ba... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez |
from qiskit import QuantumCircuit
from math import log2
class QSCircuit(QuantumCircuit):
def __init__(self, size):
self.size = size
super().__init__(size, size)
def not1(self, a):
self.x(a)
def not2(self, a, result):
self.reset(result)
self.cx(a, result)
self.x(result)
... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez |
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')
from composer.qs_circuit import QSCircuit
from qiskit import execute, QuantumCircuit
from qiskit_aer import AerSimulator
SIZE_REG = 16
CIRCUIT_SIZE = SIZE_REG * 2
ALPHABET = ['0', '1']
class QS_SAES_Circuit(QSCircu... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez |
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')
from composer.qs_circuit import QSCircuit
from qiskit import execute, BasicAer
print('AND')
for i in range(2 ** 5):
a = format(i, '05b')[::-1]
SIZE_REG = len(a)
a_indexes = list(range(0, SIZE_REG))
... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez |
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')
from composer.qs_circuit import QSCircuit
from qiskit import execute, BasicAer
SIZE = 3
SIZE_OUTPUT = 2 ** SIZE
for i in range(0, 2 ** SIZE):
a = format(i, '0' + str(SIZE) + 'b')
a_indexes = list(range(0, S... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez |
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')
from composer.qs_circuit import QSCircuit
from qiskit import execute, BasicAer
from math import log2
SIZE = 2 ** 3
for i in range(0, SIZE):
a = format(2 ** i, '0' + str(SIZE) + 'b')
SIZE_REG = len(a)
LOG... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez |
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')
from composer.qs_circuit import QSCircuit
from qiskit import execute, BasicAer
from math import log2
SIZE_INPUT = 2 ** 1
SIZE_SELECTOR = int(log2(SIZE_INPUT))
for i in range(0, 2 ** SIZE_INPUT):
a = format(i, '0'... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez |
from s_aes import QS_SAES_Circuit
from qiskit import execute
from qiskit_aer import AerSimulator
SIZE_REG = 16
CIRCUIT_SIZE = SIZE_REG * 2
msg_indexes = list(range(0, SIZE_REG))
msg_slice = slice(0, SIZE_REG)
key_indexes = list(range(SIZE_REG, 2 * SIZE_REG))
for i in range(2 ** 4):
msg = '0' * 12 +... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez |
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')
from composer.qs_circuit import QSCircuit
import string
from qiskit import execute, BasicAer
import math
from qiskit.circuit.library import SwapGate
# ALPHABET = list(string.ascii_uppercase) + [' ', '-', '_', '.', ','... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez |
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')
from composer.qs_circuit import QSCircuit
import string
from qiskit import execute, BasicAer
import math
ALPHABET = list(string.ascii_uppercase) + [' ', '-', '_', '.', ',', '@']
SIZE_REG = int(math.log2(len(ALPHABET))... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | #!/usr/bin/env python3
# Author: Daniel Escanez-Exposito
from qiskit import QuantumCircuit
from crypto.b92.sender import Sender
from crypto.b92.receiver import Receiver
import binascii
B92_SIMULATOR = 'B92 SIMULATOR'
## An implementation of the B92 protocol
## @see https://qiskit.org/textbook/ch-algorit... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | #!/usr/bin/env python3
# Author: Daniel Escanez-Exposito
from abc import ABC, abstractmethod
from qiskit import QuantumCircuit
from qiskit.circuit.library import YGate, ZGate
from qiskit.circuit.gate import Gate
import qiskit.quantum_info as qi
from numpy.random import randint
import numpy as np
from math ... |
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/jdanielescanez/quantum-solver | jdanielescanez | #!/usr/bin/env python3
# Author: Daniel Escanez-Exposito
from crypto.six_state.participant import Participant
from qiskit import QuantumCircuit
## The Sender entity in the Six-State implementation
## @see https://qiskit.org/textbook/ch-algorithms/quantum-key-distribution.html
class Sender(Participant):
#... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | #!/usr/bin/env python3
# Author: Daniel Escanez-Exposito
from crypto.six_state.participant import Participant
from qiskit import QuantumCircuit
## The Sender entity in the Six-State implementation
## @see https://qiskit.org/textbook/ch-algorithms/quantum-key-distribution.html
class Sender(Participant):
#... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | #!/usr/bin/env python3
# Author: Daniel Escanez-Exposito
from qiskit import execute, QuantumCircuit, QuantumRegister, ClassicalRegister
from crypto.e91.sender import Sender
from crypto.e91.receiver import Receiver
from crypto.e91.eavesdropper import Eveasdropper
import binascii
E91_SIMULATOR = 'E91 SIMULAT... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | #!/usr/bin/env python3
# Author: Daniel Escanez-Exposito
from crypto.e91.receiver import Receiver
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from numpy.random import uniform
## The Eveasdropper entity in the E91 implementation
## @see https://qiskit.org/textbook/ch-algorithms/quan... |
https://github.com/jdanielescanez/quantum-solver | jdanielescanez | #!/usr/bin/env python3
# Author: Daniel Escanez-Exposito
from abc import ABC, abstractmethod
from qiskit import QuantumCircuit
from qiskit.circuit.library import YGate, ZGate
from qiskit.circuit.gate import Gate
import qiskit.quantum_info as qi
from numpy.random import randint
import numpy as np
from math ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.