Skip to content

Commit

Permalink
Clean ALL THE THINGS!
Browse files Browse the repository at this point in the history
  • Loading branch information
WrathfulSpatula committed Dec 18, 2024
1 parent 931b771 commit a608ab8
Show file tree
Hide file tree
Showing 58 changed files with 126 additions and 281 deletions.
2 changes: 1 addition & 1 deletion clifford_rz_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def main():

# Run the benchmarks
results = []
for i in range(samples):
for _ in range(samples):
results.append(bench_qrack(qubits, magic))

r_magic = sum(r[0] for r in results) / samples
Expand Down
2 changes: 1 addition & 1 deletion clifford_rz_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def main():
width_results = []

# Run the benchmarks
for i in range(samples):
for _ in range(samples):
width_results.append(bench_qrack(n))

inner_product_result = sum(r for r in width_results) / samples
Expand Down
2 changes: 0 additions & 2 deletions entanglement-breaking.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

def calc_xeb(ideal_probs, split_probs):
n_pow = len(ideal_probs)
n = int(round(math.log2(n_pow)))
threshold = statistics.median(ideal_probs)
u_u = statistics.mean(ideal_probs)
numer = 0
denom = 0
Expand Down
7 changes: 1 addition & 6 deletions ghz_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ def bench_qrack(n):

sim = QrackSimulator(n, isTensorNetwork=False, isSchmidtDecompose=False, isStabilizerHybrid=True)

lcv_range = range(n)
all_bits = list(lcv_range)

single_count = 0
double_count = 0
sim.h(0)
for q in range(n - 1):
sim.mcx([q], q + 1)
Expand All @@ -43,7 +38,7 @@ def main():
width_results = []

# Run the benchmarks
for i in range(samples):
for _ in range(samples):
width_results.append(bench_qrack(n))

time_result = sum(r[0] for r in width_results) / samples
Expand Down
5 changes: 0 additions & 5 deletions ghz_qbdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ def bench_qrack(n):

sim = QrackSimulator(n, isSchmidtDecompose=False, isBinaryDecisionTree=True)

lcv_range = range(n)
all_bits = list(lcv_range)

single_count = 0
double_count = 0
sim.h(0)
for q in range(n - 1):
sim.mcx([q], q + 1)
Expand Down
1 change: 0 additions & 1 deletion marp_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def bench_qrack(width, depth, sdrp_samples):
start = time.perf_counter()

lcv_range = range(width)
all_bits = list(lcv_range)

# Nearest-neighbor couplers:
gateSequence = [ 0, 3, 2, 1, 2, 1, 0, 3 ]
Expand Down
5 changes: 0 additions & 5 deletions marp_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ def bench_qrack(width, depth, sdrp_samples):

two_bit_gates = swap, pswap, mswap, nswap, iswap, iiswap, cx, cy, cz, acx, acy, acz

col_len = math.floor(math.sqrt(width))
while (((width // col_len) * col_len) != width):
col_len -= 1
row_len = width // col_len

sdrp_segments = sdrp_samples - 1
for i in range(0, sdrp_samples):
start = time.perf_counter()
Expand Down
1 change: 0 additions & 1 deletion mirror_nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def bench_qrack(n):
circ = QrackCircuit()

lcv_range = range(n)
all_bits = list(lcv_range)
x_op = [0, 1, 1, 0]
gateSequence = [ 0, 3, 2, 1, 2, 1, 0, 3 ]
row_len = math.ceil(math.sqrt(n))
Expand Down
6 changes: 2 additions & 4 deletions mirror_qv.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@ def bench_qrack(n):
lcv_range = range(n)
all_bits = list(lcv_range)
x_op = [0, 1, 1, 0]
gateSequence = [ 0, 3, 2, 1, 2, 1, 0, 3 ]
row_len = math.ceil(math.sqrt(n))

for _ in lcv_range:
# Single-qubit gates
for i in lcv_range:
th = random.uniform(0, 2 * math.pi)
ph = random.uniform(0, 2 * math.pi)
lm = random.uniform(0, 2 * math.pi)
cos0 = math.cos(th / 2);
sin0 = math.sin(th / 2);
cos0 = math.cos(th / 2)
sin0 = math.sin(th / 2)
u_op = [
cos0 + 0j, sin0 * (-math.cos(lm) + -math.sin(lm) * 1j),
sin0 * (math.cos(ph) + math.sin(ph) * 1j), cos0 * (math.cos(ph + lm) + math.sin(ph + lm) * 1j)
Expand Down
2 changes: 1 addition & 1 deletion nearest_clifford_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def main():
width_results = []

# Run the benchmarks
for i in range(samples):
for _ in range(samples):
width_results.append(bench_qrack(n))
print(width_results[-1][1])

Expand Down
1 change: 0 additions & 1 deletion qbdd/qbdd_fc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Demonstrates the use of "Quantum Binary Decision Diagram (QBDD) rounding parameter" ("QBDDRP")

import math
import os
import random
import sys
import time
Expand Down
3 changes: 0 additions & 3 deletions qbdd/qbdd_fc_fidelity.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Demonstrates the use of "Quantum Binary Decision Diagram (QBDD) rounding parameter" ("QBDDRP")

import math
import os
import random
import sys
import time

import numpy as np

Expand All @@ -22,7 +20,6 @@ def bench_qrack(width, depth):
gate_count = 0

for d in range(depth):
start = time.perf_counter()
# Single-qubit gates
for i in lcv_range:
th = random.uniform(0, 2 * math.pi)
Expand Down
3 changes: 0 additions & 3 deletions qbdd/qbdd_fc_fidelity_qiskit.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Demonstrates the use of "Quantum Binary Decision Diagram (QBDD) rounding parameter" ("QBDDRP")

import math
import os
import random
import sys
import time

import numpy as np

Expand Down Expand Up @@ -39,7 +37,6 @@ def bench_qrack(width, depth):

for d in range(depth):
experiment.reset_all()
start = time.perf_counter()
# Single-qubit gates
for i in lcv_range:
rand_u3(circ, i)
Expand Down
3 changes: 1 addition & 2 deletions qbdd/qbdd_fc_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import math
import multiprocessing
import os
import random
import sys
import time
Expand Down Expand Up @@ -56,7 +55,7 @@ def main():

# Run the benchmarks
pool = multiprocessing.Pool(processes = multiprocessing.cpu_count())
result = pool.map(bench_qrack, [(width, depth)] * shots)
pool.map(bench_qrack, [(width, depth)] * shots)
pool.close()

return 0
Expand Down
1 change: 0 additions & 1 deletion qbdd/qbdd_nc_fc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Demonstrates the use of "Quantum Binary Decision Diagram (QBDD) rounding parameter" ("QBDDRP")

import math
import os
import random
import sys
import time
Expand Down
3 changes: 0 additions & 3 deletions qbdd/qbdd_nc_fc_fidelity.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Demonstrates the use of "Quantum Binary Decision Diagram (QBDD) rounding parameter" ("QBDDRP")

import math
import os
import random
import sys
import time

import numpy as np

Expand All @@ -24,7 +22,6 @@ def bench_qrack(width, depth):
gate_count = 0

for d in range(depth):
start = time.perf_counter()
# Single-qubit gates
for i in lcv_range:
th = random.uniform(0, 2 * math.pi)
Expand Down
5 changes: 1 addition & 4 deletions qbdd/qbdd_nc_fc_fidelity_qiskit.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# Demonstrates the use of "Quantum Binary Decision Diagram (QBDD) rounding parameter" ("QBDDRP")

import math
import os
import random
import sys
import time

import numpy as np

from pyqrack import QrackSimulator, Pauli
from pyqrack import QrackSimulator

from qiskit import QuantumCircuit
from qiskit.compiler import transpile
from qiskit_aer.backends import AerSimulator


Expand Down
3 changes: 1 addition & 2 deletions qbdd/qbdd_nc_fc_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import math
import multiprocessing
import os
import random
import sys
import time
Expand Down Expand Up @@ -62,7 +61,7 @@ def main():

# Run the benchmarks
pool = multiprocessing.Pool(processes = multiprocessing.cpu_count())
result = pool.map(bench_qrack, [(width, depth)] * shots)
pool.map(bench_qrack, [(width, depth)] * shots)
pool.close()

return 0
Expand Down
2 changes: 0 additions & 2 deletions qbdd/qbdd_nc_nn_odd_orbifold.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Demonstrates the use of "Quantum Binary Decision Diagram" (QBDD) and QBDD rounding parameter (QBDDRP) with near-Clifford (nearest-neighbor)

import math
import os
import random
import sys
import time
Expand Down Expand Up @@ -80,7 +79,6 @@ def bench_qrack(width, depth):
# sim.set_reactive_separate(True)

lcv_range = range(width)
all_bits = list(lcv_range)

# Nearest-neighbor couplers:
gateSequence = [ 0, 3, 2, 1, 2, 1, 0, 3 ]
Expand Down
4 changes: 0 additions & 4 deletions qbdd/qbdd_nc_nn_odd_orbifold_fidelity.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Validates the use of "Quantum Binary Decision Diagram" (QBDD) with light-cone (nearest-neighbor, orbifolded)

import math
import os
import random
import sys
import time

import numpy as np

Expand Down Expand Up @@ -92,7 +90,6 @@ def bench_qrack(width, depth):
control = QrackSimulator(width)

lcv_range = range(width)
all_bits = list(lcv_range)

# Nearest-neighbor couplers:
gateSequence = [ 0, 3, 2, 1, 2, 1, 0, 3 ]
Expand All @@ -112,7 +109,6 @@ def bench_qrack(width, depth):
gate_count = 0

for d in range(depth):
start = time.perf_counter()
# Single-qubit gates
for i in lcv_range:
for _ in range(3):
Expand Down
6 changes: 1 addition & 5 deletions qbdd/qbdd_nc_nn_odd_orbifold_fidelity_qiskit.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Validates the use of "Quantum Binary Decision Diagram" (QBDD) with light-cone (nearest-neighbor, orbifolded)

import math
import os
import random
import sys
import time

import numpy as np

from pyqrack import QrackSimulator, Pauli
from pyqrack import QrackSimulator

from qiskit import QuantumCircuit
from qiskit.compiler import transpile
Expand Down Expand Up @@ -105,7 +103,6 @@ def bench_qrack(width, depth):
control = AerSimulator(method="statevector")

lcv_range = range(width)
all_bits = list(lcv_range)

# Nearest-neighbor couplers:
gateSequence = [ 0, 3, 2, 1, 2, 1, 0, 3 ]
Expand All @@ -126,7 +123,6 @@ def bench_qrack(width, depth):

for d in range(depth):
experiment.reset_all()
start = time.perf_counter()
# Single-qubit gates
for i in lcv_range:
rand_u3(circ, i)
Expand Down
4 changes: 1 addition & 3 deletions qbdd/qbdd_nc_nn_odd_orbifold_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import math
import multiprocessing
import os
import random
import sys
import time
Expand Down Expand Up @@ -83,7 +82,6 @@ def bench_qrack(width_depth):
# sim.set_reactive_separate(True)

lcv_range = range(width)
all_bits = list(lcv_range)

# Nearest-neighbor couplers:
gateSequence = [ 0, 3, 2, 1, 2, 1, 0, 3 ]
Expand Down Expand Up @@ -156,7 +154,7 @@ def main():

# Run the benchmarks
pool = multiprocessing.Pool(processes = multiprocessing.cpu_count())
result = pool.map(bench_qrack, [(width, depth)] * shots)
pool.map(bench_qrack, [(width, depth)] * shots)
pool.close()

return 0
Expand Down
2 changes: 0 additions & 2 deletions qbdd/qbdd_nn.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Demonstrates the use of "Quantum Binary Decision Diagram" (QBDD) and QBDD rounding parameter ("QBDDRP") with light-cone (nearest neighbor)

import math
import os
import random
import sys
import time
Expand Down Expand Up @@ -68,7 +67,6 @@ def bench_qrack(width, depth):
sim = QrackSimulator(width, isBinaryDecisionTree=True)

lcv_range = range(width)
all_bits = list(lcv_range)

# Nearest-neighbor couplers:
gateSequence = [ 0, 3, 2, 1, 2, 1, 0, 3 ]
Expand Down
4 changes: 0 additions & 4 deletions qbdd/qbdd_nn_fidelity.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Validates the use of "Quantum Binary Decision Diagram" (QBDD) and QBDD rounding parameter ("QBDDRP") with light-cone (nearest-neighbor)

import math
import os
import random
import sys
import time

import numpy as np

Expand Down Expand Up @@ -82,7 +80,6 @@ def bench_qrack(width, depth):
control = QrackSimulator(width)

lcv_range = range(width)
all_bits = list(lcv_range)

# Nearest-neighbor couplers:
gateSequence = [ 0, 3, 2, 1, 2, 1, 0, 3 ]
Expand All @@ -99,7 +96,6 @@ def bench_qrack(width, depth):
gate_count = 0

for d in range(depth):
start = time.perf_counter()
# Single-qubit gates
for i in lcv_range:
th = random.uniform(0, 2 * math.pi)
Expand Down
Loading

0 comments on commit a608ab8

Please sign in to comment.