forked from cda-tum/mqt-qudits
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
249 additions
and
1,156 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Empty file.
Empty file.
46 changes: 46 additions & 0 deletions
46
test/python/compiler/onedit/test_log_local_adaptive_decomp.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from unittest import TestCase | ||
|
||
|
||
class TestLogLocAdaPass(TestCase): | ||
def test_transpile(self): | ||
pass | ||
|
||
|
||
class TestLogAdaptiveDecomposition(TestCase): | ||
|
||
def test_execute(self): | ||
pass | ||
# dim = 5 | ||
# test_sample_edges = [(0, 4, {"delta_m": 0, "sensitivity": 1}), | ||
# (0, 3, {"delta_m": 1, "sensitivity": 3}), | ||
# (0, 2, {"delta_m": 1, "sensitivity": 3}), | ||
# (1, 4, {"delta_m": 0, "sensitivity": 1}), | ||
# (1, 3, {"delta_m": 1, "sensitivity": 3}), | ||
# (1, 2, {"delta_m": 1, "sensitivity": 3}) | ||
# ] | ||
# test_sample_nodes = [0, 1, 2, 3, 4] | ||
# test_sample_nodes_map = [3, 2, 4, 1, 0] | ||
# | ||
# graph_1 = level_Graph(test_sample_edges, test_sample_nodes, test_sample_nodes_map, [0]) | ||
# graph_1.phase_storing_setup() | ||
# | ||
# Htest = H(dim) | ||
# | ||
# #----------------- | ||
# QR = QR_decomp( Htest, graph_1, Z_prop = False, not_stand_alone = True ) | ||
# | ||
# decomp_qr, algorithmic_cost_qr, total_cost_qr = QR.execute() | ||
# #---------------- | ||
# | ||
# ADA = Adaptive_decomposition(Htest, graph_1, cost_limit=(1.1 * algorithmic_cost_qr, 1.1 * total_cost_qr), dimension=dim, Z_prop=False) | ||
# | ||
# matrices_decomposed, best_cost, final_graph = ADA.execute() | ||
# ############################################## | ||
# | ||
# | ||
# V = Verifier(matrices_decomposed, Htest, test_sample_nodes, test_sample_nodes_map, graph_1.lpmap, dim) | ||
# self.assertEqual( len(matrices_decomposed), 17) | ||
# self.assertTrue(V.verify()) | ||
|
||
def test_dfs(self): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from unittest import TestCase | ||
|
||
from mqt.qudits.compiler.compilation_minitools import UnitaryVerifier | ||
from mqt.qudits.compiler.onedit.mapping_un_aware_transpilation.log_local_qr_decomp import QrDecomp | ||
from mqt.qudits.core import LevelGraph | ||
from mqt.qudits.quantum_circuit import QuantumCircuit | ||
|
||
|
||
class TestLogLocQRPass(TestCase): | ||
def test_transpile(self): | ||
pass | ||
|
||
|
||
class TestQrDecomp(TestCase): | ||
def test_execute(self): | ||
# DIM 3 | ||
dim = 3 | ||
test_sample_edges = [(0, 2, {"delta_m": 0, "sensitivity": 1}), | ||
(1, 2, {"delta_m": 0, "sensitivity": 1}), | ||
] | ||
test_sample_nodes = [0, 1, 2] | ||
test_sample_nodes_map = [0, 1, 2] | ||
|
||
circuit_3 = QuantumCircuit(1, [3], 0) | ||
graph_1 = LevelGraph(test_sample_edges, test_sample_nodes, test_sample_nodes_map, [0], 0, circuit_3) | ||
|
||
Htest = circuit_3.h(0) | ||
|
||
QR = QrDecomp(Htest, graph_1, Z_prop=False, not_stand_alone=False) | ||
# gate, graph_orig, Z_prop=False, not_stand_alone=True | ||
|
||
decomp, algorithmic_cost, total_cost = QR.execute() | ||
|
||
V = UnitaryVerifier(decomp, Htest.to_matrix(identities=0), [dim], | ||
test_sample_nodes, test_sample_nodes_map, graph_1.log_phy_map) | ||
# sequence, target, dimensions, nodes=None, initial_map=None, final_map=None | ||
self.assertEqual(len(decomp), 5) | ||
self.assertTrue(V.verify()) | ||
|
||
self.assertEqual((decomp[0].lev_a, decomp[0].lev_b), (1, 2)) | ||
self.assertEqual((decomp[1].lev_a, decomp[1].lev_b), (0, 1)) | ||
self.assertEqual((decomp[2].lev_a, decomp[2].lev_b), (1, 2)) | ||
self.assertEqual(decomp[3].lev_a, 1) | ||
self.assertEqual(decomp[4].lev_a, 2) |
Oops, something went wrong.