repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
TEC-reduced-model | TEC-reduced-model-main/setup.py | from setuptools import setup, find_packages
install_requires = [
"pybamm == 0.4.0",
"matplotlib",
"prettytable",
"jax",
"jaxlib",
"SciencePlots",
]
setup(
name="tec_reduced_model",
version="0.2",
author="Ferran Brosa Planella",
author_email="[email protected]"... | 692 | 26.72 | 86 | py |
TEC-reduced-model | TEC-reduced-model-main/tec_reduced_model/set_parameters.py | #
# Definitions for the tuned parameters to the experiment
#
import pybamm
import numpy as np
from tec_reduced_model.process_experimental_data import import_thermal_data, get_idxs
def set_thermal_parameters(param, h, cp, T):
cp_factor = cp / param.evaluate(pybamm.ThermalParameters().rho_eff_dim(T))
h_factor ... | 2,112 | 29.623188 | 88 | py |
TEC-reduced-model | TEC-reduced-model-main/tec_reduced_model/process_experimental_data.py | #
# Auxiliary functions to load and process experimental data
#
import numpy as np
import pandas as pd
import os
def clean_dataset(dataset):
new_dataset = dataset.dropna(axis=1, how="all")
replace_dict = {
"Step Time": "Step Time [s]",
"Prog Time": "Time [s]",
"Voltage": "Voltage [V]"... | 2,621 | 28.133333 | 88 | py |
TEC-reduced-model | TEC-reduced-model-main/tec_reduced_model/__init__.py | 0 | 0 | 0 | py | |
TEC-reduced-model | TEC-reduced-model-main/scripts/compare_TSPMe_TDFN.py | #
# Comparison between TSPMe and thermal Doyle-Fuller-Newman model
#
import pybamm
import numpy as np
import matplotlib.pyplot as plt
from os import path
from tec_reduced_model.set_parameters import set_thermal_parameters
plt.style.use(["science", "vibrant"])
plt.rcParams.update(
{
"font.size": 8,
... | 5,667 | 27.482412 | 81 | py |
TEC-reduced-model | TEC-reduced-model-main/scripts/compare_mesh_points.py | #
# Comparison between different number of grid points in mesh
#
import pybamm
from tec_reduced_model.set_parameters import set_thermal_parameters
pybamm.set_logging_level("INFO")
# Define TDFN with a lumped themral model
model = pybamm.lithium_ion.DFN(
options={
"thermal": "lumped",
"dimensiona... | 1,378 | 23.192982 | 82 | py |
TEC-reduced-model | TEC-reduced-model-main/scripts/plot_OCVs.py | #
# Plot OCVs
#
import pybamm
import matplotlib.pyplot as plt
from os import path
plt.style.use(["science", "vibrant"])
plt.rcParams.update(
{
"font.size": 8,
"axes.labelsize": 10,
}
)
pybamm.set_logging_level("INFO")
root = path.dirname(path.dirname(__file__))
# Define parameter set Chen ... | 898 | 20.926829 | 72 | py |
TEC-reduced-model | TEC-reduced-model-main/scripts/compare_TSPMe_data.py | #
# Comparison between TSPMe and experimental data
#
import pybamm
import numpy as np
import matplotlib.pyplot as plt
from os import path
from tec_reduced_model.set_parameters import (
set_thermal_parameters,
set_experiment_parameters,
set_ambient_temperature,
)
from tec_reduced_model.process_experimental_... | 7,902 | 27.024823 | 87 | py |
TEC-reduced-model | TEC-reduced-model-main/scripts/time_TSPMe_TDFN.py | #
# Get computational time for TSPMe and TDFN
#
import pybamm
import numpy as np
from prettytable import PrettyTable
# Import auxiliary functions
from tec_reduced_model.set_parameters import set_thermal_parameters
pybamm.set_logging_level("WARNING")
# Define TSPMe using Integrated electrolyte conductivity submodel
... | 2,153 | 28.108108 | 88 | py |
TEC-reduced-model | TEC-reduced-model-main/scripts/compare_TSPMe_data_mean.py | #
# Comparison between TSPMe and experimental data
#
import pybamm
import numpy as np
import matplotlib.pyplot as plt
from os import path
from tec_reduced_model.set_parameters import (
set_thermal_parameters,
set_experiment_parameters,
set_ambient_temperature,
)
from tec_reduced_model.process_experimental_... | 8,391 | 25.726115 | 87 | py |
Anjay-zephyr-client | Anjay-zephyr-client-master/tools/validate_fota_file_size.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020-2023 AVSystem <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | 4,301 | 36.736842 | 208 | py |
Anjay-zephyr-client | Anjay-zephyr-client-master/tools/board_adapters/nrf_adapter.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020-2023 AVSystem <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | 2,519 | 39 | 118 | py |
Anjay-zephyr-client | Anjay-zephyr-client-master/tools/board_adapters/zephyr_adapter_common.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020-2023 AVSystem <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | 3,642 | 30.678261 | 88 | py |
Anjay-zephyr-client | Anjay-zephyr-client-master/tools/board_adapters/esp_adapter.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020-2023 AVSystem <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | 3,443 | 36.434783 | 93 | py |
Anjay-zephyr-client | Anjay-zephyr-client-master/tools/board_adapters/st_adapter.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020-2023 AVSystem <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | 2,310 | 34.553846 | 102 | py |
Anjay-zephyr-client | Anjay-zephyr-client-master/tools/provisioning-tool/ptool.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020-2023 AVSystem <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | 10,847 | 37.332155 | 169 | py |
dynprog | dynprog-main/setup.py | import pathlib
import setuptools
NAME = "dynprog"
URL = "https://github.com/erelsgl/" + NAME
HERE = pathlib.Path(__file__).parent
print(f"\nHERE = {HERE.absolute()}\n")
README = (HERE / "README.md").read_text()
REQUIRES = (HERE / "requirements.txt").read_text().strip().split("\n")
REQUIRES = [lin.strip() for lin in RE... | 1,544 | 29.294118 | 84 | py |
dynprog | dynprog-main/dynprog/sequential_func.py | """
Generic dynamic programming in the iterative method.
Uses a function interface.
Programmer: Erel Segal-Halevi.
Since: 2021-11.
"""
from typing import *
from numbers import Number
State = Any
Value = Number
StateValue = Tuple[State,Value]
StateValueData = Tuple[State,Value,Any]
import logging
logger = logging.ge... | 7,529 | 44.914634 | 147 | py |
dynprog | dynprog-main/dynprog/sequential.py | #!python3
"""
A sequential dynamic program - a DP that handles the inputs one by one.
Based on the "Simple DP" defined by Gerhard J. Woeginger (2000) in:
"When Does a Dynamic Programming Formulation Guarantee the Existence of a FPTAS?".
Programmer: Erel Segal-Halevi.
Since: 2021-12
"""
from typing import *
from... | 8,587 | 34.196721 | 169 | py |
dynprog | dynprog-main/dynprog/__init__.py | """
Generic dynamic programming in the iterative method.
Programmer: Erel Segal-Halevi.
Since: 2021-11.
"""
import pathlib, logging
logger = logging.getLogger(__name__)
HERE = pathlib.Path(__file__).parent
__version__ = (HERE / "VERSION").read_text().strip()
| 262 | 19.230769 | 52 | py |
dynprog | dynprog-main/examples/multiple_subset_sum.py | #!python3
"""
Uses the sequential dynamic programming function to solve the multiple-subset-sum problem:
https://en.wikipedia.org/wiki/Multiple_subset_sum
The states are of the form (v1, v2, ..., vn) where n is the number of bins.
The "vi" is the current sum in bin i.
Programmer: Erel Segal-Halevi
Since: 2021-12
"""... | 4,366 | 28.113333 | 118 | py |
dynprog | dynprog-main/examples/subset_sum.py | #!python3
"""
Uses the sequential dynamic programming function to solve the subset-sum problem.
The state contains a single number: the current sum.
Programmer: Erel Segal-Halevi
Since: 2021-12
"""
import dynprog
from dynprog.sequential import SequentialDynamicProgram
from typing import *
def max_value(inputs: L... | 2,628 | 24.038095 | 118 | py |
dynprog | dynprog-main/examples/best_coin_picking_strategy.py | #!python3
"""
Uses the generic dynamic programming function to compute an optimal strategy
in a game of picking coins from a row.
See here: https://www.youtube.com/watch?v=Tw1k46ywN6E, time 54:30
The states are tuples (i,j,b), where i,j are indices and b is boolean.
Each pair (i,j) represents the optimal strategy for... | 2,485 | 29.317073 | 90 | py |
dynprog | dynprog-main/examples/knapsack.py | #!python3
"""
Uses the sequential dynamic programming function to solve the knapsack problem.
Each input contains two integers: the weight and the value.
The state contains two integers: the total weight and the total value.
Programmer: Erel Segal-Halevi
Since: 2021-12
"""
import dynprog
from dynprog.sequential impo... | 3,046 | 26.7 | 118 | py |
dynprog | dynprog-main/examples/longest_palyndrome_subsequence.py | #!python3
"""
Uses the generic dynamic programming function to solve the
Longest Palyndrome Subsequence problem.
See here: https://www.youtube.com/watch?v=Tw1k46ywN6E
The states are pairs (i,j), where i,j are indices.
Each pair (i,j) represents the longest palyndromic subsequence in the substring i, i+1, ..., j-1.
... | 3,693 | 27.635659 | 97 | py |
dynprog | dynprog-main/examples/allocations/max_min_partition.py | #!python3
"""
Uses the sequential dynamic programming function to solve the
max-min number partitioning problem.
The states are of the form (v1, v2, ..., vn) where n is the number of bins.
The "vi" is the current sum in bin i.
Programmer: Erel Segal-Halevi
Since: 2021-12
"""
import dynprog
from dynprog.sequential ... | 2,823 | 25.392523 | 108 | py |
dynprog | dynprog-main/examples/allocations/utilitarian_proportional_allocation.py | #!python3
"""
Uses the sequential dynamic programming function to find a proportional allocation
of items to agents with different valuations, with a largest sum of utilities (utilitarian value).
The input is a valuation-matrix v, where v[i][j] is the value of agent i to item j.
The states are of the form (v1, v2, ... | 4,823 | 36.107692 | 130 | py |
dynprog | dynprog-main/examples/allocations/utilitarian_prop1_allocation.py | #!python3
"""
Uses the sequential dynamic programming function to find a PROP1 or PROPx allocation
of items to agents with different valuations, with a largest sum of utilities (utilitarian value).
The input is a valuation-matrix v, where v[i][j] is the value of agent i to item j.
The states are of the form (v1, v2... | 7,490 | 39.934426 | 135 | py |
dynprog | dynprog-main/examples/allocations/utilitarian_envyfree_allocation.py | #!python3
"""
Uses the sequential dynamic programming function to find an envy-free allocation
of items to agents with different valuations, with a largest sum of utilities (utilitarian value).
The input is a valuation-matrix v, where v[i][j] is the value of agent i to item j.
The states are the bundle-differences: ... | 4,463 | 35 | 140 | py |
dynprog | dynprog-main/examples/allocations/common.py | #!python3
"""
Common routines for dynamic programs finding fair allocations.
"""
def items_as_value_vectors(valuation_matrix):
"""
Convert a valuation matrix (an input to a fair division algorithm) into a list of value-vectors.
Each value-vector v represents an item: v[i] is the value of the item for age... | 2,950 | 34.987805 | 122 | py |
dynprog | dynprog-main/examples/allocations/utilitarian_ef1_allocation.py | #!python3
"""
Uses the sequential dynamic programming function to find an EF1/EFx allocation
of items to agents with different valuations, with a largest sum of utilities (utilitarian value).
The input is a valuation-matrix v, where v[i][j] is the value of agent i to item j.
The states are of the form (d11, d12, ...... | 7,910 | 33.697368 | 112 | py |
dynprog | dynprog-main/examples/allocations/egalitarian_allocation.py | #!python3
"""
Uses the sequential dynamic programming function to find an egalitarian (max-min)
allocation of items to agents with different valuations.
This is a generalization of max_min_partition.py.
The input is a valuation-matrix v, where v[i][j] is the value of agent i to item j.
The states are of the form (... | 4,277 | 31.907692 | 122 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/metrics.py | ###############################################################################
# (C) Quantum Economic Development Consortium (QED-C) 2021.
# Technical Advisory Committee on Standards and Benchmarks (TAC)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | 131,092 | 37.946227 | 260 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/braket/execute.py | # (C) Quantum Economic Development Consortium (QED-C) 2021.
# Technical Advisory Committee on Standards and Benchmarks (TAC)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.... | 9,199 | 31.857143 | 126 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/qiskit/benchmark_runner.py | import importlib
import ast
import argparse
import os
import sys
benchmark_algorithms = [
"amplitude-estimation",
"bernstein-vazirani",
"deutsch-jozsa",
"grovers",
"hamiltonian-simulation",
"hidden-shift",
"maxcut",
"monte-carlo",
"phase-estimation",
"quantum-fourier-transform",... | 9,928 | 44.131818 | 133 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/qiskit/execute.py | # (C) Quantum Economic Development Consortium (QED-C) 2021.
# Technical Advisory Committee on Standards and Benchmarks (TAC)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.... | 53,550 | 39.143178 | 184 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/postprocessors/mthree/mthree_em.py | #################################################################
#
# Post-processor module: mthree error mitigation handlers
import importlib
import mthree
from qiskit import Aer
mit = None
mit_num_qubits = 2
verbose = False
# Handler called to postprocess results before they are passed to calling program
def mth... | 2,448 | 30.805195 | 99 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/custom/custom_qiskit_noise_model.py | #
# Define a custom noise model to be used during execution of Qiskit Aer simulator
#
# Note: this custom definition is the same as the default noise model provided
# The code is provided here for users to copy to their own file and customize
from qiskit.providers.aer.noise import NoiseModel, ReadoutError
from qiskit... | 1,862 | 40.4 | 107 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/cirq/execute.py | # (C) Quantum Economic Development Consortium (QED-C) 2021.
# Technical Advisory Committee on Standards and Benchmarks (TAC)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.... | 6,623 | 32.286432 | 104 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/cirq/cirq_utils.py | import cirq
class to_gate(cirq.Gate):
def __init__(self, num_qubits, circ, name="G"):
self.num_qubits=num_qubits
self.circ = circ
self.name = name
def _num_qubits_(self):
return self.num_qubits
def _decompose_(self, qubits):
# `sorted()` needed to corre... | 808 | 30.115385 | 117 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/ocean/execute.py | # (C) Quantum Economic Development Consortium (QED-C) 2021.
# Technical Advisory Committee on Standards and Benchmarks (TAC)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.... | 14,394 | 36.881579 | 182 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/ocean/HamiltonianCircuitProxy.py | class HamiltonianCircuitProxy(object):
h = None
J = None
sampler = None
embedding = None
def __init__(self):
self.h = None
self.J = None
self.sampler = None
self.embedding = None | 232 | 18.416667 | 38 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/transformers/qiskit_passmgr.py | #
# Qiskit Pass Manger - Examples
#
# Dynamic Decoupling
#
# Some circuits can be sparse or have long idle periods.
# Dynamical decoupling can echo away static ZZ errors during those idling periods.
# Set up a pass manager to add the decoupling pulses to the circuit before executing
from qiskit.transpiler import Pass... | 787 | 34.818182 | 84 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/transformers/tket_optimiser.py | from pytket.extensions.qiskit import qiskit_to_tk, tk_to_qiskit
from pytket.passes import ( # type: ignore
auto_rebase_pass,
RemoveRedundancies,
SequencePass,
SynthesiseTket,
CXMappingPass,
DecomposeBoxes,
FullPeepholeOptimise,
CliffordSimp,
SimplifyInitial,
KAKDecomposition,
... | 3,914 | 30.829268 | 72 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/_common/transformers/trueq_rc.py | '''
Keysight TrueQ - Randomized Compilation
'''
import trueq as tq
import numpy as np
import trueq.compilation as tqc
import qiskit as qs
# The following option applies randomized compilation through the True-Q software. This compilation technique allocates the total shot budget over randomized implementations of the... | 4,437 | 33.944882 | 359 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/maxcut/_common/common.py | import os
import json
INSTANCE_DIR = 'instances'
# Utility functions for processing Max-Cut data files
# If _instances is None, read from data file. If a dict, extract from a named field
# (second form used for Qiskit Runtime and similar systems)
def read_maxcut_instance(file_path, _instances=None):
if isinsta... | 2,847 | 33.313253 | 125 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/maxcut/_common/instances/compute-maxcut-opt-files.py | #!/usr/bin/env python3
import os
from gurobipy import Model, GRB
def read_maxcut_instance(file_path):
with open(file_path, 'r') as file:
nodes = int(file.readline())
edges = []
for line in file.readlines():
parts = line.split()
edges.append((int(parts[0]), int(part... | 1,368 | 25.326923 | 96 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/maxcut/_common/instances/generate-instances.py | #!/usr/bin/env python3
import os
import networkx
INSTANCE_DIR = '.'
SEEDS = 1
N_MIN = 4
N_MAX = 26
R = 3
R_minus = 3
for n in range(N_MIN, N_MAX+1, 2):
for s in range(0,SEEDS):
print('instance config: {} {} {}'.format(n, R, s))
graph = networkx.random_regular_graph(R, n, seed=s)
file_na... | 1,711 | 29.035088 | 74 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/maxcut/qiskit/auxiliary_functions.py | import maxcut_benchmark
import metrics
import os
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
import json
maxcut_benchmark.verbose = False
maxcut_style = os.path.join('..', '..', '_common', 'maxcut.mplstyle')
#%% Functions for analyzing the effects of initial conditions
def plot_eff... | 16,664 | 40.352357 | 150 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/maxcut/qiskit/maxcut_benchmark.py | """
MaxCut Benchmark Program - Qiskit
"""
import datetime
import json
import logging
import math
import os
import re
import sys
import time
from collections import namedtuple
import numpy as np
from scipy.optimize import minimize
from qiskit import (Aer, ClassicalRegister, # for computing expectation tables
... | 59,569 | 42.801471 | 352 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/maxcut/qiskit/runtime_utils.py | # This script is intended to replace sh_script.sh and script.sed
# The objective of this script is the create the maxcut_runtime.py file
import re
import sys
import os
import json
from collections import defaultdict
sys.path[1:1] = [ "_common", "_common/qiskit", "maxcut/_common" ]
sys.path[1:1] = [ "../../_common", "... | 7,226 | 28.618852 | 104 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/maxcut/qiskit/add_main.py | import inspect
from qiskit.providers.ibmq.runtime import UserMessenger
import time
def main(backend, user_messenger=UserMessenger(), **kwargs):
# Stores all default parameters in dictionary
argspec = inspect.getfullargspec(run)
_args = {x: y for (x, y) in zip(argspec.args, argspec.defaults)}
_args["pr... | 1,249 | 31.894737 | 81 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/maxcut/ocean/maxcut_benchmark.py | """
MaxCut Benchmark Program - Ocean
"""
import datetime
import json
import logging
import math
import os
import re
import sys
import time
from collections import namedtuple
import numpy as np
sys.path[1:1] = [ "_common", "_common/ocean", "maxcut/_common" ]
sys.path[1:1] = [ "../../_common", "../../_common/ocean", "... | 50,056 | 43.180936 | 352 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/_common/shors_utils.py | """
This file contains various helper functions for the various Shor's algorithm benchmarks,
including order finding and factoring.
"""
import math
from math import gcd
import numpy as np
############### Data Used in Shor's Algorithm Benchmark
# Array of prime numbers used to construct numbers to be factored
primes = ... | 4,651 | 34.242424 | 108 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/braket/shors_benchmark.py | """
Shor's Order Finding Algorithm Benchmark - Braket (WIP)
"""
import math
import sys
import time
from braket.circuits import Circuit # AWS imports: Import Braket SDK modules
import numpy as np
sys.path[1:1] = ["_common", "_common/braket", "shors/_common", "quantum-fourier-transform/braket"]
sys.path[1:1] = [".... | 16,073 | 33.717063 | 122 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/qiskit/shors_benchmark.py | """
Shor's Order Finding Algorithm Benchmark - Qiskit
"""
import math
import sys
import time
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
sys.path[1:1] = ["_common", "_common/qiskit", "shors/_common", "quantum-fourier-transform/qiskit"]
sys.path[1:1] = ["../../_common", ".... | 16,395 | 36.179138 | 133 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/qiskit/WIP_benchmarks/shors_factoring_benchmark_WIP.py | """
Shor's Factoring Algorithm Benchmark - Qiskit
"""
import sys
sys.path[1:1] = ["_common", "_common/qiskit", "shors/_common", "quantum-fourier-transform/qiskit"]
sys.path[1:1] = ["../../_common", "../../_common/qiskit", "../../shors/_common", "../../quantum-fourier-transform/qiskit"]
from qiskit import QuantumCircu... | 16,795 | 33.138211 | 123 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/qiskit/interactive_shors_factoring/Test_classical_after_quantum.py | """ This file allows to test the calculations done after creating the quantum circuit
It implements the continued fractions to find a possible r and then:
If r found is odd, tries next approximation of the continued fractions method
If r found is even, tries to get the factors of N and then:
If the fact... | 1,326 | 46.392857 | 141 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/qiskit/interactive_shors_factoring/qfunctions.py | """ This file contains quantum code in support of Shor's Algorithm
"""
""" Imports from qiskit"""
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
import sys
import math
import numpy as np
""" ********* QFT Functions *** """
""" Function to create QFT """
def create_QFT(circuit,up_reg,n,with_sw... | 6,248 | 31.378238 | 112 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/qiskit/interactive_shors_factoring/Test_Mult.py | """ This file allows to test the Multiplication blocks Ua. This blocks, when put together as explain in
the report, do the exponentiation.
The user can change N, n, a and the input state, to create the circuit:
up_reg |+> ---------------------|----------------------- |+>
... | 5,125 | 38.736434 | 160 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/qiskit/interactive_shors_factoring/cfunctions.py | """ This file contains classical code in support of Shor's Algorithm
"""
""" Imports to Python functions """
import math
import array
import fractions
import numpy as np
import sys
""" ******** Pre-Quantum *** """
""" Function to check if N is of type q^p"""
def check_if_power(N):
""" Check if N is a perfect p... | 6,652 | 30.680952 | 115 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/qiskit/interactive_shors_factoring/Shor_Normal_QFT.py | """
This is the final implementation of Shor's Algorithm using the circuit presented in section 2.3 of the report about the first
simplification introduced by the base paper used.
As the circuit is completely general, it is a rather long circuit, with a lot of QASM instructions in the generated Assembly code,
which m... | 7,486 | 39.912568 | 166 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/qiskit/interactive_shors_factoring/Test_QFT.py | """ This file allows to test the various QFT implemented. The user must specify:
1) The number of qubits it wants the QFT to be implemented on
2) The kind of QFT want to implement, among the options:
-> Normal QFT with SWAP gates at the end
-> Normal QFT without SWAP gates at the end
-> ... | 4,888 | 38.427419 | 139 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/qiskit/interactive_shors_factoring/Test_classical_before_quantum.py | """ This file allows to test the calculations done before creating the quantum circuit
It asks the user for a number N and then:
Checks if N is 1 or 0 or is an even -> these cases are simple
Checks if N can be put in q^p form, q and p integers -> this can be done quicker classicaly then using the quantum circui... | 1,347 | 31.878049 | 128 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/qiskit/interactive_shors_factoring/Shor_Sequential_QFT.py | """
This is the final implementation of Shor's Algorithm using the circuit presented in section 2.3 of the report about the second
simplification introduced by the base paper used.
The circuit is general, so, in a good computer that can support simulations infinite qubits, it can factorize any number N. The only limita... | 7,141 | 38.458564 | 164 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/shors/cirq/shors_benchmark.py | """
Shor's Order Finding Algorithm Benchmark - Cirq
"""
from collections import defaultdict
import math
import sys
import time
import cirq
import numpy as np
sys.path[1:1] = ["_common", "_common/cirq", "shors/_common", "quantum-fourier-transform/cirq"]
sys.path[1:1] = ["../../_common", "../../_common/cirq", "../../s... | 16,134 | 35.8379 | 153 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/quantum-fourier-transform/braket/qft_benchmark.py | """
Quantum Fourier Transform Benchmark Program - Braket
"""
import sys
import time
from braket.circuits import Circuit # AWS imports: Import Braket SDK modules
import math
import numpy as np
sys.path[1:1] = [ "_common", "_common/braket" ]
sys.path[1:1] = [ "../../_common", "../../_common/braket" ]
import execut... | 11,398 | 31.568571 | 99 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/quantum-fourier-transform/qiskit/qft_benchmark.py | """
Quantum Fourier Transform Benchmark Program - Qiskit
"""
import math
import sys
import time
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
sys.path[1:1] = [ "_common", "_common/qiskit" ]
sys.path[1:1] = [ "../../_common", "../../_common/qiskit" ]
import execute as ex
imp... | 11,249 | 31.991202 | 114 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/quantum-fourier-transform/cirq/qft_benchmark.py | """
Quantum Fourier Transform Benchmark Program - Cirq
"""
from collections import defaultdict
import math
import sys
import time
import cirq
import numpy as np
sys.path[1:1] = [ "_common", "_common/cirq" ]
sys.path[1:1] = [ "../../_common", "../../_common/cirq" ]
import cirq_utils as cirq_utils
import execute as ex... | 11,470 | 32.837758 | 106 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/phase-estimation/braket/pe_benchmark.py | """
Phase Estimation Benchmark Program - Braket
"""
import time
import sys
from braket.circuits import Circuit # AWS imports: Import Braket SDK modules
import numpy as np
sys.path[1:1] = ["_common", "_common/braket", "quantum-fourier-transform/braket"]
sys.path[1:1] = ["../../_common", "../../_common/braket", ".... | 7,572 | 35.941463 | 129 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/phase-estimation/qiskit/pe_benchmark.py | """
Phase Estimation Benchmark Program - Qiskit
"""
import sys
import time
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
sys.path[1:1] = ["_common", "_common/qiskit", "quantum-fourier-transform/qiskit"]
sys.path[1:1] = ["../../_common", "../../_common/qiskit", "../../quantu... | 8,723 | 37.263158 | 129 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/phase-estimation/cirq/pe_benchmark.py | """
Phase Estimation Benchmark Program - Cirq
"""
from collections import defaultdict
import sys
import time
import cirq
import numpy as np
sys.path[1:1] = ["_common", "_common/cirq", "quantum-fourier-transform/cirq"]
sys.path[1:1] = ["../../_common", "../../_common/cirq", "../../quantum-fourier-transform/cirq"]
imp... | 8,006 | 36.947867 | 135 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/bernstein-vazirani/braket/bv_benchmark.py | """
Bernstein-Vazirani Benchmark Program - Braket
"""
import sys
import time
from braket.circuits import Circuit # AWS imports: Import Braket SDK modules
import numpy as np
sys.path[1:1] = [ "_common", "_common/braket" ]
sys.path[1:1] = [ "../../_common", "../../_common/braket" ]
import execute as ex
import met... | 6,356 | 32.81383 | 99 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/bernstein-vazirani/qiskit/bv_benchmark.py | """
Bernstein-Vazirani Benchmark Program - Qiskit
"""
import sys
import time
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
sys.path[1:1] = [ "_common", "_common/qiskit" ]
sys.path[1:1] = [ "../../_common", "../../_common/qiskit" ]
import execute as ex
import metrics as metr... | 7,840 | 33.69469 | 118 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/bernstein-vazirani/cirq/bv_benchmark.py | """
Bernstein-Vazirani Benchmark Program - Cirq
"""
from collections import defaultdict
import sys
import time
import cirq
import numpy as np
sys.path[1:1] = [ "_common", "_common/cirq" ]
sys.path[1:1] = [ "../../_common", "../../_common/cirq" ]
import cirq_utils as cirq_utils
import execute as ex
import metrics as ... | 6,711 | 33.244898 | 130 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/monte-carlo/_common/mc_utils.py | from numpy.polynomial.polynomial import Polynomial
from numpy.polynomial.polynomial import polyfit
from collections.abc import Iterable
import functools
import math
import random
import numpy as np
import copy
########## Classical math functions
def gaussian_dist(num_state_qubits, mu, sigma=0.3):
if mu > 1:
... | 6,152 | 28.581731 | 168 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/monte-carlo/qiskit/mc_benchmark.py | """
Monte Carlo Sampling Benchmark Program via Amplitude Estimation- Qiskit
"""
import copy
import functools
import sys
import time
import numpy as np
from numpy.polynomial.polynomial import Polynomial
from numpy.polynomial.polynomial import polyfit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegiste... | 18,202 | 37.08159 | 156 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/monte-carlo/cirq/mc_benchmark.py | """
Monte Carlo Sampling Benchmark Program via Amplitude Estimation- Cirq
"""
from collections import defaultdict
import copy
import functools
import sys
import time
import cirq
import numpy as np
from numpy.polynomial.polynomial import Polynomial
from numpy.polynomial.polynomial import polyfit
sys.path[1:1] = ["_co... | 16,763 | 37.986047 | 156 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/deutsch-jozsa/braket/dj_benchmark.py | """
Deutsch-Jozsa Benchmark Program - Braket
"""
import sys
import time
from braket.circuits import Circuit # AWS imports: Import Braket SDK modules
import numpy as np
sys.path[1:1] = [ "_common", "_common/braket" ]
sys.path[1:1] = [ "../../_common", "../../_common/braket" ]
import execute as ex
import metrics a... | 6,511 | 30.765854 | 99 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/deutsch-jozsa/qiskit/dj_benchmark.py | """
Deutsch-Jozsa Benchmark Program - Qiskit
"""
import sys
import time
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
sys.path[1:1] = [ "_common", "_common/qiskit" ]
sys.path[1:1] = [ "../../_common", "../../_common/qiskit" ]
import execute as ex
import metrics as metrics
... | 6,790 | 31.649038 | 114 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/deutsch-jozsa/cirq/dj_benchmark.py | """
Deutsch-Jozsa Benchmark Program - Cirq
"""
from collections import defaultdict
import sys
import time
import cirq
import numpy as np
sys.path[1:1] = ["_common", "_common/cirq"]
sys.path[1:1] = ["../../_common", "../../_common/cirq"]
import cirq_utils as cirq_utils
import execute as ex
import metrics as metrics
... | 7,283 | 32.412844 | 130 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/hidden-shift/braket/hs_benchmark.py | """
Hidden Shift Benchmark Program - Braket
"""
import sys
import time
from braket.circuits import Circuit # AWS imports: Import Braket SDK modules
import numpy as np
sys.path[1:1] = [ "_common", "_common/braket" ]
sys.path[1:1] = [ "../../_common", "../../_common/braket" ]
import execute as ex
import metrics as... | 6,641 | 32.21 | 99 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/hidden-shift/qiskit/hs_benchmark.py | """
Hidden Shift Benchmark Program - Qiskit
"""
import sys
import time
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
sys.path[1:1] = [ "_common", "_common/qiskit" ]
sys.path[1:1] = [ "../../_common", "../../_common/qiskit" ]
import execute as ex
import metrics as metrics
n... | 6,927 | 32.468599 | 114 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/hidden-shift/cirq/hs_benchmark.py | """
Hidden-Shift Benchmark Program - Cirq
"""
from collections import defaultdict
import sys
import time
import cirq
import numpy as np
sys.path[1:1] = ["_common", "_common/cirq"]
sys.path[1:1] = ["../../_common", "../../_common/cirq"]
import cirq_utils as cirq_utils
import execute as ex
import metrics as metrics
n... | 7,075 | 33.349515 | 130 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/hhl/qiskit/uniform_controlled_rotation.py |
"""
Uniformly controlled rotation from arXiv:0407010
"""
import numpy as np
from sympy.combinatorics.graycode import GrayCode
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import Aer, execute
def dot_product(str1, str2):
""" dot product between 2 binary string """
... | 3,751 | 23.051282 | 88 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/hhl/qiskit/sparse_Ham_sim.py | # -*- coding: utf-8 -*-
"""
sparse Hamiltonian simulation
"""
from math import pi
import numpy as np
from scipy.linalg import expm
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import Aer, execute
def Ham_sim(H, t):
"""
H : sparse matrix
t : time parameter
... | 6,309 | 21.140351 | 69 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/hhl/qiskit/hhl_benchmark_km.py | """
HHL Benchmark Program - Qiskit (KM initial version 220402)
TODO:
- switch from total variation distance to Hellinger fidelity
"""
import sys
import time
import numpy as np
pi = np.pi
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import Aer, execute
import sparse_Ham_si... | 24,218 | 31.12069 | 142 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/hhl/qiskit/hhl_benchmark.py | """
HHL Benchmark Program - Qiskit
TODO:
- switch from total variation distance to Hellinger fidelity
"""
import sys
import time
import numpy as np
pi = np.pi
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import Aer, execute
import sparse_Ham_sim as shs
import uniform_contro... | 32,496 | 32.433128 | 170 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/grovers/braket/grovers_benchmark.py | """
Grover's Search Benchmark Program - Braket
"""
import sys
import time
from braket.circuits import Circuit # AWS imports: Import Braket SDK modules
import numpy as np
sys.path[1:1] = [ "_common", "_common/braket" ]
sys.path[1:1] = [ "../../_common", "../../_common/braket" ]
import execute as ex
import metrics as... | 9,980 | 30.386792 | 99 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/grovers/qiskit/grovers_benchmark.py | """
Grover's Search Benchmark Program - Qiskit
"""
import sys
import time
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
sys.path[1:1] = ["_common", "_common/qiskit"]
sys.path[1:1] = ["../../_common", "../../_common/qiskit"]
import execute as ex
import metrics as metrics
np... | 9,694 | 30.477273 | 99 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/grovers/cirq/grovers_benchmark.py | """
Grover's Search Benchmark Program - Cirq
"""
from collections import defaultdict
import sys
import time
import cirq
import numpy as np
sys.path[1:1] = ["_common", "_common/cirq"]
sys.path[1:1] = ["../../_common", "../../_common/cirq"]
import cirq_utils as cirq_utils
import execute as ex
import metrics as metrics... | 7,315 | 33.186916 | 105 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/vqe/qiskit/vqe_benchmark.py | """
Variational Quantum Eigensolver Benchmark Program - Qiskit
"""
import json
import os
import sys
import time
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.opflow import PauliTrotterEvolution, Suzuki
from qiskit.opflow.primitive_ops import PauliSumOp
sys.path[1:1] = ["_common", ... | 13,422 | 30.143852 | 104 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/vqe/qiskit/vqe_utils.py | from qiskit_nature.drivers import PySCFDriver, UnitsType, Molecule
from qiskit_nature.circuit.library import HartreeFock as HF
from qiskit_nature.problems.second_quantization.electronic import ElectronicStructureProblem
from qiskit_nature.mappers.second_quantization import JordanWignerMapper
from qiskit_nature.converte... | 2,896 | 35.670886 | 114 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/hamiltonian-simulation/braket/hamiltonian_simulation_benchmark.py | """
Hamiltonian-Simulation Benchmark Program - Braket
"""
import json
import os
import sys
import time
import numpy as np
from braket.circuits import Circuit # AWS imports: Import Braket SDK modules
sys.path[1:1] = [ "_common", "_common/braket" ]
sys.path[1:1] = [ "../../_common", "../../_common/braket" ]
import e... | 9,872 | 34.901818 | 104 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/hamiltonian-simulation/qiskit/hamiltonian_simulation_benchmark.py | """
Hamiltonian-Simulation Benchmark Program - Qiskit
"""
import json
import os
import sys
import time
import numpy as np
from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister
sys.path[1:1] = ["_common", "_common/qiskit"]
sys.path[1:1] = ["../../_common", "../../_common/qiskit"]
import execute as ex... | 10,162 | 32.989967 | 108 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/hamiltonian-simulation/qiskit/WIP_benchmarks/tfim_benchmark.py | """
Hamiltonian-Simulation (Transverse Field Ising Model) Benchmark Program - Qiskit
"""
import sys
sys.path[1:1] = ["_common", "_common/qiskit"]
sys.path[1:1] = ["../../_common", "../../_common/qiskit"]
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
import time
import math
import numpy as np
n... | 7,616 | 34.593458 | 108 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/hamiltonian-simulation/qiskit/WIP_benchmarks/mbl_benchmark.py | """
Many Body Localization Benchmark Program - Qiskit
"""
import sys
sys.path[1:1] = ["_common", "_common/qiskit"]
sys.path[1:1] = ["../../_common", "../../_common/qiskit"]
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
import time
import math
import numpy as np
np.random.seed(0)
import execute... | 10,466 | 32.334395 | 108 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/hamiltonian-simulation/cirq/hamiltonian_simulation_benchmark.py | """
Hamiltonian-Simulation Benchmark Program - Cirq
"""
import json
import os
import sys
import time
from collections import defaultdict
import numpy as np
import cirq
sys.path[1:1] = ["_common", "_common/cirq"]
sys.path[1:1] = ["../../_common", "../../_common/cirq"]
import cirq_utils as cirq_utils
import execute a... | 10,425 | 33.753333 | 104 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/amplitude-estimation/qiskit/ae_benchmark.py | """
Amplitude Estimation Benchmark Program via Phase Estimation - Qiskit
"""
import copy
import sys
import time
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
sys.path[1:1] = ["_common", "_common/qiskit", "quantum-fourier-transform/qiskit"]
sys.path[1:1] = ["../../_common", ... | 11,928 | 36.394984 | 123 | py |
QC-App-Oriented-Benchmarks | QC-App-Oriented-Benchmarks-master/amplitude-estimation/cirq/ae_benchmark.py | """
Amplitude Estimation Benchmark Program via Phase Estimation - Cirq
"""
from collections import defaultdict
import copy
import sys
import time
import cirq
import numpy as np
sys.path[1:1] = ["_common", "_common/cirq", "quantum-fourier-transform/cirq"]
sys.path[1:1] = ["../../_common", "../../_common/cirq", "../..... | 11,316 | 36.97651 | 143 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.