repo
stringclasses
900 values
file
stringclasses
754 values
content
stringlengths
4
215k
https://github.com/Shashankaubaru/NISQ-TDA
Shashankaubaru
# from qiskit.circuit import Parameter #For state vector initializing # from qiskit.aqua.components.initial_states.custom import Custom # from qiskit.quantum_info import Pauli # from qiskit.aqua.operators import MatrixOperator, WeightedPauliOperator, op_converter # from qiskit.aqua.utils import decimal_to_binary...
https://github.com/Shashankaubaru/NISQ-TDA
Shashankaubaru
import numpy as np import pdb from pdb import set_trace as bp # Import Qiskit from qiskit import QuantumCircuit, QuantumRegister from qiskit import Aer, transpile from qiskit.tools.visualization import plot_histogram, plot_state_city import qiskit.quantum_info as qi from qiskit.providers.aer import AerError ...
https://github.com/Shashankaubaru/NISQ-TDA
Shashankaubaru
# noqa: E501,E402,E401,E128 # flake8 disable errors # -*- coding: utf-8 -*- # Copyright 2018 IBM. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
https://github.com/Shashankaubaru/NISQ-TDA
Shashankaubaru
import qiskit from qiskit import IBMQ from qiskit.providers.aer import AerSimulator import qiskit.providers.aer.noise as qnoise # Generate 3-qubit GHZ state circ = qiskit.QuantumCircuit(3) circ.h(0) circ.cx(0, 1) circ.cx(1, 2) circ.measure_all() # Construct an ideal simulator aersim = AerSimulator() #...
https://github.com/EavCmr/QKD-E91
EavCmr
#!pip install qiskit from qiskit import QuantumCircuit, Aer, transpile, assemble, execute, IBMQ from qiskit.visualization import plot_histogram import numpy as np import random import math import warnings warnings.filterwarnings('ignore') # Determine the amount of entanglement between these bits using...
https://github.com/EavCmr/QKD-E91
EavCmr
#!pip install qiskit from qiskit import QuantumCircuit, Aer, transpile, assemble, execute, IBMQ from qiskit.visualization import plot_histogram import numpy as np import random import math import warnings warnings.filterwarnings('ignore') # Determine the amount of entanglement between these bits using...
https://github.com/JoelJJoseph/QUANTUM-TRADE
JoelJJoseph
import numpy as np import networkx as nx import qiskit from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, assemble from qiskit.quantum_info import Statevector from qiskit.aqua.algorithms import NumPyEigensolver from qiskit.quantum_info import Pauli from qiskit.aqua.operators...
https://github.com/lzylili/grovers-algo
lzylili
#Import libraries from qiskit import matplotlib.pyplot as plt %matplotlib inline import numpy as np from qiskit import * from qiskit.providers.ibmq import least_busy import math # Initializing circuit: define as 2 qubits q = QuantumRegister(2, 'q') c = ClassicalRegister(2, 'c') # Create the quantum circ...
https://github.com/DEBARGHYA4469/quantum-compiler
DEBARGHYA4469
from qiskit import register, available_backends , get_backend # Establish connection with IBMQuantum Experience try : import sys sys.path.append('../') import Qconfig qx_config = { # configuration details 'APItoken' : Qconfig.APItoken , 'url' : Qconfig.config['url'...
https://github.com/DEBARGHYA4469/quantum-compiler
DEBARGHYA4469
#THIS PROGRAM IS MODIFIED FROM THE DJ ALGORITHM PRESENT IN QISKIT TUTORIAL WHERE I FEEL THAT THE NOTION OF TAKING THE RANDOM BALANCED #FUNCTION IS QUITE ABSTRACT AND DIFFICULT TO GRASP FOR A BEGINNER.SO I ADDED SOME PIECE OF CODE FOR PRINTING THE RANDOM FUNCTION #AND PROVE THERE IS A DETERMINISTIC WAY OF DERIVING A B...
https://github.com/DEBARGHYA4469/quantum-compiler
DEBARGHYA4469
from qiskit import register, available_backends , get_backend # Establish connection with IBMQuantum Experience try : import sys sys.path.append('../') import Qconfig qx_config = { # configuration details 'APItoken' : Qconfig.APItoken , 'url' : Qconfig.config['url'...
https://github.com/DEBARGHYA4469/quantum-compiler
DEBARGHYA4469
"""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/DEBARGHYA4469/quantum-compiler
DEBARGHYA4469
from qiskit import ClassicalRegister,QuantumRegister,QuantumJob from qiskit import available_backends,execute,register,get_backend from qiskit.tools.visualization import plot_histogram from qiskit import QuantumCircuit from zy_decomposition import * from control_U2 import * #........................................
https://github.com/DEBARGHYA4469/quantum-compiler
DEBARGHYA4469
# Implement the control_U2 gate # Written by Debarghya Kundu # Email : debarghya4469@iitg.ernet.in from zy_decomposition import * from qiskit import ClassicalRegister,QuantumRegister,QuantumJob from qiskit import available_backends,execute,register,get_backend from qiskit.tools.visualization import plot_his...
https://github.com/DEBARGHYA4469/quantum-compiler
DEBARGHYA4469
# Main routine for synthesis of n-qubit unitary # Written by Debarghya Kundu # Email : debarghya4469@iitg.ernet.in from two_level_decompose import * from two_dimensionalise import * from block import * import numpy as np import math from random import randint from graycode import * from nontrivial impo...
https://github.com/victor-onofre/Quantum_Algorithms
victor-onofre
import numpy as np from qiskit import QuantumCircuit as QC from qiskit import execute from qiskit import IBMQ, BasicAer from qiskit.providers.ibmq import least_busy from qiskit.tools.jupyter import * provider = IBMQ.load_account() from qiskit.visualization import plot_histogram def oracle(case, n): ##cre...
https://github.com/victor-onofre/Quantum_Algorithms
victor-onofre
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, IBMQ, BasicAer from qiskit.visualization import plot_bloch_multivector,plot_bloch_vector, plot_histogram from qiskit.quantum_info import Statevector import numpy as np import matplotlib backend = BasicAer.get_backend('qasm_simu...
https://github.com/victor-onofre/Quantum_Algorithms
victor-onofre
import numpy as np import networkx as nx import matplotlib.pyplot as plt from scipy.optimize import minimize from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer style = {'backgroundcolor': 'lightyellow'} # Style of the drawing of the quantum circuit Graph_Example_1 = nx.Graph(...
https://github.com/victor-onofre/Quantum_Algorithms
victor-onofre
from qiskit import IBMQ, Aer from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, transpile, assemble from qiskit.tools.monitor import job_monitor import matplotlib as mpl # import basic plot tools from qiskit.visualization import plot_histogram, plot_bloch_multivector import numpy as ...
https://github.com/victor-onofre/Quantum_Algorithms
victor-onofre
from qiskit import ClassicalRegister , QuantumCircuit, QuantumRegister import numpy as np qr = QuantumRegister(2) cr = ClassicalRegister(3) #For tree classicals bites qc = QuantumCircuit(qr , cr) qc.h(qr[0]) #auxiliary qubit qc.x(qr[1]) # eigenvector #qc.cp((3/2)*np.pi , qr[0] , qr[1]) qc.cp(3*np.pi , qr[...
https://github.com/victor-onofre/Quantum_Algorithms
victor-onofre
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, IBMQ, BasicAer import math from qiskit.visualization import plot_histogram backend = BasicAer.get_backend('statevector_simulator') from wordcloud import WordCloud import numpy as np import pandas as pd # primary data struct...
https://github.com/victor-onofre/Quantum_Algorithms
victor-onofre
import cirq import numpy as np from qiskit import QuantumCircuit, execute, Aer import seaborn as sns import matplotlib.pyplot as plt plt.rcParams['figure.figsize'] = (15,10) q0, q1, q2 = [cirq.LineQubit(i) for i in range(3)] circuit = cirq.Circuit() #entagling the 2 quibits in different laboratories #and p...
https://github.com/victor-onofre/Quantum_Algorithms
victor-onofre
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, IBMQ, BasicAer from qiskit.visualization import plot_histogram from qiskit.quantum_info import Statevector import numpy as np import matplotlib style = {'backgroundcolor': 'lightyellow'} # Style of the circuits backend = Basic...
https://github.com/victor-onofre/Quantum_Algorithms
victor-onofre
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, IBMQ, BasicAer from qiskit.visualization import plot_bloch_multivector,plot_bloch_vector, plot_histogram, plot_state_qsphere from qiskit.quantum_info import Statevector, partial_trace import random import numpy as np import matpl...
https://github.com/victor-onofre/Quantum_Algorithms
victor-onofre
import qutip as qt # I use QuTip for the tensor and trace function import numpy as np H = qt.Qobj(np.matrix([[1.0 , 0.0 , 0.0 , 0.0 ] ,[0.0 , 0.0 ,-1.0 , 0.0 ] ,[0.0 ,-1.0 , 0.0 , 0.0 ] ,[0.0 , 0.0 , 0.0 , 1.0 ]])) H Id = qt.qeye(2...
https://github.com/victor-onofre/Quantum_Algorithms
victor-onofre
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, IBMQ, BasicAer import math from qiskit.visualization import plot_histogram backend = BasicAer.get_backend('statevector_simulator') from wordcloud import WordCloud import numpy as np import pandas as pd # primary data struct...
https://github.com/abhilash1910/EuroPython-21-QuantumDeepLearning
abhilash1910
!pip install pennylane %load_ext tensorboard import pennylane as qml from pennylane import numpy as np from pennylane.templates import RandomLayers import tensorflow as tf from tensorflow import keras import matplotlib.pyplot as plt import os from datetime import datetime %tensorboard --logdir logs/scalar...
https://github.com/abhilash1910/EuroPython-21-QuantumDeepLearning
abhilash1910
!pip install pennylane # example of training a gan on mnist from numpy import expand_dims from numpy import zeros from numpy import ones from numpy import vstack from numpy.random import randn from numpy.random import randint import tensorflow as tf from keras.datasets.mnist import load_data from keras.opti...
https://github.com/abhilash1910/EuroPython-21-QuantumDeepLearning
abhilash1910
!pip install pennylane !pip install qiskit import pennylane as qml from pennylane.templates import AmplitudeEmbedding,BasisEmbedding,AngleEmbedding import tensorflow as tf from tensorflow import keras device = qml.device('default.qubit', wires=2) @qml.qnode(device) def amplitude_circuit(inputs=None): ...
https://github.com/abhilash1910/EuroPython-21-QuantumDeepLearning
abhilash1910
!pip install qiskit !pip install pennylane import pennylane as qml from pennylane import numpy as np #Create a basic default Quantum circuit #First , create a device to use the qubits def create_device(): return qml.device("default.qubit",wires=1) dev=create_device() #Create an instance of Qnode...
https://github.com/abhilash1910/EuroPython-21-QuantumDeepLearning
abhilash1910
!pip install pennylane !pip install qiskit import pennylane as qml from pennylane import numpy as np import tensorflow as tf import matplotlib.pyplot as plt device=qml.device("default.qubit",wires=2) @qml.qnode(device,interface='tf') def create_circuit(inputs): qml.RX(inputs[0],wires=0) qml.RY(input...
https://github.com/abhilash1910/EuroPython-21-QuantumDeepLearning
abhilash1910
# This cell is added by sphinx-gallery # It can be customized to whatever you like %matplotlib inline !pip install pennylane import pennylane as qml from matplotlib import pyplot as plt import numpy as np import scipy import networkx as nx import copy qubit_number = 4 qubits = range(qubit_number) isin...
https://github.com/abhilash1910/EuroPython-21-QuantumDeepLearning
abhilash1910
!apt-get install -y xvfb python-opengl > /dev/null 2>&1 !pip install gym pyvirtualdisplay > /dev/null 2>&1 !pip install pennylane !pip install pyvirtualdisplay #PPO-A2C for CartPole import gym import numpy as np import tensorflow as tf from tensorflow import keras from datetime import datetime from ...
https://github.com/JavaFXpert/think2020
JavaFXpert
%matplotlib inline # Importing standard Qiskit libraries and configuring account from qiskit import QuantumCircuit, execute, Aer, IBMQ from qiskit.compiler import transpile, assemble from qiskit.tools.jupyter import * from qiskit.visualization import * # Loading your IBM Q account(s) provider = IBMQ.load_account...
https://github.com/JavaFXpert/think2020
JavaFXpert
%matplotlib inline # Importing standard Qiskit libraries and configuring account from qiskit import QuantumCircuit, execute, Aer, IBMQ from qiskit.compiler import transpile, assemble from qiskit.tools.jupyter import * from qiskit.visualization import * # Loading your IBM Q account(s) provider = IBMQ.load_account...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
from qiskit.aqua.algorithms import NumPyMinimumEigensolver from qiskit.optimization.algorithms import GroverOptimizer, MinimumEigenOptimizer from qiskit.optimization.problems import QuadraticProgram from qiskit import BasicAer from docplex.mp.model import Model backend = BasicAer.get_backend('statevector_simulat...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
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 """ Examples: c This is an example DIMACS CNF f...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
from qiskit import QuantumRegister, ClassicalRegister, BasicAer import numpy as np import matplotlib.pyplot as plt from qiskit import QuantumCircuit, execute,IBMQ from qiskit.tools.monitor import job_monitor from qiskit.circuit.library import NormalDistribution,UniformDistribution,LogNormalDistribution from kalei...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
import pennylane as qml from pennylane import numpy as np graph = [(0, 1), (0, 3), (1, 2), (2, 3), (3, 4), (1, 4), (4, 5)] n_wires = len(graph) # unitary operator U_B with parameter beta def U_B(beta): for wire in range(n_wires): qml.RX(2 * beta, wires=wire) # unitary operator U_C with param...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
# importing Qiskit from qiskit import IBMQ, Aer from qiskit import QuantumCircuit, execute jokes = [ "I also have a wavefunction joke but I'm afraid that it will collapse", "I have a unique quantum joke because I am pretty sure it cannot be cloned.", "I have a joke about quantum physics, but nobody gets it - ...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
#initialization import matplotlib.pyplot as plt %matplotlib inline import numpy as np import math # importing Qiskit from qiskit import IBMQ, Aer from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute # import basic plot tools from qiskit.visualization import plot_histogram from ...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
import numpy as np from qiskit import IBMQ, QuantumCircuit, ClassicalRegister, QuantumRegister, execute from qiskit.tools.visualization import plot_histogram, plot_state_city from qiskit import Aer, IBMQ def increment_gate(qc, q, qcoin): qc.ccx(qcoin, q[0], q[1]) qc.cx(qcoin, q[0]) return qc def...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
from qiskit.quantum_info import Operator from qiskit import QuantumCircuit import numpy as np def phase_oracle(n, solutions, name = 'Oracle'): qc = QuantumCircuit(n, name=name) oracle_matrix = np.identity(2**n) for solution in solutions: oracle_matrix[solution, solution] = -1 qc.unit...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
import math import matplotlib.pyplot as plt %matplotlib inline class TSP: def __init__(self): self.flat_mat = flat_mat self.n = 0 self.melhor_dist = 1e11 self.pontos = [] self.melhores_pontos = [] def busca_exaustiva(self, flat_mat, n, ite): ...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
# Playing with models from qiskit.aqua.algorithms import VQC from qiskit.aqua.components.optimizers import SPSA import matplotlib.pyplot as plt import matplotlib.patches as mpatches from qiskit.ml.datasets import ad_hoc_data, wine # Data to play with # ad_hoc_data - returns ad hoc dataset - ad_hoc_data(train...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
import networkx as nx import numpy as np from qiskit import Aer from qiskit.aqua import aqua_globals, QuantumInstance from qiskit.aqua.algorithms import QAOA, VQE, NumPyMinimumEigensolver from qiskit.aqua.components.optimizers import SPSA, COBYLA from qiskit.optimization.applications.ising.common import sample_...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
import numpy as np from qiskit import QuantumCircuit, execute, Aer from qiskit.quantum_info import Statevector import kaleidoscope.qiskit from kaleidoscope import qsphere, probability_distribution # import basic plot tools from qiskit.visualization import plot_histogram, plot_state_qsphere # A Circuit is...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
from sklearn.datasets import make_blobs # example dataset features, labels = make_blobs(n_samples=20, n_features=2, centers=2, random_state=3, shuffle=True) import numpy as np from sklearn.model_selection import train_test_split from sklearn.preprocessing import MinMaxScaler features = MinMaxScaler(featur...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import execute from qiskit import Aer from qiskit.aqua.utils import split_dataset_to_data_and_labels from qiskit.tools.visualization import plot_bloch_multivector from qiskit.aqua import QuantumInstance from qiskit.aqua.algorithms i...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
# Playing with models from qiskit.aqua.algorithms import VQC from qiskit.aqua.components.optimizers import SPSA import matplotlib.pyplot as plt import matplotlib.patches as mpatches from qiskit.ml.datasets import ad_hoc_data, wine # Data to play with # ad_hoc_data - returns ad hoc dataset - ad_hoc_data(train...
https://github.com/sergiogh/qpirates-qiskit-notebooks
sergiogh
# Dependencies and initial configuration %pylab inline from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit from qiskit import execute, Aer from qiskit.tools.visualization import plot_histogram from ipywidgets import interact import matplotlib.pyplot as plt import matplotlib.image as mpimg ...
https://github.com/FerjaniMY/Quantum_Steganography
FerjaniMY
from qiskit import * import numpy as np import matplotlib.pyplot as plt from qiskit.visualization import plot_histogram # Creating registers with n qubits n =7 # for a local backend n can go as up as 23, after that it raises a Memory Error qr = QuantumRegister(n, name='qr') cr = ClassicalRegister(n, name='c...
https://github.com/carstenblank/dc-qiskit-stochastics
carstenblank
from hmmlearn import hmm samples = 10*[[0], [1], [1], [1], [1], [2], [2], [0], [1], [1], [1], [0], [2]] model = hmm.MultinomialHMM(n_components=4) model.fit(samples) model.emissionprob_ model.transmat_
https://github.com/carstenblank/dc-qiskit-stochastics
carstenblank
# Copyright 2018-2022 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
https://github.com/carstenblank/dc-qiskit-stochastics
carstenblank
# Copyright 2018-2022 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
https://github.com/carstenblank/dc-qiskit-stochastics
carstenblank
# Copyright 2018-2022 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
https://github.com/carstenblank/dc-qiskit-stochastics
carstenblank
# Copyright 2018-2022 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
https://github.com/carstenblank/dc-qiskit-stochastics
carstenblank
# Copyright 2018-2022 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
https://github.com/carstenblank/dc-qiskit-stochastics
carstenblank
# Copyright 2018-2022 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
https://github.com/carstenblank/dc-qiskit-stochastics
carstenblank
# Copyright 2018-2022 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
https://github.com/carstenblank/dc-qiskit-stochastics
carstenblank
# Copyright 2018-2022 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
https://github.com/carstenblank/dc-qiskit-stochastics
carstenblank
# Copyright 2018-2022 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
https://github.com/carstenblank/dc-qiskit-stochastics
carstenblank
# -*- 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/carstenblank/dc-qiskit-stochastics
carstenblank
# Copyright 2018-2022 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
https://github.com/carstenblank/dc-qiskit-stochastics
carstenblank
# Copyright 2018-2022 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
https://github.com/renatawong/classical-shadow-vqe
renatawong
# Installation of the requirements #!python -m pip install -r requirements.txt ''' (C) Renata Wong 2023 Qiskit code for testing fidelity of derandomised classical shadow on the ground state energy of molecules. Procedure: 1. Derandomize the molecule-in-question's Hamiltonian. 2. Choose a variational ansatz...
https://github.com/renatawong/classical-shadow-vqe
renatawong
# Installation of the requirements #!python -m pip install -r requirements.txt ''' (C) Renata Wong 2023 Qiskit code for testing fidelity of derandomised classical shadow on the ground state energy of molecules. This notebook implements an optimization: since the derandomized Hamiltonian may contan very few te...
https://github.com/renatawong/classical-shadow-vqe
renatawong
# Installation of the requirements #!python -m pip install -r requirements.txt ''' (C) Renata Wong 2023 Qiskit code for testing fidelity of randomised classical shadow on the ground state energy of molecules. Procedure: 1. Choose a variational ansatz with initial parameters selected at random. 2. Generate ...
https://github.com/renatawong/classical-shadow-vqe
renatawong
# Installation of the requirements #!python -m pip install -r requirements.txt ''' (C) Renata Wong 2023 Qiskit code for testing fidelity of randomised classical shadow on the ground state energy of molecules. Procedure: 1. Choose a variational ansatz with initial parameters selected at random. 2. Generate ...
https://github.com/renatawong/classical-shadow-vqe
renatawong
''' (C) 2023 Renata Wong Electronic structure problem with classical shadows, as presented in https://arxiv.org/abs/2103.07510 This code uses Qiskit as platform. The shadow is constructed based on derandomized Hamiltonian. The molecules tested are: H2 (6-31s basis), LiH (sto3g basis), BeH2 (sto3g), H2O (sto3g),...
https://github.com/renatawong/classical-shadow-vqe
renatawong
''' (C) 2023 Renata Wong Electronic structure problem with classical shadows, as presented in https://arxiv.org/abs/2103.07510 This code uses Qiskit as platform. The shadow is constructed based on derandomized Hamiltonian. The molecules tested are: H2 (6-31s basis), LiH (sto3g basis), BeH2 (sto3g), H2O (sto3g),...
https://github.com/renatawong/classical-shadow-vqe
renatawong
''' (C) 2023 Renata Wong Electronic structure problem with classical shadows, as presented in https://arxiv.org/abs/2103.07510 This code uses Qiskit as platform. The shadow is constructed based on derandomized Hamiltonian. The molecules tested are: H2 (6-31s basis), LiH (sto3g basis), BeH2 (sto3g), H2O (sto3g),...
https://github.com/renatawong/classical-shadow-vqe
renatawong
''' (C) 2023 Renata Wong Electronic structure problem with classical shadows, as presented in https://arxiv.org/abs/2103.07510 This code uses Qiskit as platform. The shadow is constructed based on derandomized Hamiltonian. The molecules tested are: H2 (6-31s basis), LiH (sto3g basis), BeH2 (sto3g), H2O (sto3g),...
https://github.com/renatawong/classical-shadow-vqe
renatawong
''' (C) 2023 Renata Wong Electronic structure problem with classical shadows, as presented in https://arxiv.org/abs/2103.07510 This code uses Qiskit as platform. The shadow is constructed based on derandomized Hamiltonian. The molecules tested are: H2 (6-31s basis), LiH (sto3g basis), BeH2 (sto3g), H2O (sto3g),...
https://github.com/renatawong/classical-shadow-vqe
renatawong
''' (C) 2023 Renata Wong Electronic structure problem with classical shadows, as presented in https://arxiv.org/abs/2103.07510 This code uses Qiskit as platform. The molecule tested is H2. The shadow is constructed based on derandomized Hamiltonian. ''' import time import numpy as np from collections impo...
https://github.com/renatawong/classical-shadow-vqe
renatawong
''' (C) 2023 Renata Wong Electronic structure problem with classical shadows, as presented in https://arxiv.org/abs/2103.07510 This code uses Qiskit as platform. The shadow is constructed based on derandomized Hamiltonian. The molecules tested are: H2 (6-31s basis), LiH (sto3g basis), BeH2 (sto3g), H2O (sto3g),...
https://github.com/renatawong/classical-shadow-vqe
renatawong
''' (C) 2023 Renata Wong Electronic structure problem with classical shadows, as presented in https://arxiv.org/abs/2103.07510 This code uses Qiskit as platform. The shadow is constructed based on derandomized Hamiltonian. The molecules tested are: H2 (6-31s basis), LiH (sto3g basis), BeH2 (sto3g), H2O (sto3g),...
https://github.com/renatawong/classical-shadow-vqe
renatawong
''' (C) 2023 Renata Wong Electronic structure problem with classical shadows, as presented in https://arxiv.org/abs/2103.07510 This code uses Qiskit as platform. The shadow is constructed based on derandomized Hamiltonian. The molecules tested are: H2 (6-31s basis), LiH (sto3g basis), BeH2 (sto3g), H2O (sto3g),...
https://github.com/renatawong/classical-shadow-vqe
renatawong
''' (C) 2023 Renata Wong Electronic structure problem with classical shadows, as presented in https://arxiv.org/abs/2103.07510 This code uses Qiskit as platform. The molecule tested is H2. The shadow is vanilla, i.e. uses randomized basis change operations. ''' import time import numpy as np from collect...
https://github.com/renatawong/classical-shadow-vqe
renatawong
''' CALCULATING NUMBER OF MEASUREMENTS NEEDED AGAINST AN ERROR RATE Example: H2 molecule in sto3g basis ''' import numpy as np from qiskit_nature.units import DistanceUnit from qiskit_nature.second_q.drivers import PySCFDriver from qiskit_nature.second_q.mappers import BravyiKitaevMapper # specifying ...
https://github.com/TendTo/Quantum-random-walk-simulation
TendTo
import numpy as np import networkx as nx from networkx import hypercube_graph from networkx.drawing.nx_agraph import graphviz_layout import matplotlib.pyplot as plt from typing import Callable from qiskit import QuantumCircuit, Aer, QuantumRegister, ClassicalRegister, transpile from qiskit.quantum_info import Op...
https://github.com/deveshq/Qiskit-Fall-Fest
deveshq
# Importing standard Qiskit libraries from qiskit import QuantumCircuit, transpile, Aer, IBMQ, execute from qiskit.tools.jupyter import * from qiskit.visualization import * from qiskit.providers.aer import QasmSimulator from numpy import pi from qiskit.circuit import Parameter, ParameterVector import numpy...
https://github.com/SunilBoopalan/quantum-chess-Qiskit
SunilBoopalan
from chess import * SquareSet(BB_DIAG_ATTACKS[36][BB_DIAG_MASKS[36] & BB_RANKS[6]]) SquareSet(BB_SQUARES[0] | BB_SQUARES[1]) 3423421312222322111 & 222 board = Board() board.turn = True Nf3 = chess.Move.from_uci("g1f3") Ng5 = chess.Move.from_uci("f3g5") # board.push(Nf3) board.push(Nf3) board.p...
https://github.com/SunilBoopalan/quantum-chess-Qiskit
SunilBoopalan
import qiskit from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import Aer, execute from qiskit.quantum_info.operators import Operator from qiskit.extensions import UnitaryGate, Initialize from qiskit import IBMQ import math backend = Aer.get_backend('qasm_simulator') class q...
https://github.com/RedHatParichay/qiskit-lancasterleipzig-2023
RedHatParichay
## Blank Code Cell ## Use only if you need to install the grader and/or Qiskit ## If you are running this notebook in the IBM Quantum Lab - you can ignore this cell !pip install qiskit !pip install 'qc-grader[qiskit] @ git+https://github.com/qiskit-community/Quantum-Challenge-Grader.git' event = "Qiskit Fall F...
https://github.com/RedHatParichay/qiskit-lancasterleipzig-2023
RedHatParichay
## Blank Code Cell ## Use only if you need to install the grader and/or Qiskit ## If you are running this notebook in the IBM Quantum Lab - you can ignore this cell !pip install qiskit !pip install 'qc-grader[qiskit] @ git+https://github.com/qiskit-community/Quantum-Challenge-Grader.git' ## Run this cell to ma...
https://github.com/RedHatParichay/qiskit-lancasterleipzig-2023
RedHatParichay
## Blank Code Cell ## Use only if you need to install the grader and/or Qiskit ## If you are running this notebook in the IBM Quantum Lab - you can ignore this cell !pip install qiskit !pip install 'qc-grader[qiskit] @ git+https://github.com/qiskit-community/Quantum-Challenge-Grader.git' ## Run this cell to ma...
https://github.com/JavaFXpert/qiskit-plotting-app
JavaFXpert
# Do the necessary import for our program %matplotlib inline from qiskit import * from qiskit.aqua.algorithms import Grover from qiskit.aqua.components.oracles import LogicalExpressionOracle from qiskit.tools.visualization import plot_histogram import ipywidgets as widgets import matplotlib.pyplot as plt from I...
https://github.com/JavaFXpert/qiskit-plotting-app
JavaFXpert
from qiskit import * from qiskit.visualization import plot_histogram from qiskit.tools.monitor import job_monitor # quantum circuit to make a Bell state bell = QuantumCircuit(2, 2) bell.h(0) bell.cx(0, 1) meas = QuantumCircuit(2, 2) meas.measure([0,1], [0,1]) # execute the quantum circuit backend = Ba...
https://github.com/IffTech/UCLA-Qiskit-Intro
IffTech
# You'll always start off any Quantum circuit with...QuantumCircuit from qiskit import QuantumCircuit # Every quantum circuit has some number of quantum registers and classical registers that you get to define in advance # You can either pass one integer in to denote a fixed number of quantum registers # OR you c...
https://github.com/Antonio297/Qiskit_Algoritmo_Cuantico
Antonio297
### Original articles: ### ### (1) "Improving the Sequence Alignment Method by Quantum Multi-Pattern Recognition" ### Konstantinos Prousalis & Nikos Konofaos ### Published in: SETN '18 Proceedings of the 10th Hellenic Conference on Artificial Intelligence, Article No. 50 ### Patras, Greece, July 09 - 12, 2018 ###...
https://github.com/Antonio297/Qiskit_Algoritmo_Cuantico
Antonio297
### Quantum indexed Bidirectional Associative Memory by A. Sarkar, Z. Al-Ars, C. G. Almudever, K. Bertels ### Repository reference: https://gitlab.com/prince-ph0en1x/QaGs (by A. Sarkar) ## Importing libraries %matplotlib inline import qiskit from qiskit import IBMQ from qiskit import Aer from qiskit import Qua...
https://github.com/idriss-hamadi/Qiskit-Quantaum-codes-
idriss-hamadi
# Importing standard Qiskit libraries from qiskit import QuantumCircuit, transpile from qiskit.tools.jupyter import * from qiskit.visualization import * from ibm_quantum_widgets import * from qiskit_aer import AerSimulator # qiskit-ibmq-provider has been deprecated. # Please see the Migration Guides in https:/...
https://github.com/idriss-hamadi/Qiskit-Quantaum-codes-
idriss-hamadi
from qiskit import * #qiskit framework # Quantum_Register=QuantumRegister(2) # classical_Register=ClassicalRegister(2) # circut=QuantumCircuit(Quantum_Register,classical_Register) #those 3 lines are the same as the next line circut=QuantumCircuit(2,2) circut.draw(output='mpl') #drawing function circut.h(0...
https://github.com/idriss-hamadi/Qiskit-Quantaum-codes-
idriss-hamadi
# Importing standard Qiskit libraries from qiskit import QuantumCircuit, transpile from qiskit.tools.jupyter import * from qiskit.visualization import * from ibm_quantum_widgets import * from qiskit_aer import AerSimulator # qiskit-ibmq-provider has been deprecated. # Please see the Migration Guides in https:/...
https://github.com/dlyongemallo/qiskit-zx-transpiler
dlyongemallo
from qiskit.circuit import QuantumCircuit from qiskit.converters import circuit_to_dag from qiskit.visualization import dag_drawer import numpy as np # Taken from https://github.com/Quantomatic/pyzx/blob/master/circuits/Fast/mod5_4_before qc = QuantumCircuit(5) qc.x(4) qc.h(4) qc.ccz(0, 3, 4) qc.ccz(2, 3, 4)...
https://github.com/dlyongemallo/qiskit-zx-transpiler
dlyongemallo
import sys; sys.path.append('..') from qiskit import transpile from qiskit.circuit import QuantumCircuit from qiskit.transpiler import PassManager from qiskit.qasm2 import dumps from qiskit.qasm3 import dumps as dumps3 import pyzx as zx from zxpass import ZXPass pass_manager = PassManager(ZXPass()) # Sel...
https://github.com/dlyongemallo/qiskit-zx-transpiler
dlyongemallo
# ZX transpiler pass for Qiskit # Copyright (C) 2023 David Yonge-Mallo # # 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 # # Unle...
https://github.com/dlyongemallo/qiskit-zx-transpiler
dlyongemallo
# ZX transpiler pass for Qiskit # Copyright (C) 2023 David Yonge-Mallo # # 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 # # Unle...
https://github.com/bawejagb/Quantum_Computing
bawejagb
#Import Libraries from qiskit import QuantumCircuit, transpile, Aer, assemble from qiskit.providers.aer import QasmSimulator from qiskit.visualization import plot_bloch_multivector, plot_histogram from qiskit.visualization import array_to_latex, plot_state_qsphere # Use Aer's qasm_simulator simulator = QasmSimu...