repo
stringclasses
900 values
file
stringclasses
754 values
content
stringlengths
4
215k
https://github.com/2lambda123/Qiskit-qiskit
2lambda123
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2018. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/2lambda123/Qiskit-qiskit
2lambda123
# 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. # # Any modifications or deriv...
https://github.com/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
#!/usr/bin/env python3 # 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. # # An...
https://github.com/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
# Testing Circuits import warnings warnings.simplefilter("ignore") %run "mpl/circuit/test_circuit_matplotlib_drawer.py" # Testing Graphs %run "mpl/graph/test_graph_matplotlib_drawer.py" %run -i "results.py" RESULTS_CIRCUIT RESULTS_GRAPH
https://github.com/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
# 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/2lambda123/Qiskit-qiskit
2lambda123
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2023. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or...
https://github.com/2lambda123/Qiskit-qiskit
2lambda123
#!/usr/bin/env python3 # 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...
https://github.com/miamico/Quantum_Generative_Adversarial_Networks
miamico
"""Simple example on how to log scalars and images to tensorboard without tensor ops. License: Copyleft """ __author__ = "Michael Gygli" import tensorflow as tf # from StringIO import StringIO import matplotlib.pyplot as plt import numpy as np class Logger(object): """Logging in tensorboard without t...
https://github.com/miamico/Quantum_Generative_Adversarial_Networks
miamico
%%capture %pip install qiskit %pip install qiskit_ibm_provider %pip install qiskit-aer # Importing standard Qiskit libraries from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, QuantumCircuit, transpile, Aer from qiskit_ibm_provider import IBMProvider from qiskit.tools.jupyter import * from...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
import numpy as np import matplotlib.pyplot as plt from qiskit import QuantumCircuit, QuantumRegister from qiskit.extensions import HamiltonianGate from qiskit.circuit.library.standard_gates import CRYGate def quantum_fourier_transform(t, vis=False): reg = QuantumRegister(t, name='c') circ = Quantu...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
import numpy as np import hhl_components as cmp import matplotlib.pyplot as plt from qiskit import QuantumCircuit from qiskit import Aer, execute from qiskit.visualization import plot_histogram # Initialize parameters t0 = 2 * np.pi r = 6 A = [[3.75, 2.25, 1.25, -0.75], [2.25, 3.75, 0.75, -1.25], ...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
import numpy as np import matplotlib.pyplot as plt from qiskit import QuantumCircuit, Aer, execute from qiskit.circuit import ParameterVector from qiskit.extensions import HamiltonianGate from qiskit.visualization import plot_histogram from qiskit.aqua.components.optimizers import COBYLA class QAOA: ...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
import numpy as np import matplotlib.pyplot as plt from qiskit import QuantumCircuit from qiskit import QuantumRegister from qiskit.quantum_info import Operator from qiskit.circuit.library.standard_gates import XGate, YGate, ZGate class FiveQubitCode: def __init__(self): # Initialize Registe...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
"""Performance Analysis of 5 Qubit Code under Depolarizing Error""" import noise import numpy as np import matplotlib.pyplot as plt from qiskit import QuantumCircuit, ClassicalRegister from qiskit import Aer, execute from qiskit.visualization import plot_histogram, plot_bloch_vector from five_qubit_code impo...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
import numpy as np import matplotlib.pyplot as plt from qiskit import QuantumCircuit from qiskit import QuantumRegister from qiskit.quantum_info import Operator from qiskit.circuit.library.standard_gates import XGate class ThreeQubitCode: def __init__(self): # Initialize Registers ...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
"""Performance Analysis of 3 Qubit Code under Bit Flip Error""" import noise import numpy as np import matplotlib.pyplot as plt from qiskit import QuantumCircuit, ClassicalRegister from qiskit import Aer, execute from qiskit.quantum_info import partial_trace, state_fidelity from qiskit.quantum_info import De...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
import random import numpy as np import matplotlib.pyplot as plt from qiskit import QuantumCircuit, Aer, execute from qiskit.circuit import ParameterVector from qiskit.quantum_info import state_fidelity from qiskit.quantum_info import Statevector, DensityMatrix, Operator class Compressor: def __init...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
import numpy as np from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import Aer, execute from qiskit.circuit import Gate # Define no. of message qubits n = 10 # Alice's end alice_prepare = np.random.choice([0,1], size=(n,), p=[0.5, 0.5]) alice_hadamard = np.random.choice([0,1...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
from qiskit import * from qiskit.tools.visualization import plot_histogram %matplotlib inline secretnumber = '11100011' circuit = QuantumCircuit(len(secretnumber)+1,len(secretnumber)) circuit.h(range(len(secretnumber))) circuit.x(len(secretnumber)) circuit.h(len(secretnumber)) circuit.barrier() for i...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
import numpy as np from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import Aer, execute from qiskit.circuit import Gate from qiskit.visualization import plot_histogram, plot_bloch_multivector circ = QuantumCircuit(2, 1) circ.reset([0, 1]) circ.x(0) circ.barrier() circ.h([0, 1...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
import numpy as np from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import Aer, execute from qiskit.circuit import Gate from qiskit.visualization import plot_histogram, plot_bloch_multivector # Define no. of input qubits n = 4 circ = QuantumCircuit(n+1, n) circ.reset(range(n...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
my_list = [1,3,5,2,4,2,5,8,0,7,6] #classical computation method def oracle(my_input): winner =7 if my_input is winner: response = True else: response = False return response for index, trial_number in enumerate(my_list): if oracle(trial_number) is True: pri...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
import numpy as np from math import pi from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import Aer, execute from qiskit.circuit import Gate from qiskit.visualization import plot_histogram from qiskit.circuit.library.standard_gates import ZGate, XGate # Define circuit parameters...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
from qiskit import * from qiskit.visualization import plot_bloch_multivector, plot_bloch_vector, plot_histogram from qiskit.compiler import transpile, assemble from qiskit.tools.monitor import job_monitor from qiskit.providers.ibmq import least_busy import matplotlib import numpy as np %pylab inline qc =...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
# initialization import numpy as np # importing Qiskit from qiskit import IBMQ, BasicAer from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, execute, Aer from qiskit.tools.jupyter import * provider = IBMQ.load_account() # import basic plot tools from qiskit.visualization import ...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
# Importing Packages from qiskit import IBMQ, Aer from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, transpile, assemble, QuantumRegister, ClassicalRegister from qiskit.visualization import plot_histogram from qiskit_textbook.tools import simon_oracle bb = input("Enter the input st...
https://github.com/shantomborah/Quantum-Algorithms
shantomborah
import numpy as np from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import Aer, execute from qiskit.circuit import Gate from qiskit.visualization import plot_bloch_multivector from math import pi q = QuantumRegister(3, name='q') c = ClassicalRegister(2, name='c') circ = Quantu...
https://github.com/LohitPotnuru/TransverseIsingModelQiskit
LohitPotnuru
from qiskit import * from scipy.optimize import minimize import numpy as np from pylab import * #2^4 possible states of four qubits stored in dic bit = ['0','1'] dic = [] for i in bit: for j in bit: for k in bit: for l in bit: dic.append(i+j+l+k) def calcEJ(thet...
https://github.com/sebasmos/QuantumVE
sebasmos
import numpy as np import matplotlib.pyplot as plt def initial_state(num_positions): return np.ones(num_positions) / num_positions def predict_state(prior_prob, velocity): num_positions = len(prior_prob) predicted_prob = np.zeros(num_positions) for i in range(num_positions): predicte...
https://github.com/sebasmos/QuantumVE
sebasmos
%reset -f %matplotlib inline import numpy as np import matplotlib.pyplot as plt import numpy as np import pickle import datetime import os name_data = "sample_trajectories.pkl" os.makedirs("data") Fn = os.path.join(os.getcwd(),"data",name_data) # initialize random number generator rng = np.random.d...
https://github.com/sebasmos/QuantumVE
sebasmos
#Assign these values as per your requirements. global min_qubits,max_qubits,skip_qubits,max_circuits,num_shots,Noise_Inclusion min_qubits=1 max_qubits=3 skip_qubits=1 max_circuits=3 num_shots=1000 use_XX_YY_ZZ_gates = True Noise_Inclusion = False saveplots = False Memory_utilization_plot = True Type_...
https://github.com/sebasmos/QuantumVE
sebasmos
import numpy as np import qiskit.pulse as pulse from qiskit.circuit import Parameter from qiskit_experiments.calibration_management.backend_calibrations import BackendCalibrations from qiskit import IBMQ, schedule API_KEY = "5bd4ecfdc74e6680da7c79998259781431661e5326ae2f88eea95dee8f74b87530ba63fbca8105404d...
https://github.com/sebasmos/QuantumVE
sebasmos
API_KEY = "5bd4ecfdc74e6680da7c79998259781431661e5326ae2f88eea95dee8f74b87530ba63fbca8105404de4ffd36e4b484631907acff73c805580928218a5ccf0b3" import qiskit as q from qiskit import IBMQ,schedule import numpy as np import qiskit.pulse as pulse from qiskit.circuit import Parameter %matplotlib inline import s...
https://github.com/sebasmos/QuantumVE
sebasmos
import qiskit as q from qiskit import IBMQ %matplotlib inline IBMQ.save_account("5bd4ecfdc74e6680da7c79998259781431661e5326ae2f88eea95dee8f74b87530ba63fbca8105404de4ffd36e4b484631907acff73c805580928218a5ccf0b3") # Details in: https://qiskit.org/documentation/install.html # https://quantumcomputing.stackexchange...
https://github.com/sebasmos/QuantumVE
sebasmos
API_KEY = "5bd4ecfdc74e6680da7c79998259781431661e5326ae2f88eea95dee8f74b87530ba63fbca8105404de4ffd36e4b484631907acff73c805580928218a5ccf0b3" import qiskit as q from qiskit import IBMQ,schedule import numpy as np import qiskit.pulse as pulse from qiskit.circuit import Parameter %matplotlib inline import s...
https://github.com/sebasmos/QuantumVE
sebasmos
# Quantum Kernel Alighment [Reference](https://quantumcomputing.com/Havry/projects/qiskit-runtime-quantum-kernel-alignment/files/main.py) API_KEY = "5bd4ecfdc74e6680da7c79998259781431661e5326ae2f88eea95dee8f74b87530ba63fbca8105404de4ffd36e4b484631907acff73c805580928218a5ccf0b3" import qiskit as q from qiskit...
https://github.com/sebasmos/QuantumVE
sebasmos
# This code is part of qiskit-runtime. # # (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 ...
https://github.com/sebasmos/QuantumVE
sebasmos
# This code is part of qiskit-runtime. # # (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 ...
https://github.com/sebasmos/QuantumVE
sebasmos
import sys sys.path.insert(0,'../') from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.optim.lr_scheduler import StepLR from torch.utils.data import random...
https://github.com/sebasmos/QuantumVE
sebasmos
import sys sys.path.insert(0,'../') from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.optim.lr_scheduler import StepLR from torch.utils.data import random...
https://github.com/sebasmos/QuantumVE
sebasmos
!pwd from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.optim.lr_scheduler import StepLR from torch.utils.data import random_split from torch.utils.data i...
https://github.com/sebasmos/QuantumVE
sebasmos
from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.optim.lr_scheduler import StepLR from torch.utils.data import random_split from torch.utils.data import Su...
https://github.com/sebasmos/QuantumVE
sebasmos
from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.optim.lr_scheduler import StepLR from torch.utils.data import random_split from torch.utils.data import Su...
https://github.com/sebasmos/QuantumVE
sebasmos
from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.optim.lr_scheduler import StepLR from torch.utils.data import random_split from torch.utils.data import Su...
https://github.com/sebasmos/QuantumVE
sebasmos
import sys import os import torch import numpy as np import matplotlib.pyplot as plt from PIL import Image import models_mae import torch; print(f'numpy version: {np.__version__}\nCUDA version: {torch.version.cuda} - Torch versteion: {torch.__version__} - device count: {torch.cuda.device_count()}') # define...
https://github.com/sebasmos/QuantumVE
sebasmos
import os MODEL_METADATA = "SVM" model_name = "efficientnet_b3_embeddings_finetuning" EXPERIMENT_NAME = "efficientnet_b3_embeddings_"#"efficientnet_v2_m"#"convnext_base"#"efficientnet_b3"#"mobileNet" results_path = f"{model_name}/{MODEL_METADATA}" os.makedirs(results_path, exist_ok = True) train_path = f"{model_n...
https://github.com/sebasmos/QuantumVE
sebasmos
# Define the model name model_name = "efficientnet_b3" #EfficientNet_B7_Weights.IMAGENET1K_V1 feat_space = 8 !pwd %cd qubico !pwd import torchvision.models as models import torch MODEL_CONSTRUCTORS = { 'alexnet': models.alexnet, 'convnext_base': models.convnext_base, 'convnext_large': models....
https://github.com/sebasmos/QuantumVE
sebasmos
# !pip install qiskit torch torchvision matplotlib # !pip install qiskit-machine-learning # !pip install torchviz # !pip install qiskit[all] # !pip install qiskit == 0.45.2 # !pip install qiskit_algorithms == 0.7.1 # !pip install qiskit-ibm-runtime == 0.17.0 # !pip install qiskit-aer == 0.13.2 # #Quentum ne...
https://github.com/sebasmos/QuantumVE
sebasmos
# !pip install qiskit torch torchvision matplotlib # !pip install qiskit-machine-learning # !pip install torchviz # !pip install qiskit[all] # !pip install qiskit == 0.45.2 # !pip install qiskit_algorithms == 0.7.1 # !pip install qiskit-ibm-runtime == 0.17.0 # !pip install qiskit-aer == 0.13.2 # #Quentum ne...
https://github.com/sebasmos/QuantumVE
sebasmos
# !pip install qiskit torch torchvision matplotlib # !pip install qiskit-machine-learning # !pip install torchviz # !pip install qiskit[all] # !pip install qiskit == 0.45.2 # !pip install qiskit_algorithms == 0.7.1 # !pip install qiskit-ibm-runtime == 0.17.0 # !pip install qiskit-aer == 0.13.2 # #Quentum ne...
https://github.com/sebasmos/QuantumVE
sebasmos
import sys sys.path.insert(0,'../') # from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim.lr_scheduler import StepLR from torch.utils.data import random_split from torch.utils.data import Subset,...
https://github.com/sebasmos/QuantumVE
sebasmos
import os MODEL_METADATA = "RF" model_name = "efficientnet_v2_m"#"efficientnet_b7"## "mobilenet_v3_large"#"convnext_base" EXPERIMENT_NAME = f"{model_name}_embeddings" results_path = f"{EXPERIMENT_NAME}/{MODEL_METADATA}" os.makedirs(results_path, exist_ok = True) os.makedirs(EXPERIMENT_NAME, exist_ok = True) tr...
https://github.com/sebasmos/QuantumVE
sebasmos
import os MODEL_METADATA = "SVM" model_name = "efficientnet_b3_embeddings_finetuning" EXPERIMENT_NAME = "efficientnet_b3_embeddings_"#"efficientnet_v2_m"#"convnext_base"#"efficientnet_b3"#"mobileNet" results_path = f"{model_name}/{MODEL_METADATA}" os.makedirs(results_path, exist_ok = True) train_path = f"{model_n...
https://github.com/sebasmos/QuantumVE
sebasmos
import os MODEL_METADATA = "XGBoost" model_name = "convnext_base" EXPERIMENT_NAME = f"{model_name}_embeddings" results_path = f"{EXPERIMENT_NAME}/{MODEL_METADATA}" os.makedirs(results_path, exist_ok = True) os.makedirs(EXPERIMENT_NAME, exist_ok = True) train_path = f"{EXPERIMENT_NAME}/train" val_path = f"{EXP...
https://github.com/sebasmos/QuantumVE
sebasmos
# Define the model name model_name = "efficientnet_v2_m" #EfficientNet_B7_Weights.IMAGENET1K_V1 !pwd %cd Vector_Embeddings !pwd import torchvision.models as models import torch MODEL_CONSTRUCTORS = { 'alexnet': models.alexnet, 'convnext_base': models.convnext_base, 'convnext_large': models.con...
https://github.com/sebasmos/QuantumVE
sebasmos
!pip install tensorflow==2.4.1 !pip install tensorflow-quantum import tensorflow as tf import tensorflow_quantum as tfq import cirq import sympy import numpy as np # visualization tools %matplotlib inline import matplotlib.pyplot as plt from cirq.contrib.svg import SVGCircuit a, b = sympy.symbols('...
https://github.com/derivation/ThinkQuantum
derivation
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute, Aer from qiskit.tools.visualization import circuit_drawer, plot_histogram import numpy as np from numpy import pi num_measurements = 5 q = QuantumRegister(1) c = ClassicalRegister(num_measurements) circ = QuantumCircuit(q,c) ...
https://github.com/derivation/ThinkQuantum
derivation
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute, Aer from qiskit.tools.visualization import circuit_drawer, plot_histogram import numpy as np from numpy import pi num_measurements = 5 q = QuantumRegister(1) c = ClassicalRegister(num_measurements) circ = QuantumCircuit(q,c) ...
https://github.com/derivation/ThinkQuantum
derivation
import numpy as np from numpy import pi import matplotlib.pyplot as plt import matplotlib.image as mpimg filename = './schrodin_yang.png' im = mpimg.imread(filename) fig, ax = plt.subplots() ax.imshow(im) from skimage.transform import resize n_pixels = 2**5 im = resize(im, (n_pixels, n_pixels)) fig, a...
https://github.com/derivation/ThinkQuantum
derivation
import numpy as np from numpy import pi import matplotlib.pyplot as plt import matplotlib.image as mpimg from skimage.transform import resize filename = './schrodin_yang.png' im = mpimg.imread(filename) n_pixels = 2**5 im = resize(im, (n_pixels, n_pixels)) data = im[:,:,0].ravel() fig, ax = plt.subpl...
https://github.com/derivation/ThinkQuantum
derivation
import numpy as np from numpy import pi import matplotlib.pyplot as plt import matplotlib.image as mpimg filename = './schrodin_yang.png' im = mpimg.imread(filename) fig, ax = plt.subplots() ax.imshow(im) from skimage.transform import resize n_pixels = 2**5 im = resize(im, (n_pixels, n_pixels)) fig, a...
https://github.com/derivation/ThinkQuantum
derivation
import numpy as np from numpy import pi import matplotlib.pyplot as plt import matplotlib.image as mpimg from skimage.transform import resize filename = './schrodin_yang.png' im = mpimg.imread(filename) n_pixels = 2**5 im = resize(im, (n_pixels, n_pixels)) data = im[:,:,0].ravel() fig, ax = plt.subpl...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
%pip install git+https://github.com/qiskit-community/Quantum-Challenge-Grader.git --upgrade # qc-grader should be 0.18.12 (or higher) import qc_grader qc_grader.__version__ ### Install Qiskit and relevant packages, if needed ### IMPORTANT: Make sure you are on 3.10 > python < 3.12 %pip install qiskit[visual...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
from qiskit import QuantumCircuit # Create a new circuit with a single qubit qc = QuantumCircuit(1) # Add a Not gate to qubit 0 qc.x(0) # Return a drawing of the circuit using MatPlotLib ("mpl"). This is the # last line of the cell, so the drawing appears in the cell output. qc.draw("mpl") ### CHECK QIS...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
import numpy as np # Importing standard Qiskit libraries from qiskit import QuantumCircuit, transpile, assemble, Aer, IBMQ, execute from qiskit.quantum_info import Statevector from qiskit.visualization import plot_bloch_multivector, plot_histogram from qiskit_textbook.problems import dj_problem_oracle def lab...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
import networkx as nx import numpy as np import plotly.graph_objects as go import matplotlib as mpl import pandas as pd from IPython.display import clear_output from plotly.subplots import make_subplots from matplotlib import pyplot as plt from qiskit import Aer from qiskit import QuantumCircuit from qiskit.v...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# qc-grader should be 0.18.10 (or higher) import qc_grader qc_grader.__version__ # Imports import numpy as np import matplotlib.pyplot as plt from qiskit.circuit.library import EfficientSU2 from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager from qiskit_ibm_runtime import Qiskit...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# please create a 3 qubit GHZ circuit # please create a 2 qubit ch gate with only cx and ry gate # Enter your prompt here - Delete this line
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
from qiskit.circuit.library import RealAmplitudes ansatz = RealAmplitudes(num_qubits=2, reps=1, entanglement='linear') ansatz.draw('mpl', style='iqx') from qiskit.opflow import Z, I hamiltonian = Z ^ Z from qiskit.opflow import StateFn expectation = StateFn(hamiltonian, is_measurement=True) @ StateFn(an...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
### Install Qiskit and relevant packages, if needed ### IMPORTANT: Make sure you are on 3.10 > python < 3.12 ''' %pip install qiskit[visualization]==1.0.2 %pip install qiskit-ibm-runtime %pip install qiskit-aer %pip install graphviz %pip install qiskit-serverless -U %pip install qiskit-transpiler-service -U ''...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# transpile_parallel.py from qiskit import QuantumCircuit from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager from qiskit_transpiler_service.transpiler_service import TranspilerService from qiskit_serverless import get_arguments, save_result, distribute_task, get from qiskit_ibm_runtim...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
import json import logging import numpy as np import warnings from functools import wraps from typing import Any, Callable, Optional, Tuple, Union from qiskit import IBMQ, QuantumCircuit, assemble from qiskit.circuit import Barrier, Gate, Instruction, Measure from qiskit.circuit.library import UGate, U3Ga...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# -*- 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/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
from qiskit import QuantumCircuit # Create a new circuit with a single qubit qc = QuantumCircuit(1) # Add a Not gate to qubit 0 qc.x(0) # Return a drawing of the circuit using MatPlotLib ("mpl"). This is the # last line of the cell, so the drawing appears in the cell output. qc.draw("mpl") ### CHECK QIS...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# imports import numpy as np from typing import List, Callable from scipy.optimize import minimize from scipy.optimize._optimize import OptimizeResult import matplotlib.pyplot as plt from qiskit import QuantumCircuit from qiskit.quantum_info import Statevector, Operator, SparsePauliOp from qiskit.primitives i...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# Imports from qiskit.circuit.random import random_circuit from qiskit.circuit.library import XGate, YGate from qiskit_ibm_runtime.fake_provider import FakeTorino, FakeOsaka from qiskit.transpiler import InstructionProperties, PassManager from qiskit.transpiler.preset_passmanagers import generate_preset_pass_man...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# qc-grader should be 0.18.10 (or higher) import qc_grader qc_grader.__version__ # Imports import numpy as np import matplotlib.pyplot as plt from qiskit.circuit.library import EfficientSU2 from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager from qiskit_ibm_runtime import Qiskit...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# qc-grader should be 0.18.11 (or higher) import qc_grader qc_grader.__version__ # Imports import numpy as np import matplotlib.pyplot as plt from qiskit import QuantumCircuit from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager from qiskit.visualization import plot_gate_map fro...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# please create a 3 qubit GHZ circuit # please create a 2 qubit ch gate with only cx and ry gate # Enter your prompt here - Delete this line
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# qc-grader should be 0.18.11 (or higher) import qc_grader qc_grader.__version__ # Import all in one cell import numpy as np import matplotlib.pyplot as plt from timeit import default_timer as timer import warnings from qiskit import QuantumCircuit from qiskit.transpiler.preset_passmanagers import gene...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# Import all in one cell import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.optimize import minimize from qiskit import QuantumCircuit from qiskit.quantum_info import SparsePauliOp from qiskit.circuit.library import RealAmplitudes from qiskit.transpiler.preset_passmanagers imp...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
### Install Qiskit and relevant packages, if needed ### IMPORTANT: Make sure you are on 3.10 > python < 3.12 ''' %pip install qiskit[visualization]==1.0.2 %pip install qiskit-ibm-runtime %pip install qiskit-aer %pip install graphviz %pip install qiskit-serverless -U %pip install qiskit-transpiler-service -U ''...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# transpile_parallel.py from qiskit import QuantumCircuit from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager from qiskit_transpiler_service.transpiler_service import TranspilerService from qiskit_serverless import get_arguments, save_result, distribute_task, get from qiskit_ibm_runtim...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
import numpy as np from qiskit import transpile, QuantumCircuit def version_check(): import qiskit if qiskit.version.VERSION == '1.0.2': return print("You have the right version! Enjoy the challenge!") else: return print("please install right version by copy/paste and execute - !pip...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
from qiskit_aer import AerSimulator import logging from typing import Optional import time import numpy as np from scipy.optimize import minimize from qiskit import QuantumCircuit from qiskit_ibm_runtime import ( EstimatorV2 as Estimator, SamplerV2 as Sampler, QiskitRuntimeService, Session,...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
import numpy as np # Importing standard Qiskit libraries from qiskit import QuantumCircuit, transpile, assemble, Aer, IBMQ, execute from qiskit.quantum_info import Statevector from qiskit.visualization import plot_bloch_multivector, plot_histogram from qiskit_textbook.problems import dj_problem_oracle def lab...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# transpile_parallel.py from qiskit import QuantumCircuit from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager from qiskit_transpiler_service.transpiler_service import TranspilerService from qiskit_serverless import get_arguments, save_result, distribute_task, get from qiskit_ibm_runtim...
https://github.com/ronitd2002/IBM-Quantum-challenge-2024
ronitd2002
# transpile_parallel.py from qiskit import QuantumCircuit from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager from qiskit_transpiler_service.transpiler_service import TranspilerService from qiskit_serverless import get_arguments, save_result, distribute_task, get from qiskit_ibm_runtim...