repo
stringclasses
900 values
file
stringclasses
754 values
content
stringlengths
4
215k
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
from pprint import pprint import numpy as np import matplotlib.pyplot as plt from qiskit_cold_atom.providers import ColdAtomProvider # save an account to disk # ColdAtomProvider.save_account(url = ["url_of_backend_1", "url_of_backend_2"], username="JohnDoe",token="123456") # load the stored account provid...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
%load_ext autoreload %autoreload 2 from qiskit_cold_atom.applications import FermiHubbard1D # defining the system system = FermiHubbard1D( num_sites = 3, # number of lattice sites particles_up = 1, # number of spin up particles particles_down = 1, # number of spin down particl...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
import numpy as np from qiskit import QuantumCircuit circuit = QuantumCircuit(2) # initialization to create a 50 - 50 superposition circuit.h(0) circuit.h(1) # measurement circuit.measure_all() circuit.draw("mpl", style='clifford') from qiskit import Aer from qiskit.visualization import plot_histogr...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
import numpy as np import matplotlib.pyplot as plt # the experimental parameters J = np.pi * 134 # hopping parameter in units of hbar U = 0.7 * J # interaction parameter Nt_an = 50 # number of time steps for plotting t_analytical = np.linspace(0, 25, Nt_an) * 1e-3 # evolution times H_with_int = np.arra...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
from qiskit import QuantumRegister from qiskit.circuit import QuantumCircuit, Parameter from qiskit_cold_atom.spins.spins_gate_library import RydbergFull from qiskit_cold_atom.spins import SpinSimulator import numpy as np import matplotlib.pyplot as plt Nwires = 2 backend = SpinSimulator() qc_rabi = Quant...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
import numpy as np import matplotlib.pyplot as plt import time from qiskit_cold_atom.fermions import FermionSimulator, FfsimBackend from qiskit_cold_atom.fermions.fermion_gate_library import FermiHubbard from qiskit_nature.operators.second_quantization import FermionicOp from qiskit.circuit import Parameter ...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2023. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-cold-atom
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit import QuantumCircuit QuantumCircuit(2) QuantumCircuit(2, 2) import math qc = QuantumCircuit(4) qc.h(0) qc.id(2) qc.i(2) qc.p(math.pi/2,0) qc.rx(math.pi/4,2) qc.ry(math.pi/8,0) qc.rz(math.pi/2,1) qc.s(3) qc.sdg(3) qc.sx(2) qc.t(1) qc.tdg(1) qc.u(math.pi/2,0,math.pi,1) qc.x(3) qc.y([...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit.circuit.library import CCXGate toffoli = CCXGate() print(toffoli.num_ctrl_qubits) toffoli = CCXGate() toffoli.ctrl_state = 2 toffoli.definition.draw() from qiskit import QuantumCircuit import math p16_qc = QuantumCircuit(1) p16_qc.p(math.pi/16, 0) p16_gate = p16_qc.to_gate() p16_gat...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit.circuit import QuantumCircuit,\ ParameterVector theta = ParameterVector('θ', 3) qc = QuantumCircuit(3) qc.h([0,1,2]) qc.p(theta[0],0) qc.p(theta[1],1) qc.p(theta[2],2) qc.draw() import math b_qc = qc.bind_parameters({theta: [math.pi/8, ...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit import BasicAer print(BasicAer.backends()) from qiskit import QuantumCircuit,BasicAer,transpile qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) qc.measure_all() backend = BasicAer.get_backend("qasm_simulator") tqc = transpile(qc, backend) job = backend.run(tqc, shots=1000) result = job.result() ...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit import Aer print(Aer.backends()) from qiskit import QuantumCircuit,Aer,transpile qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) qc.measure_all() backend = Aer.get_backend("aer_simulator") tqc = transpile(qc, backend) job = backend.run(tqc, shots=1000) result = job.result() counts = result.ge...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit import QuantumCircuit,Aer,transpile from qiskit.visualization import plot_histogram qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) qc.measure_all() backend = Aer.get_backend("aer_simulator") tqc = transpile(qc, backend) job = backend.run(tqc, shots=1000) result = job.result() counts = result.get_c...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit import QuantumCircuit,Aer,transpile from qiskit.visualization import plot_state_qsphere from math import pi backend = Aer.get_backend("aer_simulator_statevector") qc = QuantumCircuit(3) qc.rx(pi, 0) qc.ry(pi/8, 2) qc.swap(0, 2) qc.h(0) qc.cp(pi/2,0, 1) qc.cp(pi/4, 0, 2) qc.h(1) qc.cp(pi/2, ...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit import QuantumCircuit from qiskit.quantum_info import Statevector qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) statevector = Statevector(qc) print(statevector.data) import numpy as np from qiskit.quantum_info import Statevector statevector = Statevector([1, 0, 0, 1] / np.sqrt(2)) print(state...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit import QuantumCircuit from qiskit.quantum_info import Operator qc = QuantumCircuit(2) qc.id(0) qc.x(1) op_XI = Operator(qc) print(op_XI.data) from qiskit.quantum_info import Operator op_XI = Operator([[0, 0, 1, 0], [0, 0, 0, 1], [1, 0, 0, 0], ...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit import QuantumCircuit from qiskit.quantum_info import Kraus import numpy as np noise_ops = [np.sqrt(0.9) * np.array([[1, 0], [0, 1]]), np.sqrt(0.1) * np.array([[0, 1], [1, 0]])] kraus = Kraus(noise_ops) qc =...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit.quantum_info import Statevector from qiskit.quantum_info import Statevector, \ Operator, state_fidelity sv_a = Statevector.from_label('+') sv_b = sv_a.evolve(Operator.from_label('T')) print(state_fidelity(sv_a, sv_b))
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit.opflow import Zero, One state = One ^ Zero ^ One ^ Zero ^ Zero print(state) from qiskit.opflow import X, Z pauli_piXZ = -(X ^ Z) print(pauli_piXZ) print(pauli_piXZ.to_matrix()) from qiskit.opflow import I, X, H, CX op = (CX ^ I) @ (I ^ CX) @ (I ^ I ^ H) print(op) from qiskit.quantum_...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit.opflow.state_fns import StateFn statefn = StateFn('10100') print(statefn) from qiskit import QuantumCircuit qc = QuantumCircuit(3) qc.h(0) qc.cx(0, 1) qc.cx(1, 2) statefn = StateFn(qc) print(statefn) import numpy as np statefn = StateFn([1, 0, 0, 1] / np.sqrt(2)) print(statefn) fr...
https://github.com/qiskit-community/qiskit-pocket-guide
qiskit-community
from qiskit.opflow.primitive_ops import PrimitiveOp from qiskit.quantum_info import Pauli primop_piXZ = PrimitiveOp(Pauli('-XZ')) print(primop_piXZ) print(type(primop_piXZ)) from qiskit.opflow import X, Z pauli_piXZ = -(X ^ Z) print(type(pauli_piXZ)) print(primop_piXZ.primitive .equiv(pauli_piXZ.pr...
https://github.com/qiskit-community/qiskit-quantinuum-provider
qiskit-community
import numpy as np from qiskit import QuantumCircuit, execute from qiskit_quantinuum import Quantinuum from qiskit.visualization import plot_histogram # Quantinuum.save_account(user_name="first.last@company.com") Quantinuum.save_account(user_name="megan.l.kohagen@quantinuum.com") Quantinuum.load_account() ...
https://github.com/qiskit-community/qiskit-quantinuum-provider
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2017. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-quantinuum-provider
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2017. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/qiskit-community/qiskit-quantinuum-provider
qiskit-community
# This code is part of Qiskit. # # (C) Copyright IBM 2017. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/Qiskit/qiskit-neko
Qiskit
# This code is part of Qiskit. # # (C) Copyright IBM 2022. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/Qiskit/qiskit-neko
Qiskit
# This code is part of Qiskit. # # (C) Copyright IBM 2022. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/Qiskit/qiskit-neko
Qiskit
# This code is part of Qiskit. # # (C) Copyright IBM 2022. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/Qiskit/qiskit-neko
Qiskit
# This code is part of Qiskit. # # (C) Copyright IBM 2022. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or deriv...
https://github.com/Qiskit/qiskit-neko
Qiskit
# This code is part of Qiskit. # # (C) Copyright IBM 2022, 2023. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/Qiskit/qiskit-neko
Qiskit
# This code is part of Qiskit. # # (C) Copyright IBM 2022, 2024. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/qiskit-community/qiskit-aqua-interfaces
qiskit-community
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0....
https://github.com/qiskit-community/qiskit-aqua-interfaces
qiskit-community
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0....
https://github.com/qiskit-community/qiskit-nature-pyscf
qiskit-community
import qiskit_qasm3_import project = 'Qiskit OpenQASM 3 Importer' copyright = '2022, Jake Lishman' author = 'Jake Lishman' version = qiskit_qasm3_import.__version__ release = qiskit_qasm3_import.__version__ extensions = [ "sphinx.ext.autodoc", "sphinx.ext.intersphinx", "reno.sphinxext", 'q...
https://github.com/unitaryfund/mitiq
unitaryfund
import numpy as np from pyquil import get_qc, Program from pyquil.gates import RX, RY, H, CNOT, MEASURE import mitiq from mitiq import zne from scipy import optimize # initialize the quantum device qc = get_qc("2q-noisy-qvm") program = Program() theta = program.declare("theta", memory_type="REAL") ro = pr...
https://github.com/unitaryfund/mitiq
unitaryfund
import numpy as np from pyquil import get_qc, Program from pyquil.gates import RX, RY, S, T, Z, CNOT, MEASURE from pyquil.paulis import PauliTerm, PauliSum, sZ from pyquil.noise import pauli_kraus_map, append_kraus_to_gate from typing import List, Union from collections import Counter from matplotlib import pypl...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. """Defines input / output types for a quantum computer (simulator): * SUPPORTED_PROGRAM_TYPES: All supported packages / circuits which Mitiq can ...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. """Information about Mitiq and dependencies.""" import platform from cirq import __version__ as cirq_version from numpy import __version__ as numpy...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. import json import cirq import numpy as np import pytest import qiskit from mitiq import QPROGRAM, SUPPORTED_PROGRAM_TYPES from mitiq.calibration ...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. """Unit tests for DDD slack windows and DDD insertion tools.""" import cirq import numpy as np import pyquil import pytest import qiskit from mi...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. """Functions to convert between Mitiq's internal circuit representation and Qiskit's circuit representation. """ import re from typing import Any, L...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. """Qiskit utility functions.""" from functools import partial from typing import Optional, Tuple import numpy as np import numpy.typing as npt im...
https://github.com/unitaryfund/mitiq
unitaryfund
# -*- 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/unitaryfund/mitiq
unitaryfund
# Copyright (C) 2024 qBraid # # This file is part of the qBraid-SDK # # The qBraid-SDK is free software released under the GNU General Public License v3 # or later. You can redistribute and/or modify it under the terms of the GPL v3. # See the LICENSE file in the project root or <https://www.gnu.org/licenses/gpl-...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. """Unit tests for qiskit executors (qiskit_utils.py).""" import numpy as np import pytest from qiskit import QuantumCircuit from qiskit_ibm_runtime....
https://github.com/unitaryfund/mitiq
unitaryfund
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. import os import numpy as np import pytest import qiskit from cirq import ( Circuit, CXPowGate, DepolarizingChannel, I, Lin...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. """Unit tests for PEC.""" import warnings from functools import partial from typing import List, Optional import cirq import numpy as np import ...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. """Tests for mitiq.pec.sampling functions.""" import cirq import numpy as np import pytest from cirq import ( Circuit, Gate, LineQubi...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. import cirq import numpy as np import pyquil import pytest import qiskit from cirq import Circuit from mitiq.pec.types import NoisyBasis, NoisyOpe...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. import random import cirq import networkx as nx import numpy as np import pennylane as qml import pytest import qiskit from pennylane.tape import...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. """Tests for circuit conversions.""" from typing import List import cirq import numpy as np import pennylane as qml import pytest import qibo i...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. """Unit tests for scaling noise by unitary folding.""" import numpy as np import pytest from cirq import ( Circuit, GridQubit, InsertS...
https://github.com/unitaryfund/mitiq
unitaryfund
# Copyright (C) Unitary Fund # # This source code is licensed under the GPL license (v3) found in the # LICENSE file in the root directory of this source tree. """Unit tests for zero-noise extrapolation.""" import functools from typing import List import cirq import numpy as np import pytest import qisk...
https://github.com/Sentdex/QuantumComputing
Sentdex
import qiskit as q %matplotlib inline circuit = q.QuantumCircuit(2,2) # 2 qubits, 2 classical bits circuit.x(0) # not gate, flips qubit 0. circuit.cx(0, 1) #cnot, controlled not, Flips 2nd qubit's value if first qubit is 1 circuit.measure([0,1], [0,1]) # ([qbitregister], [classicalbitregister]) Measure qubit...
https://github.com/qiskit-community/qiskit-qcgpu-provider
qiskit-community
import click import time import random import statistics import csv import os.path import math from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit from qiskit import QiskitError, execute, Aer from qiskit_qcgpu_provider import QCGPUProvider # Implementation of the Quantum Fourier Transf...
https://github.com/qiskit-community/qiskit-qcgpu-provider
qiskit-community
""" Example used in the README. In this example a Bell state is made. """ # Import the Qiskit from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, QiskitError from qiskit import execute from qiskit_qcgpu_provider import QCGPUProvider # Create a Quantum Register with 2 qubits. q = Quantum...
https://github.com/qiskit-community/qiskit-qcgpu-provider
qiskit-community
""" In this example a Bell state is made. """ from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import execute from qiskit_qcgpu_provider import QCGPUProvider Provider = QCGPUProvider() # Create a Quantum Register with 2 qubits. q = QuantumRegister(2) # Create a Quantum Ci...
https://github.com/qiskit-community/qiskit-qcgpu-provider
qiskit-community
from qiskit_chemistry import QiskitChemistry from qiskit import Aer qiskit_chemistry_dict = { 'driver': {'name': 'HDF5'}, 'HDF5': {'hdf5_input': '0.7_sto-3g.hdf5'}, 'operator': {'name': 'hamiltonian'}, 'algorithm': {'name': 'VQE'}, 'optimizer': {'name': 'COBYLA'}, 'variational_form': {...
https://github.com/qiskit-community/qiskit-qcgpu-provider
qiskit-community
from qiskit_aqua import run_algorithm from qiskit_qcgpu_provider import QCGPUProvider sat_cnf = """ c Example DIMACS 3-sat p cnf 3 5 -1 -2 -3 0 1 -2 3 0 1 2 -3 0 1 -2 -3 0 -1 2 3 0 """ params = { "problem": { "name": "search" }, "algorithm": { "name": "Grover" }, "oracle": { "name": "SAT", "cnf"...
https://github.com/qiskit-community/qiskit-qcgpu-provider
qiskit-community
import matplotlib.pyplot as ply %matplotlib inline import networkx as nx import numpy as np from qiskit_aqua.translators.ising import maxcut from qiskit_aqua.input import EnergyInput from qiskit_aqua import run_algorithm from qiskit_qcgpu_provider import QCGPUProvider nodes = 5 edges = [ # Tuple (i,...
https://github.com/qiskit-community/qiskit-qcgpu-provider
qiskit-community
import numpy as np import scipy from scipy.linalg import expm import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler, MinMaxScaler from sklearn.decomposition import...
https://github.com/qiskit-community/qiskit-qcgpu-provider
qiskit-community
import matplotlib.pyplot as ply %matplotlib inline import networkx as nx import numpy as np from qiskit_aqua.translators.ising import tsp from qiskit_aqua.input import EnergyInput from qiskit_aqua import run_algorithm from qiskit_qcgpu_provider import QCGPUProvider locations = 3 problem = tsp.random_ts...
https://github.com/qiskit-community/qiskit-qcgpu-provider
qiskit-community
""" Exception for errors raised by QCGPU simulators """ from qiskit import QiskitError class QCGPUSimulatorError(QiskitError): """Base class for errors raised by simulators.""" def __init__(self, *message): """Set the error message""" super().__init__(*message) self.mess...
https://github.com/qiskit-community/qiskit-qcgpu-provider
qiskit-community
# -*- coding: utf-8 -*- # Copyright 2017, IBM. # # This source code is licensed under the Apache License, Version 2.0 found in # the LICENSE.txt file in the root directory of this source tree. # pylint: disable=missing-docstring,redefined-builtin import unittest import os from qiskit import QuantumCircuit...
https://github.com/qiskit-community/qiskit-qcgpu-provider
qiskit-community
import unittest import math from qiskit_qcgpu_provider import QCGPUProvider from qiskit import execute, QuantumRegister, QuantumCircuit, BasicAer from qiskit.quantum_info import state_fidelity from .case import MyTestCase class TestStatevectorSimulator(MyTestCase): """Test the state vector simulator"...
https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience
PacktPublishing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created Nov 2020 @author: hassi """ # Import Qiskit import qiskit # Set versions variable to the current Qiskit versions versions=qiskit.__qiskit_version__ # Print the version number for the Qiskit components print("Qiskit components and versions:") ...
https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience
PacktPublishing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created Nov 2020 @author: hassi """ # For this simple recipe we will only need the QuantumCircuit method from qiskit import QuantumCircuit print("Ch 3: Moving between worlds 1") print("-----------------------------") # First we import the QASM string ...
https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience
PacktPublishing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created Nov 2020 @author: hassi """ from qiskit import QuantumRegister, ClassicalRegister from qiskit import QuantumCircuit, Aer, execute from qiskit.tools.visualization import plot_histogram from IPython.core.display import display print("Ch 4: Quant...
https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience
PacktPublishing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created Nov 2020 @author: hassi """ from qiskit import QuantumRegister, ClassicalRegister from qiskit import QuantumCircuit, Aer, execute from qiskit.tools.visualization import plot_histogram from IPython.core.display import display print("Ch 4: Quant...
https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience
PacktPublishing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created Nov 2020 @author: hassi """ from qiskit import QuantumCircuit, Aer, execute from qiskit.visualization import plot_histogram from IPython.core.display import display print("Ch 4: Upside down quantum coin toss") print("--------------------------...
https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience
PacktPublishing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created Nov 2020 @author: hassi """ from qiskit import QuantumCircuit, Aer, execute from qiskit.tools.visualization import plot_histogram from IPython.core.display import display print("Ch 4: Quantum double coin toss") print("---------------------------...
https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience
PacktPublishing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created Nov 2020 @author: hassi """ from qiskit import QuantumCircuit, Aer, execute from qiskit.tools.visualization import plot_histogram from IPython.core.display import display print("Ch 4: Cheating quantum coin toss") print("-------------------------...
https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience
PacktPublishing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created Nov 2020 @author: hassi """ from qiskit import QuantumCircuit, Aer, execute from qiskit.tools.visualization import plot_histogram from IPython.core.display import display from math import pi # Function that returns the state vector (Psi) for the...
https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience
PacktPublishing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created Nov 2020 @author: hassi """ from qiskit import QuantumCircuit, Aer, execute from qiskit.tools.visualization import plot_histogram from IPython.core.display import display print("Ch 4: Three-qubit coin toss") print("---------------------------") ...
https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience
PacktPublishing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created Nov 2020 @author: hassi """ from qiskit import QuantumCircuit, execute from qiskit import IBMQ from qiskit.tools.monitor import job_monitor from IPython.core.display import display print("Getting provider...") if not IBMQ.active_account(): ...
https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience
PacktPublishing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created Nov 2020 Updated Aug 2021 @author: hassi """ from qiskit import IBMQ, QuantumCircuit, execute from qiskit.tools.monitor import job_monitor print("Ch 5: Identifying backends") print("--------------------------") print("Getting provider...") i...
https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience
PacktPublishing
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created Nov 2020 @author: hassi """ from qiskit import IBMQ, QuantumCircuit, execute from qiskit.tools.monitor import job_monitor from qiskit.visualization import plot_histogram from IPython.core.display import display print("Ch 5: Comparing backends"...