repo
stringclasses
900 values
file
stringclasses
754 values
content
stringlengths
4
215k
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...
https://github.com/Brogis1/2020_SCS_Qiskit_Workshop
Brogis1
import numpy as np from qiskit import __qiskit_version__ from qiskit.chemistry.drivers import PySCFDriver, PyQuanteDriver, UnitsType from qiskit.chemistry import FermionicOperator from qiskit.aqua.algorithms import VQE, ExactEigensolver from qiskit.chemistry.components.variational_forms import UCCSD from qiskit.c...
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
from qiskit import QuantumCircuit from qiskit.compiler import transpile DEFAULT_GATES = ["rz", "h", "s", "cx", "cz"] def decompose(circ: QuantumCircuit, basis=None) -> QuantumCircuit: if basis is None: basis = DEFAULT_GATES return transpile(circ, basis_gates=basis)
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
# 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/Simultonian/hamilutor-qiskit
Simultonian
from qiskit import QuantumCircuit from qiskit.opflow import PauliTrotterEvolution, X, Y, Z, I # For `eval` from ..utils.repr import qiskit_string_repr, qiskit_string_repr_pauli def trotter_from_terms(terms: list[tuple[str, float]]) -> QuantumCircuit: """ API that takes a list of terms that must be exp...
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
from qiskit import QuantumCircuit from ..utils import circuit_eq from .simple import qdrift from ..trotter.simple import trotter import numpy as np import pytest hamiltonians = [ {"xx": 1.0, "iy": 1.0}, {"xi": 1.0}, ] order_list = [ ["iy", "iy", "iy", "iy", "xx", "iy", "xx", "iy"], ["x...
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
from qiskit import QuantumCircuit from qiskit.opflow import PauliTrotterEvolution, X, Y, Z, I # For `eval` from ..utils.repr import qiskit_string_repr, qiskit_string_repr_pauli def trotter_from_terms(terms: list[tuple[str, float]]) -> QuantumCircuit: """ API that takes a list of terms that must be exp...
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
from qiskit import QuantumCircuit from qiskit.opflow import X, Y, Z, I from ..utils import qiskit_string_repr, circuit_eq from .simple import trotter, trotter_from_terms, trotter_from_term import pytest repr_hams = [ {"xiizi": 1.0, "iyiiy": 2.0}, {"iiizi": 1.0, "iyiiy": 2.0}, ] q_objs = [ (1...
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
from qiskit import QuantumCircuit from ..grouping.bitwise import Bitwise from .group_trotter import generic from ..ordering import lexico def bitwise_simple( h: dict[str, float], t: float = 1.0, reps: int = 1 ) -> QuantumCircuit: """ Takes in a Hamiltonian and constructs the simple Trotteriz...
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
from typing import Callable from qiskit import QuantumCircuit from ..grouping.grouper import Grouper from ..trotter.simple import trotter_from_terms from ..utils import circuit_constructor, get_el def generic( grouper_class: Callable[[set[str]], Grouper], orderer: Callable[[set[str]], list[str]...
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
import pytest from qiskit import QuantumCircuit from ..trotter.simple import trotter from ..utils import circuit_eq from .bitwise_simple import bitwise_simple import itertools def test_bitwise_simple_single_group(): group = {"ix": 1.0, "xi": -1.0} # Checking for multiple number of repetitions ...
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
import pytest from qiskit import QuantumCircuit from ..trotter.simple import trotter from ..utils import circuit_eq from .group_trotter import generic from ..grouping import Bitwise from ..ordering import lexico import itertools def test_single_group_trotter_grouper(): group = {"ix": 1.0, "xi": -1....
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
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/Simultonian/hamilutor-qiskit
Simultonian
from qiskit import QuantumCircuit def gate_count(circuit: QuantumCircuit): return dict(circuit.count_ops())
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
from qiskit import QuantumCircuit from . import circuit_constructor, circuit_eq def test_circuit_constructor(): gates_list = ["h", "hs", "hs", "i", "i", "h"] result = circuit_constructor(gates_list) result_dag = circuit_constructor(gates_list, True) expected = QuantumCircuit(6) expected...
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
import pytest from qiskit import QuantumCircuit from qiskit.circuit.library import HGate, XGate, CXGate from .gate_count import gate_count circuits = [ [(HGate, [1]), (XGate, [1]), (CXGate, [0, 1])], ] count_objs = [{"h": 1, "x": 1, "cx": 1}] qubit_counts = [2] @pytest.mark.parametrize("gates,c...
https://github.com/Simultonian/hamilutor-qiskit
Simultonian
# -*- 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/DanKim44/CodingWithQiskitS2
DanKim44
#Coding With Qiskit S2E6 Quantum Machine Learning import qiskit from matplotlib import pyplot as plt import numpy as np from qiskit.ml.datasets import ad_hoc_data from qiskit import BasicAer from qiskit.aqua import QuantumInstance from qiskit.circuit.library import ZZFeatureMap from qiskit.aqua.algorithms imp...
https://github.com/DanKim44/CodingWithQiskitS2
DanKim44
#Coding With Qiskit S2E7 Shor's Algorithm %matplotlib inline # Importing standard Qiskit libraries and configuring account from qiskit import QuantumCircuit, execute, Aer from qiskit.compiler import transpile, assemble from qiskit.tools.jupyter import * from qiskit.tools.visualization import plot_histogram fro...
https://github.com/DanKim44/CodingWithQiskitS2
DanKim44
#Coding With Qiskit S2E5 Dinner Party using Grover's Algorithm %matplotlib inline # Importing standard Qiskit libraries and configuring account from qiskit import * from qiskit.aqua.algorithms import Grover from qiskit.aqua.components.oracles import LogicalExpressionOracle from qiskit.compiler import transpile,...
https://github.com/iremsener/Quantum-Programming-Algorithms-with-Qiskit
iremsener
from qiskit import * %matplotlib inline circuit = QuantumCircuit(2,2) circuit.draw() circuit.h(0) circuit.draw() circuit.cx(0,1) # 0-> control qubit, 1-> target qubit circuit.measure([0,1],[0,1]) circuit.draw() simulator = Aer.get_backend('qasm_simulator') result = execute(circuit,backend=simula...
https://github.com/iremsener/Quantum-Programming-Algorithms-with-Qiskit
iremsener
from qiskit import * %matplotlib inline circuit = QuantumCircuit(2,2) #quantum_register = QuantumRegister(2) #classical_register = ClassicalRegister(2) #circuit = QuantumCircuit(quantum_register,classical_register) circuit.draw() circuit.h(0) circuit.draw() circuit.cx(0,1) # 0-> control qubit, 1-> ...
https://github.com/nickk124/quantumsearch
nickk124
import sys sys.path.insert(0, 'qrw/') from qrw import QRWsearch %config InlineBackend.figure_format = 'svg' # Makes the images look nice search_circuit = QRWsearch(2,0) # display the matrix the shift operator search_circuit.S(display_matrix=True); # display the matrix the shift operator search_circuit.C(dis...
https://github.com/nickk124/quantumsearch
nickk124
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jun 27 12:07:22 2020 @author: ericyelton """ #Imports import numpy as np from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit,execute, Aer # gates/operators from qiskit.quantum_info.operators import Operator from qiskit....
https://github.com/nickk124/quantumsearch
nickk124
# 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() from qiskit im...
https://github.com/nickk124/quantumsearch
nickk124
# 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() from qiskit im...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
import numpy as np import math from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, QiskitError from qiskit.compiler import assemble from qiskit.providers.aer import QasmSimulator from qiskit.quantum_info.random import random_unitary from qiskit.quantum_info.synthesis import two_qubit_cnot_decom...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# -*- 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/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
from datetime import datetime import matplotlib.pyplot as plt from qiskit import QuantumCircuit, BasicAer, execute, IBMQ, transpile from qiskit.providers import BaseJob from qiskit.providers.ibmq import least_busy, IBMQJobManager from qiskit.providers.ibmq.managed import ManagedJobSet from qiskit.visualization im...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# -*- coding: utf-8 -*- # 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....
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# 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/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# -*- 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. """ QasmSimulator Integration Tests """ import json from qiskit import execute, QuantumRegister, ClassicalRegister...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/vm6502q/qiskit-qrack-provider
vm6502q
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/papaaannn/Circuit
papaaannn
import numpy as np from qiskit import QuantumCircuit, Aer, execute from qiskit.visualization import circuit_drawer from qiskit.tools.visualization import plot_histogram # Total number of inputs n = 8 # Random n numbers a = np.random.randint(0, 2**n, size=n) # Check if n is a power of 2 if not (n and (not...
https://github.com/jfraxanet/BasQ_industry_workshop_Qiskit
jfraxanet
import rustworkx as rx from rustworkx.visualization import mpl_draw num_nodes = 5 edges = [(0, 1, 1), (0, 2, 1), (0, 3, 1), (0, 4, 1)]# The edge syntax is (start, end, weight) G = rx.PyGraph() G.add_nodes_from(range(num_nodes)) G.add_edges_from(edges) mpl_draw( G, pos=rx.bipartite_layout(G, {0}), with...
https://github.com/jfraxanet/BasQ_industry_workshop_Qiskit
jfraxanet
from qiskit import QuantumCircuit # Create circuit circuit = QuantumCircuit(2) circuit.h(0) circuit.cx(0, 1) circuit.draw('mpl',style="iqp",initial_state=True) import qiskit.quantum_info as qi from qiskit.visualization import array_to_latex qc = QuantumCircuit(2) qc.x(0) qc.h(0) qc.cx(0, 1) psi = qi.S...
https://github.com/jfraxanet/BasQ_industry_workshop_Qiskit
jfraxanet
from qiskit import QuantumCircuit #define quantum circuit qc = QuantumCircuit(4) #add gates qc.h(0) qc.cx(0,1) qc.h(2) qc.x(3) qc.cx(2,3) qc.measure_all() #draw qc.draw('mpl', style='clifford') #draw result = sampler.run(qc) print(result) from qiskit.primitives import Sampler from qiskit.visu...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
from IPython.display import IFrame; IFrame("https://www.ibm.com/quantum", 900,500) import csv with open('ibm_lagos_calibrations_2023-09-28T17_22_25Z.csv', newline='') as csvfile: spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|') for row in spamreader: print(', '.join(row)) import ...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
pip install -U qiskit==0.36.2 pip install pylatexenc import qiskit qiskit.__qiskit_version__ # Copie se API Token no IBMQ e cole aqui qiskit.IBMQ.save_account('ade2e1cd8926fee57b535ff0761ddac06ce27b6ea7ea0ecb60121d873ccf19578850d46431bbb002e5a64db18657e028fd17ae71b73ce25c57002e2ff579eeb6', overwrite = True...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
from sympy import Matrix X = Matrix([[0,1],[1,0]]); X Y = Matrix([[0,-1j],[1j,0]]); Y Z = Matrix([[1,0],[0,-1]]); Z X.eigenvals() X.eigenvects() Y.eigenvects() Z.eigenvects() from sympy import Matrix X = Matrix([[0,1],[1,0]]) ket0 = Matrix([[1],[0]]); ket1 = Matrix([[0],[1]]); ket0, ket1 X*ke...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
from sympy import Matrix, sqrt, init_printing; init_printing(use_unicode=True) ket0 = Matrix([[1],[0]]); ket1 = Matrix([[0],[1]]); from sympy.physics.quantum import TensorProduct as tp ket00 = tp(ket0,ket0); ket01 = tp(ket0,ket1); ket10 = tp(ket1,ket0); ket11 = tp(ket1,ket1) Psim = (ket01-ket10)/sqrt(2); Psim.T X...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
from qiskit import QuantumCircuit; qc = QuantumCircuit(2,2) qc.barrier() qc.cx(0,1); qc.h(0) qc.barrier() qc.measure([0,1],[0,1]) qc.draw('mpl') from qiskit import QuantumCircuit, execute, Aer; from qiskit.tools.visualization import plot_histogram simulator = Aer.get_backend('qasm_simulator'); nshots = 2**13 ...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
def qc_alice_encoding(cb): from qiskit import QuantumCircuit qc = QuantumCircuit(1, name='AE') if cb == '00': qc.id(0) elif cb == '01': qc.x(0) elif cb == '10': qc.z(0) elif cb == '11': qc.x(0); qc.z(0) return qc cb = '11' qcae = qc_alice_encoding...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
import math; import numpy as np; phmax = 4*math.pi; npt = 100; dth = phmax/npt; ph = np.arange(0,phmax+dth,dth) from matplotlib import pyplot as plt; PrD0 = 0.5*(1+np.cos(ph)); plt.plot(ph,PrD0, label=r'$Pr(D_0)$') PrD0 = 0.5*(1-np.cos(ph)); plt.plot(ph,PrD0, label=r'$Pr(D_1)$'); plt.legend(); plt.xlabel(r'$\phi$'); ...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
from qiskit import QuantumCircuit qc = QuantumCircuit(1,1) qc.x(0) qc.measure(0,0) qc.draw('mpl') from qiskit import Aer, execute simulator = Aer.get_backend('qasm_simulator') nshots = 2**13 job = execute(qc, backend=simulator,shots=nshots) counts = job.result().get_counts() from qiskit.tools.visualization ...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
from IPython.display import IFrame; IFrame("https://www.ibm.com/quantum", 900,500) import csv with open('ibm_lagos_calibrations_2023-09-28T17_22_25Z.csv', newline='') as csvfile: spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|') for row in spamreader: print(', '.join(row)) import ...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
from sympy import Matrix X = Matrix([[0,1],[1,0]]); X Y = Matrix([[0,-1j],[1j,0]]); Y Z = Matrix([[1,0],[0,-1]]); Z X.eigenvals() X.eigenvects() Y.eigenvects() Z.eigenvects() from sympy import Matrix X = Matrix([[0,1],[1,0]]) ket0 = Matrix([[1],[0]]); ket1 = Matrix([[0],[1]]); ket0, ket1 X*ke...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
from sympy import Matrix, sqrt, init_printing; init_printing(use_unicode=True) ket0 = Matrix([[1],[0]]); ket1 = Matrix([[0],[1]]); from sympy.physics.quantum import TensorProduct as tp ket00 = tp(ket0,ket0); ket01 = tp(ket0,ket1); ket10 = tp(ket1,ket0); ket11 = tp(ket1,ket1) Psim = (ket01-ket10)/sqrt(2); Psim.T X...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
from qiskit import QuantumCircuit; qc = QuantumCircuit(2,2) qc.barrier() qc.cx(0,1); qc.h(0) qc.barrier() qc.measure([0,1],[0,1]) qc.draw('mpl') from qiskit import QuantumCircuit, execute, Aer; from qiskit.tools.visualization import plot_histogram simulator = Aer.get_backend('qasm_simulator'); nshots = 2**13 ...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
def qc_alice_encoding(cb): from qiskit import QuantumCircuit qc = QuantumCircuit(1, name='AE') if cb == '00': qc.id(0) elif cb == '01': qc.x(0) elif cb == '10': qc.z(0) elif cb == '11': qc.x(0); qc.z(0) return qc cb = '11' qcae = qc_alice_encoding...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
import math; import numpy as np; phmax = 4*math.pi; npt = 100; dth = phmax/npt; ph = np.arange(0,phmax+dth,dth) from matplotlib import pyplot as plt; PrD0 = 0.5*(1+np.cos(ph)); plt.plot(ph,PrD0, label=r'$Pr(D_0)$') PrD0 = 0.5*(1-np.cos(ph)); plt.plot(ph,PrD0, label=r'$Pr(D_1)$'); plt.legend(); plt.xlabel(r'$\phi$'); ...
https://github.com/jonasmaziero/computacao_quantica_qiskit_sbf_2023
jonasmaziero
from qiskit import QuantumCircuit qc = QuantumCircuit(1,1) qc.x(0) qc.measure(0,0) qc.draw('mpl') from qiskit import Aer, execute simulator = Aer.get_backend('qasm_simulator') nshots = 2**13 job = execute(qc, backend=simulator,shots=nshots) counts = job.result().get_counts() from qiskit.tools.visualization ...
https://github.com/GyeonghunKim/2022-Feb-Qiskit-Metal-Study
GyeonghunKim
%load_ext autoreload %autoreload 2 import numpy as np import qiskit_metal as metal from qiskit_metal import designs, draw from qiskit_metal import MetalGUI, Dict, open_docs %metal_heading Welcome to Qiskit Metal Study! # To start qiskit-metal, you have to create instance of below two. # After runing this ...
https://github.com/alejomonbar/Qiskit_Fall_Fest_Mexico_2022
alejomonbar
%pip install yfinance %pip install cplex %pip qiskit_optimization %matplotlib inline import numpy as np import matplotlib.pyplot as plt import pandas as pd from docplex.mp.model import Model colors = plt.cm.tab20(range(20)) label_size = 22 plt.rcParams['xtick.labelsize'] = label_size plt.rcParams['y...
https://github.com/mahabubul-alam/QAOA-Compiler
mahabubul-alam
!python run.py -device_json examples/QC.json -circuit_json examples/QAOA_circ.json -config_json examples/Config.json -policy_compilation VIC -initial_layout_method vqp !cat VIC_QAOA.qasm
https://github.com/mahabubul-alam/QAOA-Compiler
mahabubul-alam
""" ################################################################################ ############## This library has been created by ###################### ############## Md Mahabubul Alam ###################### ############## https://mahabubul-alam.github.io/Personal/ ###########...
https://github.com/OccumRazor/implement-quantum-algotirhms-with-qiskit
OccumRazor
from qiskit import QuantumRegister,ClassicalRegister,QuantumCircuit,execute,Aer from qiskit.providers.aer import QasmSimulator from qiskit.quantum_info.operators import Operator from math import log,cos,sin,sqrt,pi,exp import matplotlib.pyplot as plt from numpy import kron,matmul,transpose,conjugate,zeros,trace,co...
https://github.com/OccumRazor/implement-quantum-algotirhms-with-qiskit
OccumRazor
from qiskit import QuantumRegister,ClassicalRegister,QuantumCircuit,Aer,execute from qiskit.providers.aer import QasmSimulator from qiskit.circuit.library.standard_gates import CU1Gate from numpy import pi from qiskit_code.classicalMethod import printCounts,Dec2Bi,modifyExpValue from qiskit_code.quantumMethod impo...
https://github.com/OccumRazor/implement-quantum-algotirhms-with-qiskit
OccumRazor
from qiskit import QuantumRegister,QuantumCircuit from qiskit.aqua.operators import StateFn from qiskit.aqua.operators import I from qiskit_code.quantumMethod import add,ini from qiskit_code.classicalMethod import Dec2Bi def DeutschJozsa(l,method): # Deutsch, D. and Jozsa, R., 1992. Rapid solution of problems b...
https://github.com/OccumRazor/implement-quantum-algotirhms-with-qiskit
OccumRazor
"""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/OccumRazor/implement-quantum-algotirhms-with-qiskit
OccumRazor
from qiskit import * from qiskit.circuit.library.standard_gates import SwapGate,CU1Gate,XGate,U1Gate from math import pi,sqrt from qiskit.quantum_info.operators import Operator import numpy as np def ini(circ,qr,ipt): # Input binary form, and append [0] ahead for qr1 block. for i in range(len(ipt)): ...
https://github.com/sanori/qiskit-tips
sanori
from qiskit import QuantumCircuit qc = QuantumCircuit(1) qc.x(0) qc.draw('mpl') from qiskit.visualization import visualize_transition visualize_transition(qc) qc = QuantumCircuit(1) qc.x(0) qc.y(0) qc.h(0) qc.draw('mpl') visualize_transition(qc)
https://github.com/dwarkeshsp/quantum-bomb-tester
dwarkeshsp
import numpy as np import matplotlib.pyplot as plt from qiskit import( QuantumCircuit, QuantumRegister, execute, Aer) from qiskit.quantum_info.operators import Operator e = np.pi / 100 rotations = int(np.pi / (2*e)) shots = 10000 def elitzur_vaidman(bomb): measurements = rotations ...
https://github.com/alvinli04/Quantum-Steganography
alvinli04
import qiskit from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import execute from qiskit import Aer from qiskit import IBMQ from qiskit.circuit.quantumregister import AncillaRegister def comparator(regX, regY): qc = QuantumCircuit(regX, regY) # regX and regY should h...
https://github.com/alvinli04/Quantum-Steganography
alvinli04
import qiskit from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import execute from qiskit import Aer from qiskit import IBMQ from qiskit.compiler import transpile from time import perf_counter from qiskit.tools.visualization import plot_histogram import numpy as np import m...
https://github.com/alvinli04/Quantum-Steganography
alvinli04
import numpy as np # Importing standard Qiskit libraries from qiskit import QuantumCircuit, transpile, Aer, IBMQ from qiskit.tools.jupyter import * from qiskit.visualization import * from ibm_quantum_widgets import * # Loading your IBM Quantum account(s) provider = IBMQ.load_account() import qiskit from ...
https://github.com/alvinli04/Quantum-Steganography
alvinli04
import qiskit from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, AncillaRegister from qiskit import execute from qiskit import Aer from qiskit import IBMQ from qiskit.compiler import transpile from time import perf_counter from qiskit.tools.visualization import plot_histogram from qiskit.cir...