From 481d039a1a6436499fd7f82917e689bd059ae2d4 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Wed, 1 Nov 2023 16:51:19 +0100 Subject: [PATCH 01/51] :sparkles: added function to shift the lines of a matrix --- include/dd/Package.hpp | 44 ++++++++++++++++++++ test/dd/test_package.cpp | 86 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 3fdb485af..2878934ce 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2814,6 +2814,50 @@ template class Package { return newedge; } + +public: + mEdge shiftAllColumnsRecursive(mEdge& e, std::int64_t m, + std::int64_t offset) { + + if (e.isTerminal()) { + return e; + } + if (m == 0 && offset == 0) { + return e; + } + // the matrix of the current DD has dimensions 2^h x 2^h + const auto h = e.p->v + 1; + const auto mDecremented = (m > 0 ? m - 1 : 0); + std::array edges{}; + if (offset == 1 << (h - 1)) { + // shift the first half of the matrix + edges[0] = mEdge::zero(); + edges[1] = shiftAllColumnsRecursive(e.p->e[0], mDecremented, 0); + // shift the second half of the matrix + edges[2] = mEdge::zero(); + edges[3] = shiftAllColumnsRecursive(e.p->e[2], mDecremented, + m > 0 ? 1 << (m - 1) : 0); + } else { + edges[0] = shiftAllColumnsRecursive(e.p->e[0], mDecremented, offset); + edges[1] = shiftAllColumnsRecursive(e.p->e[1], mDecremented, offset); + if (m == h) { + // shift the second half of the matrix + edges[2] = mEdge::zero(); + edges[3] = shiftAllColumnsRecursive(e.p->e[2], mDecremented, offset); + } else { + edges[2] = shiftAllColumnsRecursive( + e.p->e[2], mDecremented, (m > 0 ? 1 << (m - 1) : 0) + offset); + edges[3] = shiftAllColumnsRecursive( + e.p->e[3], mDecremented, (m > 0 ? 1 << (m - 1) : 0) + offset); + } + } + auto f = makeDDNode(e.p->v, edges); + f.w = e.w; + return f; + } + mEdge shiftAllColumns(mEdge& e, std::int64_t m) { + return shiftAllColumnsRecursive(e, m, 0); + } }; } // namespace dd diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 98bf822c9..5961a8d8a 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -1942,3 +1942,89 @@ TEST(DDPackageTest, DDStatistics) { ASSERT_TRUE(uniqueTableStats["total"].contains("num_buckets")); EXPECT_GT(uniqueTableStats["total"]["num_buckets"], 0); } + +TEST(DDPackageTest, DDMShiftAllColumns) { + const auto nqubits = 2U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 0, 0, 0}, {-1, 0, 0, 0}, {-1, 0, 0, 0}, {1, 0, 0, 0}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + // dd->incRef(inputDD); + const auto outputMatrix = dd->shiftAllColumns(inputDD, 1); + const auto expectedMatrix = + dd::CMat{{1, 0, 0, 0}, {-1, 0, 0, 0}, {0, -1, 0, 0}, {0, 1, 0, 0}}; + EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); + + const auto outputMatrix2 = dd->shiftAllColumns(inputDD, 2); + const auto expectedMatrix2 = + dd::CMat{{1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, -1, 0}, {0, 0, 0, 1}}; + EXPECT_EQ(outputMatrix2.getMatrix(), expectedMatrix2); +} + +TEST(DDPackageTest, DDMShiftAllColumns2) { + const auto nqubits = 2U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, + {-1, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, + {-1, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + // dd->incRef(inputDD); + const auto outputMatrix = dd->shiftAllColumns(inputDD, 2); + const auto expectedMatrix = + dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, + {0, -1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, -1, 0, 0, 0, 0, 0}, + {0, 0, 0, -1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0}}; + EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); + + const auto outputMatrix4 = dd->shiftAllColumns(inputDD, 1); + const auto expectedMatrix4 = + dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, + {-1, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, + {0, -1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}}; + EXPECT_EQ(outputMatrix4.getMatrix(), expectedMatrix4); + + const auto outputMatrix2 = dd->shiftAllColumns(inputDD, 3); + const auto expectedMatrix2 = + dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, + {0, 0, -1, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, -1, 0, 0}, + {0, 0, 0, 0, 0, 0, -1, 0}, {0, 0, 0, 0, 0, 0, 0, 1}}; + EXPECT_EQ(outputMatrix2.getMatrix(), expectedMatrix2); + + const auto inputMatrix2 = + dd::CMat{{1, 0, 0, 0, 1, 0, 0, 0}, {-1, 0, 0, 0, 1, 0, 0, 0}, + {-1, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 0}, {-1, 0, 0, 0, 1, 0, 0, 0}, + {-1, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 0, 0}}; + auto inputDD2 = dd->makeDDFromMatrix(inputMatrix2); + const auto outputMatrix3 = dd->shiftAllColumns(inputDD2, 1); + const auto expectedMatrix3 = + dd::CMat{{1, 0, 0, 0, 1, 0, 0, 0}, {-1, 0, 0, 0, 1, 0, 0, 0}, + {-1, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 0, 0}, + {0, 1, 0, 0, 0, 1, 0, 0}, {0, -1, 0, 0, 0, 1, 0, 0}, + {0, -1, 0, 0, 0, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0, 0}}; + EXPECT_EQ(outputMatrix3.getMatrix(), expectedMatrix3); +} + +TEST(DDPackageTest, DDMTestToMatrixAndBack) { + const auto nqubits = 2U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + const auto expectedMatrix = + dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; + EXPECT_EQ(inputDD.getMatrix(), expectedMatrix); + + std::array edges{}; + edges[0] = inputDD.p->e[0]; + edges[1] = inputDD.p->e[1]; + edges[2] = inputDD.p->e[2]; + edges[3] = inputDD.p->e[3]; + auto f = dd->makeDDNode(inputDD.p->v, edges); + EXPECT_EQ(f.getMatrix(), expectedMatrix); +} From 8ca46a64130909dc22673a4a867e1aad356485e3 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Wed, 1 Nov 2023 16:56:33 +0100 Subject: [PATCH 02/51] extern changes --- extern/boost/config | 2 +- extern/googletest | 2 +- extern/json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extern/boost/config b/extern/boost/config index a98574fc1..29c39d458 160000 --- a/extern/boost/config +++ b/extern/boost/config @@ -1 +1 @@ -Subproject commit a98574fc12c2486e5b03b208936ad0f0da1bdc34 +Subproject commit 29c39d45858d40bee86bd3b58ca14499663f08b5 diff --git a/extern/googletest b/extern/googletest index b10fad38c..e47544ad3 160000 --- a/extern/googletest +++ b/extern/googletest @@ -1 +1 @@ -Subproject commit b10fad38c4026a29ea6561ab15fc4818170d1c10 +Subproject commit e47544ad31cb3ceecd04cc13e8fe556f8df9fe0b diff --git a/extern/json b/extern/json index 59da644db..fac07e22c 160000 --- a/extern/json +++ b/extern/json @@ -1 +1 @@ -Subproject commit 59da644db4e531aeff90560137f971c52fc2fd71 +Subproject commit fac07e22c5d7dd0423ccf31c02db5603d27e6556 From f233da2a4db93b7b1155ed5969467f6c10d1e57c Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Thu, 9 Nov 2023 12:47:21 +0100 Subject: [PATCH 03/51] :construction: First draft of partial equivalence check function, it still contains bugs --- include/dd/Package.hpp | 115 ++++++++++++++++++++- test/dd/test_package.cpp | 215 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 328 insertions(+), 2 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 2878934ce..51936c11c 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -8,6 +8,7 @@ #include "dd/DensityNoiseTable.hpp" #include "dd/Edge.hpp" #include "dd/GateMatrixDefinitions.hpp" +#include "dd/Node.hpp" #include "dd/Package_fwd.hpp" #include "dd/StochasticNoiseOperationTable.hpp" #include "dd/UnaryComputeTable.hpp" @@ -2815,7 +2816,6 @@ template class Package { return newedge; } -public: mEdge shiftAllColumnsRecursive(mEdge& e, std::int64_t m, std::int64_t offset) { @@ -2855,9 +2855,122 @@ template class Package { f.w = e.w; return f; } + +public: mEdge shiftAllColumns(mEdge& e, std::int64_t m) { return shiftAllColumnsRecursive(e, m, 0); } + + mEdge setColumnsToZero(mEdge& e, Qubit k) { + if (e.isTerminal()) { + return e; + } + if (k == 0) { + return e; + } + // the matrix of the current DD has dimensions 2^h x 2^h + const auto h = e.p->v + 1; + std::array edges{}; + edges[0] = setColumnsToZero(e.p->e[0], k); + edges[2] = setColumnsToZero(e.p->e[2], k); + if (k < h) { + edges[1] = setColumnsToZero(e.p->e[1], k); + edges[3] = setColumnsToZero(e.p->e[3], k); + } else { + edges[1] = mEdge::zero(); + edges[3] = mEdge::zero(); + } + auto f = makeDDNode(e.p->v, edges); + f.w = e.w; + return f; + } + + mEdge setRowsToZero(mEdge& e, Qubit k) { + if (e.isTerminal()) { + return e; + } + if (k == 0) { + return e; + } + // the matrix of the current DD has dimensions 2^h x 2^h + const auto h = e.p->v + 1; + std::array edges{}; + edges[0] = setRowsToZero(e.p->e[0], k); + edges[1] = setRowsToZero(e.p->e[1], k); + if (k < h) { + edges[2] = setRowsToZero(e.p->e[2], k); + edges[3] = setRowsToZero(e.p->e[3], k); + } else { + edges[2] = mEdge::zero(); + edges[3] = mEdge::zero(); + } + auto f = makeDDNode(e.p->v, edges); + f.w = e.w; + return f; + } + + mEdge partialEquivalenceCheckSubroutine(mEdge& u, Qubit m, Qubit k, + Qubit extra) { + // u.printMatrix(); + // std::cout << "\n"; + auto u1{u}; + if (extra > 0) { + // u1.printMatrix(); + // std::cout << "\n"; + auto idExtra = makeIdent(extra); + // idExtra.printMatrix(); + // std::cout << "\n"; + u1 = kronecker(u, idExtra); + // u1.printMatrix(); + // std::cout << "\n"; + } + // u1.printMatrix(); + // std::cout << "\n"; + auto u2 = setColumnsToZero(u1, k); + // u2.printMatrix(); + // std::cout << "\n"; + auto u3 = shiftAllColumns(u2, m); + // u3.printMatrix(); + // std::cout << "\n"; + auto u4 = multiply(conjugateTranspose(u1), u3); + // u4.printMatrix(); + // std::cout << "\n"; + auto u5 = setRowsToZero(u4, k); + // u5.printMatrix(); + // std::cout << "\n"; + return u5; + } + + bool partialEquivalenceCheck(mEdge& u1, mEdge& u2, Qubit d, Qubit m) { + if (u1.isTerminal() && u2.isTerminal()) { + return u1 == u2; + } + + if (u1.isTerminal() || u2.isTerminal() || u1.p->v != u2.p->v) { + throw std::invalid_argument( + "The two circuits need to have the same amount of qubits. u1 has " + + std::to_string(u1.p->v) + " qubits, and u2 has " + + std::to_string(u2.p->v) + " qubits:"); + } + const Qubit h = u1.p->v + 1; + Qubit k = h - d; + Qubit extra{0}; + if (m > k) { + extra = m - k; + } + k = k + extra; + auto u1Prime = partialEquivalenceCheckSubroutine(u1, m, k, extra); + // std::cout << "u1'\n"; + // u1Prime.printMatrix(); + // std::cout << "\n"; + // std::cout << "u2'\n"; + auto u2Prime = partialEquivalenceCheckSubroutine(u2, m, k, extra); + // u2Prime.printMatrix(); + // std::cout << "\n"; + bool result = u1Prime == u2Prime; + + return result; + } }; } // namespace dd diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 5961a8d8a..62ad87f60 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -1954,7 +1954,7 @@ TEST(DDPackageTest, DDMShiftAllColumns) { const auto expectedMatrix = dd::CMat{{1, 0, 0, 0}, {-1, 0, 0, 0}, {0, -1, 0, 0}, {0, 1, 0, 0}}; EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); - + // dd->incRef(inputDD); const auto outputMatrix2 = dd->shiftAllColumns(inputDD, 2); const auto expectedMatrix2 = dd::CMat{{1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, -1, 0}, {0, 0, 0, 1}}; @@ -2010,6 +2010,28 @@ TEST(DDPackageTest, DDMShiftAllColumns2) { EXPECT_EQ(outputMatrix3.getMatrix(), expectedMatrix3); } +TEST(DDPackageTest, DDMShiftAllColumns3) { + const auto nqubits = 5U; + auto dd = std::make_unique>(nqubits); + std::uint64_t n = 1 << nqubits; + std::vector> row10(n, 0); + std::vector> row01(n, 1); + for (std::uint64_t i = 0; i < n; i += 2) { + row10[i] = 1; + row01[i] = 0; + } + dd::CMat inputMatrix(n, row10); + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + // dd->incRef(inputDD); + const auto outputMatrix = dd->shiftAllColumns(inputDD, 1); + dd::CMat expectedMatrix(n / 2, row10); + dd::CMat expectedMatrixPart2(n / 2, row01); + expectedMatrix.insert(expectedMatrix.end(), expectedMatrixPart2.begin(), + expectedMatrixPart2.end()); + EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); + // TODO +} + TEST(DDPackageTest, DDMTestToMatrixAndBack) { const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); @@ -2028,3 +2050,194 @@ TEST(DDPackageTest, DDMTestToMatrixAndBack) { auto f = dd->makeDDNode(inputDD.p->v, edges); EXPECT_EQ(f.getMatrix(), expectedMatrix); } + +TEST(DDPackageTest, DDMSetColumnsToZero) { + const auto nqubits = 2U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + // dd->incRef(inputDD); + const auto outputMatrix = dd->setColumnsToZero(inputDD, 1); + const auto expectedMatrix = + dd::CMat{{1, 0, 1, 0}, {1, 0, 1, 0}, {1, 0, -1, 0}, {1, 0, -1, 0}}; + EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); +} + +TEST(DDPackageTest, DDMSetColumnsToZeroWithReduceAncillae) { // passed but wrong + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + dd->incRef(inputDD); + const auto outputMatrix = dd->reduceAncillae(inputDD, {true, false}); + const auto expectedMatrix = + dd::CMat{{1, 0, 1, 0}, {1, 0, 1, 0}, {1, 0, 1, 0}, {1, 0, 1, 0}}; + EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); +} + +TEST(DDPackageTest, DDMSetRowsToZero) { + const auto nqubits = 2U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + // dd->incRef(inputDD); + const auto outputMatrix = dd->setRowsToZero(inputDD, 1); + const auto expectedMatrix = + dd::CMat{{1, 1, 1, 1}, {0, 0, 0, 0}, {1, 1, -1, -1}, {0, 0, 0, 0}}; + EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); +} + +TEST(DDPackageTest, DDMPartialEquivalenceChecking) { + const auto nqubits = 2U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + // dd->incRef(inputDD); + bool result1 = dd->partialEquivalenceCheck(inputDD, inputDD, 1, 1); + EXPECT_TRUE(result1); + // dd->incRef(inputDD); + bool result2 = dd->partialEquivalenceCheck(inputDD, inputDD, 2, 1); + EXPECT_TRUE(result2); + // dd->incRef(inputDD); + bool result3 = dd->partialEquivalenceCheck(inputDD, inputDD, 1, 2); + EXPECT_TRUE(result3); + // dd->incRef(inputDD); + bool result4 = dd->partialEquivalenceCheck(inputDD, inputDD, 2, 2); + EXPECT_TRUE(result4); + + auto hGate = dd->makeGateDD(dd::H_MAT, 2, 1); + auto cxGate = dd->makeGateDD(dd::X_MAT, 2, 1_pc, 0); + auto bellMatrix = dd->multiply(cxGate, hGate); + bool result5 = dd->partialEquivalenceCheck(inputDD, bellMatrix, 1, 1); + EXPECT_FALSE(result5); +} + +TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 0, 2); + auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 2); + auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 0); + auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 2); + + auto c1 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); + auto c2 = dd->multiply(controlledHGate, xGate); + + c1.printMatrix(); + std::cout << "\n"; + c2.printMatrix(); + std::cout << "\n"; + bool result = dd->partialEquivalenceCheck(c1, c2, 3, 1); + // dd::SQRT2_2 + + EXPECT_TRUE(result); +} + +TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperWith4thQubit) { + const auto nqubits = 4U; + auto dd = std::make_unique>(nqubits); + auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{2}, 1, 3); + auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 3); + auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 1); + auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 2); + auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{2}, 3); + + auto c1 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); + auto c2 = dd->multiply(controlledHGate, xGate); + + // c1.printMatrix(); + // std::cout << "\n"; + // c2.printMatrix(); + // std::cout << "\n"; + bool result = dd->partialEquivalenceCheck(c1, c2, 3, 1); + + EXPECT_TRUE(result); +} + +TEST(DDPackageTest, DDMKroeneckerProduct) { // passed + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = dd::CMat{{1, dd::SQRT2_2}, {dd::SQRT2_2, 1}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + auto identity = dd->makeIdent(1); + auto outputDD = dd->kronecker(inputDD, identity); + const auto expectedMatrix = dd::CMat{{1, 0, dd::SQRT2_2, 0}, + {0, 1, 0, dd::SQRT2_2}, + {dd::SQRT2_2, 0, 1, 0}, + {0, dd::SQRT2_2, 0, 1}}; + EXPECT_EQ(outputDD.getMatrix(), expectedMatrix); +} + +TEST(DDPackageTest, DDMKroeneckerProduct2) { // passed + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{-dd::SQRT2_2, dd::SQRT2_2}, {dd::SQRT2_2, -dd::SQRT2_2}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + auto identity = dd->makeIdent(1); + auto outputDD = dd->kronecker(inputDD, identity); + const auto expectedMatrix = dd::CMat{{-dd::SQRT2_2, 0, dd::SQRT2_2, 0}, + {0, -dd::SQRT2_2, 0, dd::SQRT2_2}, + {dd::SQRT2_2, 0, -dd::SQRT2_2, 0}, + {0, dd::SQRT2_2, 0, -dd::SQRT2_2}}; + EXPECT_EQ(outputDD.getMatrix(), expectedMatrix); +} + +TEST(DDPackageTest, DDMKroeneckerProduct3) { // passed + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = dd::CMat{{dd::SQRT2_2, 0}, {0, dd::SQRT2_2}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + auto identity = dd->makeIdent(1); + auto outputDD = dd->kronecker(inputDD, identity); + const auto expectedMatrix = dd::CMat{{dd::SQRT2_2, 0, 0, 0}, + {0, dd::SQRT2_2, 0, 0}, + {0, 0, dd::SQRT2_2, 0}, + {0, 0, 0, dd::SQRT2_2}}; + EXPECT_EQ(outputDD, dd->makeIdent(2)); +} + +TEST(DDPackageTest, DDMKroeneckerProduct4) { // passed but it's wrong + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0}, + {dd::SQRT2_2, 0, 0, 0, dd::SQRT2_2, 0, 0, 0}, + {0, dd::SQRT2_2, 0, 0, 0, dd::SQRT2_2, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, 0, 1}, + {dd::SQRT2_2, 0, 0, 0, -dd::SQRT2_2, 0, 0, 0}, + {0, dd::SQRT2_2, 0, 0, 0, -dd::SQRT2_2, 0, 0}}; + ; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + auto identity = dd->makeIdent(1); + auto outputDD = dd->kronecker(inputDD, identity); + const auto expectedMatrix = + dd::CMat{{0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + {0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, + {0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}}; + EXPECT_EQ(outputDD.getMatrix(), expectedMatrix); +} From 26253c04abff3a7929c4b8db11e326bf028647f3 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Thu, 9 Nov 2023 13:11:25 +0100 Subject: [PATCH 04/51] :bug: increased number of qubits in the tests --- test/dd/test_package.cpp | 57 ++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index a9756b3bf..fe1a60418 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2051,7 +2051,6 @@ TEST(DDPackageTest, DDMShiftAllColumns3) { expectedMatrix.insert(expectedMatrix.end(), expectedMatrixPart2.begin(), expectedMatrixPart2.end()); EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); - // TODO } TEST(DDPackageTest, DDMTestToMatrixAndBack) { @@ -2113,7 +2112,7 @@ TEST(DDPackageTest, DDMSetRowsToZero) { } TEST(DDPackageTest, DDMPartialEquivalenceChecking) { - const auto nqubits = 2U; + const auto nqubits = 4U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; @@ -2139,7 +2138,7 @@ TEST(DDPackageTest, DDMPartialEquivalenceChecking) { } TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { - const auto nqubits = 3U; + const auto nqubits = 4U; auto dd = std::make_unique>(nqubits); auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 0, 2); auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 2); @@ -2185,8 +2184,8 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperWith4thQubit) { EXPECT_TRUE(result); } -TEST(DDPackageTest, DDMKroeneckerProduct) { // passed - const auto nqubits = 3U; +TEST(DDPackageTest, DDMKroneckerProduct) { // passed + const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, dd::SQRT2_2}, {dd::SQRT2_2, 1}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); @@ -2199,8 +2198,8 @@ TEST(DDPackageTest, DDMKroeneckerProduct) { // passed EXPECT_EQ(outputDD.getMatrix(), expectedMatrix); } -TEST(DDPackageTest, DDMKroeneckerProduct2) { // passed - const auto nqubits = 3U; +TEST(DDPackageTest, DDMKroneckerProduct2) { + const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{-dd::SQRT2_2, dd::SQRT2_2}, {dd::SQRT2_2, -dd::SQRT2_2}}; @@ -2214,8 +2213,8 @@ TEST(DDPackageTest, DDMKroeneckerProduct2) { // passed EXPECT_EQ(outputDD.getMatrix(), expectedMatrix); } -TEST(DDPackageTest, DDMKroeneckerProduct3) { // passed - const auto nqubits = 3U; +TEST(DDPackageTest, DDMKroneckerProduct3) { + const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{dd::SQRT2_2, 0}, {0, dd::SQRT2_2}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); @@ -2225,11 +2224,11 @@ TEST(DDPackageTest, DDMKroeneckerProduct3) { // passed {0, dd::SQRT2_2, 0, 0}, {0, 0, dd::SQRT2_2, 0}, {0, 0, 0, dd::SQRT2_2}}; - EXPECT_EQ(outputDD, dd->makeIdent(2)); + EXPECT_EQ(outputDD.getMatrix(), expectedMatrix); } -TEST(DDPackageTest, DDMKroeneckerProduct4) { // passed but it's wrong - const auto nqubits = 3U; +TEST(DDPackageTest, DDMKroneckerProduct4) { + const auto nqubits = 4U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{0, 0, 1, 0, 0, 0, 0, 0}, @@ -2244,22 +2243,22 @@ TEST(DDPackageTest, DDMKroeneckerProduct4) { // passed but it's wrong auto inputDD = dd->makeDDFromMatrix(inputMatrix); auto identity = dd->makeIdent(1); auto outputDD = dd->kronecker(inputDD, identity); - const auto expectedMatrix = - dd::CMat{{0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, - {0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, - {0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, - {0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}}; + const auto expectedMatrix = dd::CMat{ + {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + {dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0}, + {0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0}, + {0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0}, + {0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, -dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0}, + {0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, -dd::SQRT2_2, 0, 0, 0, 0, 0, 0}, + {0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, -dd::SQRT2_2, 0, 0, 0, 0, 0}, + {0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, -dd::SQRT2_2, 0, 0, 0, 0}}; EXPECT_EQ(outputDD.getMatrix(), expectedMatrix); } From b3698d62e522bef68868b839987347426c58ea0a Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Fri, 10 Nov 2023 14:59:05 +0100 Subject: [PATCH 05/51] :art: improve the structure and comments of the code --- include/dd/Package.hpp | 120 ++++++++++++++++++-------------- test/dd/test_package.cpp | 145 +++++++++++++++------------------------ 2 files changed, 127 insertions(+), 138 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 458677b78..583c3b4c3 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2824,8 +2824,12 @@ template class Package { return newedge; } - mEdge shiftAllColumnsRecursive(mEdge& e, std::int64_t m, - std::int64_t offset) { + /** + Equally divides the rows of the matrix represented by e intro 2^m parts. + For the i-th part (i starts from 0), right shifts the contents for (i + + offset) columns. + **/ + mEdge shiftAllRowsRecursive(mEdge& e, std::int64_t m, std::int64_t offset) { if (e.isTerminal()) { return e; @@ -2838,25 +2842,27 @@ template class Package { const auto mDecremented = (m > 0 ? m - 1 : 0); std::array edges{}; if (offset == 1 << (h - 1)) { - // shift the first half of the matrix + // shift the first half of the matrix by 2^(h-1) edges[0] = mEdge::zero(); - edges[1] = shiftAllColumnsRecursive(e.p->e[0], mDecremented, 0); - // shift the second half of the matrix + edges[1] = shiftAllRowsRecursive(e.p->e[0], mDecremented, 0); + // shift the second half of the matrix by 2^(h-1) edges[2] = mEdge::zero(); - edges[3] = shiftAllColumnsRecursive(e.p->e[2], mDecremented, - m > 0 ? 1 << (m - 1) : 0); + edges[3] = shiftAllRowsRecursive(e.p->e[2], mDecremented, + m > 0 ? 1 << (m - 1) : 0); } else { - edges[0] = shiftAllColumnsRecursive(e.p->e[0], mDecremented, offset); - edges[1] = shiftAllColumnsRecursive(e.p->e[1], mDecremented, offset); + // don't shift the first half of the matrix yet + edges[0] = shiftAllRowsRecursive(e.p->e[0], mDecremented, offset); + edges[1] = shiftAllRowsRecursive(e.p->e[1], mDecremented, offset); if (m == h) { - // shift the second half of the matrix + // shift the second half of the matrix by 2^(h-1) edges[2] = mEdge::zero(); - edges[3] = shiftAllColumnsRecursive(e.p->e[2], mDecremented, offset); + edges[3] = shiftAllRowsRecursive(e.p->e[2], mDecremented, offset); } else { - edges[2] = shiftAllColumnsRecursive( - e.p->e[2], mDecremented, (m > 0 ? 1 << (m - 1) : 0) + offset); - edges[3] = shiftAllColumnsRecursive( - e.p->e[3], mDecremented, (m > 0 ? 1 << (m - 1) : 0) + offset); + // don't shift the second half of the matrix yet + edges[2] = shiftAllRowsRecursive(e.p->e[2], mDecremented, + (m > 0 ? 1 << (m - 1) : 0) + offset); + edges[3] = shiftAllRowsRecursive(e.p->e[3], mDecremented, + (m > 0 ? 1 << (m - 1) : 0) + offset); } } auto f = makeDDNode(e.p->v, edges); @@ -2865,10 +2871,20 @@ template class Package { } public: - mEdge shiftAllColumns(mEdge& e, std::int64_t m) { - return shiftAllColumnsRecursive(e, m, 0); + /** + Equally divides the rows of the matrix represented by e intro 2^m parts. + For the i-th part (i starts from 0), right shifts the contents for i + columns. + **/ + mEdge shiftAllRows(mEdge& e, std::int64_t m) { + return shiftAllRowsRecursive(e, m, 0); } + /** + Equally divides the columns of the matrix represented by e intro parts of + size 2^k. For each part, keeps the leftmost column unchanged, and sets the + remaining columns to 0. + **/ mEdge setColumnsToZero(mEdge& e, Qubit k) { if (e.isTerminal()) { return e; @@ -2893,6 +2909,11 @@ template class Package { return f; } + /** + Equally divides the rows of the matrix represented by e intro parts of + size 2^k. For each part, keeps the top row unchanged, and sets the remaining + entries to 0. + **/ mEdge setRowsToZero(mEdge& e, Qubit k) { if (e.isTerminal()) { return e; @@ -2917,49 +2938,54 @@ template class Package { return f; } +private: mEdge partialEquivalenceCheckSubroutine(mEdge& u, Qubit m, Qubit k, Qubit extra) { - // u.printMatrix(); - // std::cout << "\n"; auto u1{u}; + // add extra ancillary qubits if (extra > 0) { - // u1.printMatrix(); - // std::cout << "\n"; + if (u.p->v + 1U + extra > nqubits) { + resize(u.p->v + 1U + extra); + } auto idExtra = makeIdent(extra); - // idExtra.printMatrix(); - // std::cout << "\n"; u1 = kronecker(u, idExtra); - // u1.printMatrix(); - // std::cout << "\n"; } - // u1.printMatrix(); - // std::cout << "\n"; auto u2 = setColumnsToZero(u1, k); - // u2.printMatrix(); - // std::cout << "\n"; - auto u3 = shiftAllColumns(u2, m); - // u3.printMatrix(); - // std::cout << "\n"; + auto u3 = shiftAllRows(u2, m); auto u4 = multiply(conjugateTranspose(u1), u3); - // u4.printMatrix(); - // std::cout << "\n"; auto u5 = setRowsToZero(u4, k); - // u5.printMatrix(); - // std::cout << "\n"; return u5; } +public: + /** + Checks for partial equivalence between the two circuits u1 and u2, + where the last d qubits of the circuits are the data qubits and + the last m qubits are the measured qubits. + @param u1 First circuit + @param u2 Second circuit + @param d Number of data qubits + @param m Number of measured qubits + @return true if the two circuits u1 and u2 are partially equivalent + **/ bool partialEquivalenceCheck(mEdge& u1, mEdge& u2, Qubit d, Qubit m) { + if (m == 0) { + return true; + } if (u1.isTerminal() && u2.isTerminal()) { return u1 == u2; } - - if (u1.isTerminal() || u2.isTerminal() || u1.p->v != u2.p->v) { - throw std::invalid_argument( - "The two circuits need to have the same amount of qubits. u1 has " + - std::to_string(u1.p->v) + " qubits, and u2 has " + - std::to_string(u2.p->v) + " qubits:"); + // add qubits such that u1 and u2 have the same dimension + if (u1.isTerminal()) { + u1 = kronecker(u1, makeIdent(u2.p->v + 1)); + } else if (u2.isTerminal()) { + u2 = kronecker(u2, makeIdent(u1.p->v + 1)); + } else if (u1.p->v < u2.p->v) { + u1 = kronecker(u1, makeIdent(u2.p->v - u1.p->v)); + } else if (u1.p->v > u2.p->v) { + u2 = kronecker(u2, makeIdent(u1.p->v - u2.p->v)); } + const Qubit h = u1.p->v + 1; Qubit k = h - d; Qubit extra{0}; @@ -2967,17 +2993,11 @@ template class Package { extra = m - k; } k = k + extra; + auto u1Prime = partialEquivalenceCheckSubroutine(u1, m, k, extra); - // std::cout << "u1'\n"; - // u1Prime.printMatrix(); - // std::cout << "\n"; - // std::cout << "u2'\n"; auto u2Prime = partialEquivalenceCheckSubroutine(u2, m, k, extra); - // u2Prime.printMatrix(); - // std::cout << "\n"; - bool result = u1Prime == u2Prime; - return result; + return u1Prime == u2Prime; } }; diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index fe1a60418..41d417c64 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -1965,26 +1965,24 @@ TEST(DDPackageTest, DDStatistics) { EXPECT_GT(uniqueTableStats["total"]["num_buckets"], 0); } -TEST(DDPackageTest, DDMShiftAllColumns) { +TEST(DDPackageTest, DDMShiftAllRows) { const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, 0, 0, 0}, {-1, 0, 0, 0}, {-1, 0, 0, 0}, {1, 0, 0, 0}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - // dd->incRef(inputDD); - const auto outputMatrix = dd->shiftAllColumns(inputDD, 1); + const auto outputMatrix = dd->shiftAllRows(inputDD, 1); const auto expectedMatrix = dd::CMat{{1, 0, 0, 0}, {-1, 0, 0, 0}, {0, -1, 0, 0}, {0, 1, 0, 0}}; EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); - // dd->incRef(inputDD); - const auto outputMatrix2 = dd->shiftAllColumns(inputDD, 2); + const auto outputMatrix2 = dd->shiftAllRows(inputDD, 2); const auto expectedMatrix2 = dd::CMat{{1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, -1, 0}, {0, 0, 0, 1}}; EXPECT_EQ(outputMatrix2.getMatrix(), expectedMatrix2); } -TEST(DDPackageTest, DDMShiftAllColumns2) { - const auto nqubits = 2U; +TEST(DDPackageTest, DDMShiftAllRows3Qubits) { + const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, @@ -1992,8 +1990,8 @@ TEST(DDPackageTest, DDMShiftAllColumns2) { {1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - // dd->incRef(inputDD); - const auto outputMatrix = dd->shiftAllColumns(inputDD, 2); + + const auto outputMatrix = dd->shiftAllRows(inputDD, 2); const auto expectedMatrix = dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, @@ -2001,7 +1999,7 @@ TEST(DDPackageTest, DDMShiftAllColumns2) { {0, 0, 0, -1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0}}; EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); - const auto outputMatrix4 = dd->shiftAllColumns(inputDD, 1); + const auto outputMatrix4 = dd->shiftAllRows(inputDD, 1); const auto expectedMatrix4 = dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}, @@ -2009,7 +2007,7 @@ TEST(DDPackageTest, DDMShiftAllColumns2) { {0, -1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}}; EXPECT_EQ(outputMatrix4.getMatrix(), expectedMatrix4); - const auto outputMatrix2 = dd->shiftAllColumns(inputDD, 3); + const auto outputMatrix2 = dd->shiftAllRows(inputDD, 3); const auto expectedMatrix2 = dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, {0, 0, -1, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0}, @@ -2023,7 +2021,7 @@ TEST(DDPackageTest, DDMShiftAllColumns2) { {1, 0, 0, 0, 1, 0, 0, 0}, {-1, 0, 0, 0, 1, 0, 0, 0}, {-1, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 0, 0}}; auto inputDD2 = dd->makeDDFromMatrix(inputMatrix2); - const auto outputMatrix3 = dd->shiftAllColumns(inputDD2, 1); + const auto outputMatrix3 = dd->shiftAllRows(inputDD2, 1); const auto expectedMatrix3 = dd::CMat{{1, 0, 0, 0, 1, 0, 0, 0}, {-1, 0, 0, 0, 1, 0, 0, 0}, {-1, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 0, 0}, @@ -2032,7 +2030,7 @@ TEST(DDPackageTest, DDMShiftAllColumns2) { EXPECT_EQ(outputMatrix3.getMatrix(), expectedMatrix3); } -TEST(DDPackageTest, DDMShiftAllColumns3) { +TEST(DDPackageTest, DDMShiftAllRows5Qubits) { const auto nqubits = 5U; auto dd = std::make_unique>(nqubits); std::uint64_t n = 1 << nqubits; @@ -2042,50 +2040,34 @@ TEST(DDPackageTest, DDMShiftAllColumns3) { row10[i] = 1; row01[i] = 0; } - dd::CMat inputMatrix(n, row10); + dd::CMat inputMatrix( + n, row10); // inputMatrix = [1, 0, 1, 0...]...[1, 0, 1, 0...]... auto inputDD = dd->makeDDFromMatrix(inputMatrix); - // dd->incRef(inputDD); - const auto outputMatrix = dd->shiftAllColumns(inputDD, 1); + + const auto outputMatrix = dd->shiftAllRows(inputDD, 1); dd::CMat expectedMatrix(n / 2, row10); dd::CMat expectedMatrixPart2(n / 2, row01); expectedMatrix.insert(expectedMatrix.end(), expectedMatrixPart2.begin(), expectedMatrixPart2.end()); + // expectedMatrix = [1, 0, 1, 0...]...[0, 1, 0, 1...]... EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); } -TEST(DDPackageTest, DDMTestToMatrixAndBack) { - const auto nqubits = 2U; - auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - const auto expectedMatrix = - dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; - EXPECT_EQ(inputDD.getMatrix(), expectedMatrix); - - std::array edges{}; - edges[0] = inputDD.p->e[0]; - edges[1] = inputDD.p->e[1]; - edges[2] = inputDD.p->e[2]; - edges[3] = inputDD.p->e[3]; - auto f = dd->makeDDNode(inputDD.p->v, edges); - EXPECT_EQ(f.getMatrix(), expectedMatrix); -} - TEST(DDPackageTest, DDMSetColumnsToZero) { const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - // dd->incRef(inputDD); + const auto outputMatrix = dd->setColumnsToZero(inputDD, 1); const auto expectedMatrix = dd::CMat{{1, 0, 1, 0}, {1, 0, 1, 0}, {1, 0, -1, 0}, {1, 0, -1, 0}}; EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); } -TEST(DDPackageTest, DDMSetColumnsToZeroWithReduceAncillae) { // passed but wrong +TEST(DDPackageTest, + DDMSetColumnsToZeroWithReduceAncillae) { // the test passes but it's wrong const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = @@ -2104,41 +2086,58 @@ TEST(DDPackageTest, DDMSetRowsToZero) { const auto inputMatrix = dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - // dd->incRef(inputDD); + const auto outputMatrix = dd->setRowsToZero(inputDD, 1); const auto expectedMatrix = dd::CMat{{1, 1, 1, 1}, {0, 0, 0, 0}, {1, 1, -1, -1}, {0, 0, 0, 0}}; EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); } -TEST(DDPackageTest, DDMPartialEquivalenceChecking) { - const auto nqubits = 4U; +TEST(DDPackageTest, DDMPartialEquivalenceCheckingTrivialEquivalence) { + const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - // dd->incRef(inputDD); - bool result1 = dd->partialEquivalenceCheck(inputDD, inputDD, 1, 1); - EXPECT_TRUE(result1); - // dd->incRef(inputDD); - bool result2 = dd->partialEquivalenceCheck(inputDD, inputDD, 2, 1); - EXPECT_TRUE(result2); - // dd->incRef(inputDD); - bool result3 = dd->partialEquivalenceCheck(inputDD, inputDD, 1, 2); - EXPECT_TRUE(result3); - // dd->incRef(inputDD); - bool result4 = dd->partialEquivalenceCheck(inputDD, inputDD, 2, 2); - EXPECT_TRUE(result4); + + EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 1, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 2, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 1, 2)); + EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 2, 2)); auto hGate = dd->makeGateDD(dd::H_MAT, 2, 1); auto cxGate = dd->makeGateDD(dd::X_MAT, 2, 1_pc, 0); auto bellMatrix = dd->multiply(cxGate, hGate); - bool result5 = dd->partialEquivalenceCheck(inputDD, bellMatrix, 1, 1); - EXPECT_FALSE(result5); + EXPECT_FALSE(dd->partialEquivalenceCheck(inputDD, bellMatrix, 1, 1)); +} + +TEST(DDPackageTest, DDMPartialEquivalenceCheckingTest) { + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + // only the first qubit has differing gates in the two circuits, + // therefore they should be equivalent if we only measure the second qubit + auto hGate = dd->makeGateDD(dd::H_MAT, 3, 1); + auto xGate = dd->makeGateDD(dd::X_MAT, 3, 1); + auto circuit1 = dd->multiply(xGate, hGate); + auto circuit2 = dd->makeIdent(3); + + EXPECT_TRUE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); +} + +TEST(DDPackageTest, DDMPartialEquivalenceCheckingTestNotEquivalent) { + const auto nqubits = 2U; + auto dd = std::make_unique>(nqubits); + // only the first qubit has differing gates in the two circuits, + // therefore they should be equivalent if we only measure the second qubit + auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 1); + auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + auto circuit1 = dd->multiply(xGate, hGate); + auto circuit2 = dd->makeIdent(2); + EXPECT_FALSE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); } TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { - const auto nqubits = 4U; + const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 0, 2); auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 2); @@ -2151,40 +2150,10 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); auto c2 = dd->multiply(controlledHGate, xGate); - c1.printMatrix(); - std::cout << "\n"; - c2.printMatrix(); - std::cout << "\n"; - bool result = dd->partialEquivalenceCheck(c1, c2, 3, 1); - // dd::SQRT2_2 - - EXPECT_TRUE(result); -} - -TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperWith4thQubit) { - const auto nqubits = 4U; - auto dd = std::make_unique>(nqubits); - auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{2}, 1, 3); - auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 3); - auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 1); - auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 2); - auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{2}, 3); - - auto c1 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - auto c2 = dd->multiply(controlledHGate, xGate); - - // c1.printMatrix(); - // std::cout << "\n"; - // c2.printMatrix(); - // std::cout << "\n"; - bool result = dd->partialEquivalenceCheck(c1, c2, 3, 1); - - EXPECT_TRUE(result); + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); } -TEST(DDPackageTest, DDMKroneckerProduct) { // passed +TEST(DDPackageTest, DDMKroneckerProduct) { const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, dd::SQRT2_2}, {dd::SQRT2_2, 1}}; @@ -2239,7 +2208,7 @@ TEST(DDPackageTest, DDMKroneckerProduct4) { {0, 0, 0, 0, 0, 0, 0, 1}, {dd::SQRT2_2, 0, 0, 0, -dd::SQRT2_2, 0, 0, 0}, {0, dd::SQRT2_2, 0, 0, 0, -dd::SQRT2_2, 0, 0}}; - ; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); auto identity = dd->makeIdent(1); auto outputDD = dd->kronecker(inputDD, identity); From 507e8cd2d8a107d2f54a877116eee10682b011e9 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Tue, 21 Nov 2023 17:32:08 +0100 Subject: [PATCH 06/51] :sparkles: added partial equivalence function that swaps measured qubits to the end --- include/dd/Package.hpp | 8 ++--- include/dd/Verification.hpp | 72 +++++++++++++++++++++++++++++++++++++ test/dd/test_package.cpp | 26 ++++++++++++++ 3 files changed, 102 insertions(+), 4 deletions(-) create mode 100644 include/dd/Verification.hpp diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 583c3b4c3..d7ad7c027 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2962,13 +2962,13 @@ template class Package { Checks for partial equivalence between the two circuits u1 and u2, where the last d qubits of the circuits are the data qubits and the last m qubits are the measured qubits. - @param u1 First circuit - @param u2 Second circuit + @param u1 DD representation of first circuit + @param u2 DD representation of second circuit @param d Number of data qubits @param m Number of measured qubits - @return true if the two circuits u1 and u2 are partially equivalent + @return true if the two circuits u1 and u2 are partially equivalent. **/ - bool partialEquivalenceCheck(mEdge& u1, mEdge& u2, Qubit d, Qubit m) { + bool partialEquivalenceCheck(mEdge u1, mEdge u2, Qubit d, Qubit m) { if (m == 0) { return true; } diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp new file mode 100644 index 000000000..d2325f00f --- /dev/null +++ b/include/dd/Verification.hpp @@ -0,0 +1,72 @@ +#include "dd/FunctionalityConstruction.hpp" +#include "dd/Package.hpp" + +namespace dd { + +// get next garbage qubit before n +inline Qubit getNextGarbage(Qubit n, const std::vector& garbage) { + while (n > 0 && !garbage.at(n)) { + --n; + } + return n; +} +/** + Checks for partial equivalence between the two circuits c1 and c2. + Assumption: the data qubits are all at the end of the input qubits and + the input and output permutations are the same. + + @param circuit1 First circuit + @param circuit2 Second circuit + @return true if the two circuits c1 and c2 are partially equivalent. + **/ +template +bool partialEquivalenceCheck(const qc::QuantumComputation& circuit1, + const qc::QuantumComputation& circuit2, + std::unique_ptr>& dd) { + + auto c1 = circuit1; + auto c2 = circuit2; + + auto d1 = c1.getNqubitsWithoutAncillae(); + auto d2 = c2.getNqubitsWithoutAncillae(); + auto m1 = c1.getNqubits() - + static_cast(std::count(c1.getGarbage().begin(), + c1.getGarbage().end(), true)); + auto m2 = c2.getNqubits() - + static_cast(std::count(c2.getGarbage().begin(), + c2.getGarbage().end(), true)); + if (m1 != m2 || d1 != d2) { + return false; + } + + // add swaps in order to put the measured (= not garbage) qubits in the end + auto garbage = c1.getGarbage(); + auto n = static_cast(garbage.size()); + auto nextGarbage = getNextGarbage(n - 1, garbage); + // find the first garbage qubit at the end + for (Qubit i = 0U; i < n - static_cast(m1); i++) { + if (!garbage.at(i)) { + // swap it to the end + c1.swap(i, nextGarbage); + c2.swap(i, nextGarbage); + --nextGarbage; + nextGarbage = getNextGarbage(nextGarbage, garbage); + } + } + + // pretend to not have any garbage qubits s.t. the buildFunctionality + // function doesn't use reduceGarbage + + std::vector emptyGarbage(n, false); + c1.garbage = emptyGarbage; + c2.garbage = emptyGarbage; + + // partialEquivalenceCheck with dd + + auto u1 = buildFunctionality(&c1, dd); + auto u2 = buildFunctionality(&c2, dd); + return dd->partialEquivalenceCheck(u1, u2, static_cast(d1), + static_cast(m1)); + // return true; +} +} // namespace dd diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 41d417c64..819028f34 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -1,6 +1,7 @@ #include "dd/Export.hpp" #include "dd/GateMatrixDefinitions.hpp" #include "dd/Package.hpp" +#include "dd/Verification.hpp" #include "dd/statistics/PackageStatistics.hpp" #include "operations/Control.hpp" @@ -2231,3 +2232,28 @@ TEST(DDPackageTest, DDMKroneckerProduct4) { {0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, -dd::SQRT2_2, 0, 0, 0, 0}}; EXPECT_EQ(outputDD.getMatrix(), expectedMatrix); } + +TEST(DDPackageTest, + DDMPartialEquivalenceCheckingExamplePaperDifferentQubitOrder) { + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + + qc::QuantumComputation c1{3, 1}; + c1.cswap(1, 0, 2); + c1.h(0); + c1.z(2); + c1.cswap(1, 0, 2); + // c1.measure(2, 0); + + qc::QuantumComputation c2{3, 1}; + c2.x(1); + c2.ch(1, 0); + // c2.measure(2, 0); + + c1.setLogicalQubitGarbage(1); + c1.setLogicalQubitGarbage(2); + + c2.setLogicalQubitGarbage(1); + c2.setLogicalQubitGarbage(2); + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); +} From 43f43b5a7a60db1ee32a3053bdd7cab410f78e05 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Thu, 23 Nov 2023 14:49:44 +0100 Subject: [PATCH 07/51] :zap: Added compute table for setRowsToZero and setColumnsToZero --- include/dd/Package.hpp | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index d7ad7c027..b5ea64625 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2859,16 +2859,17 @@ template class Package { edges[3] = shiftAllRowsRecursive(e.p->e[2], mDecremented, offset); } else { // don't shift the second half of the matrix yet - edges[2] = shiftAllRowsRecursive(e.p->e[2], mDecremented, - (m > 0 ? 1 << (m - 1) : 0) + offset); - edges[3] = shiftAllRowsRecursive(e.p->e[3], mDecremented, - (m > 0 ? 1 << (m - 1) : 0) + offset); + auto newOffset = (m > 0 ? 1 << (m - 1) : 0) + offset; + edges[2] = shiftAllRowsRecursive(e.p->e[2], mDecremented, newOffset); + edges[3] = shiftAllRowsRecursive(e.p->e[3], mDecremented, newOffset); } } auto f = makeDDNode(e.p->v, edges); f.w = e.w; return f; } + ComputeTable setMatrixColumnsToZero{}; + ComputeTable setMatrixRowsToZero{}; public: /** @@ -2892,6 +2893,14 @@ template class Package { if (k == 0) { return e; } + // check if it's in the compute table with an edge weight of one + if (const auto* r = + setMatrixColumnsToZero.lookup(mEdge{e.p, Complex::one()}, k); + r != nullptr) { + auto f = *r; + f.w = e.w; + return f; + } // the matrix of the current DD has dimensions 2^h x 2^h const auto h = e.p->v + 1; std::array edges{}; @@ -2905,6 +2914,10 @@ template class Package { edges[3] = mEdge::zero(); } auto f = makeDDNode(e.p->v, edges); + + // add to the compute table with a weight of 1 + f.w = Complex::one(); + setMatrixColumnsToZero.insert(e, k, f); f.w = e.w; return f; } @@ -2921,6 +2934,14 @@ template class Package { if (k == 0) { return e; } + // check if it's in the compute table with an edge weight of one + if (const auto* r = + setMatrixRowsToZero.lookup(mEdge{e.p, Complex::one()}, k); + r != nullptr) { + auto f = *r; + f.w = e.w; + return f; + } // the matrix of the current DD has dimensions 2^h x 2^h const auto h = e.p->v + 1; std::array edges{}; @@ -2934,6 +2955,10 @@ template class Package { edges[3] = mEdge::zero(); } auto f = makeDDNode(e.p->v, edges); + + // add to the compute table with a weight of 1 + f.w = Complex::one(); + setMatrixColumnsToZero.insert(e, k, f); f.w = e.w; return f; } From 1f94d7280d1a364cb7b3ecbe73443a5686eabacc Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 27 Nov 2023 09:58:21 +0100 Subject: [PATCH 08/51] :zap: added alternative partial equivalence checker for circuits without ancilla qubits --- include/dd/Package.hpp | 29 +++++++++++++++++++++++++++++ include/dd/Verification.hpp | 11 ++++++----- test/dd/test_package.cpp | 30 ++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 5 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index b5ea64625..889bf4ff2 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2982,6 +2982,19 @@ template class Package { return u5; } + bool zeroAncillaPartialEquivalenceCheckSubroutine(mEdge u, Qubit m) { + if (u.isTerminal()) { + return m < 1; + } + if (m == 0) { + return true; + } + + return u.p->e[1].isZeroTerminal() && u.p->e[2].isZeroTerminal() && + zeroAncillaPartialEquivalenceCheckSubroutine(u.p->e[0], m - 1) && + zeroAncillaPartialEquivalenceCheckSubroutine(u.p->e[3], m - 1); + } + public: /** Checks for partial equivalence between the two circuits u1 and u2, @@ -3024,6 +3037,22 @@ template class Package { return u1Prime == u2Prime; } + + /** + Checks for partial equivalence between the two circuits u1 and u2, + where all qubits of the circuits are the data qubits and + the last m qubits are the measured qubits. + @param u1 DD representation of first circuit + @param u2 DD representation of second circuit + @param m Number of measured qubits + @return true if the two circuits u1 and u2 are partially equivalent. + **/ + bool zeroAncillaPartialEquivalenceCheck(mEdge u1, mEdge u2, Qubit m) { + + auto u1u2 = multiply(u1, conjugateTranspose(u2)); + u1u2.printMatrix(); + return zeroAncillaPartialEquivalenceCheckSubroutine(u1u2, m); + } }; } // namespace dd diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index d2325f00f..c40d962e0 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -20,13 +20,10 @@ inline Qubit getNextGarbage(Qubit n, const std::vector& garbage) { @return true if the two circuits c1 and c2 are partially equivalent. **/ template -bool partialEquivalenceCheck(const qc::QuantumComputation& circuit1, - const qc::QuantumComputation& circuit2, +bool partialEquivalenceCheck(qc::QuantumComputation c1, + qc::QuantumComputation c2, std::unique_ptr>& dd) { - auto c1 = circuit1; - auto c2 = circuit2; - auto d1 = c1.getNqubitsWithoutAncillae(); auto d2 = c2.getNqubitsWithoutAncillae(); auto m1 = c1.getNqubits() - @@ -65,6 +62,10 @@ bool partialEquivalenceCheck(const qc::QuantumComputation& circuit1, auto u1 = buildFunctionality(&c1, dd); auto u2 = buildFunctionality(&c2, dd); + if (d1 == n) { + // no ancilla qubits + return dd->zeroAncillaPartialEquivalenceCheck(u1, u2, m1); + } return dd->partialEquivalenceCheck(u1, u2, static_cast(d1), static_cast(m1)); // return true; diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 819028f34..9e8b9c8ff 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2154,6 +2154,36 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); } +TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncilla) { + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 0, 2); + auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 2); + auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 0); + auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 2); + + auto c1 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); + auto c2 = dd->multiply(controlledHGate, xGate); + + EXPECT_TRUE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 1)); + EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 2)); + + auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 0); + auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 2); + auto controlledHGate2 = + dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 2); + + auto c3 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate2, dd->multiply(zGate2, controlledSwapGate))); + auto c4 = dd->multiply(controlledHGate2, xGate); + + EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c3, c4, 1)); +} + TEST(DDPackageTest, DDMKroneckerProduct) { const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); From dd144c6297efd34914a2a516790e89ad46ebc98b Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 27 Nov 2023 12:15:52 +0100 Subject: [PATCH 09/51] :fire: removed redundant tests --- include/dd/Package.hpp | 1 + include/dd/Verification.hpp | 3 +- test/dd/test_package.cpp | 79 ------------------------------------- 3 files changed, 3 insertions(+), 80 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 889bf4ff2..4b306123a 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2868,6 +2868,7 @@ template class Package { f.w = e.w; return f; } + ComputeTable setMatrixColumnsToZero{}; ComputeTable setMatrixRowsToZero{}; diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index c40d962e0..0ddec1fb5 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -64,7 +64,8 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, auto u2 = buildFunctionality(&c2, dd); if (d1 == n) { // no ancilla qubits - return dd->zeroAncillaPartialEquivalenceCheck(u1, u2, m1); + return dd->zeroAncillaPartialEquivalenceCheck(u1, u2, + static_cast(m1)); } return dd->partialEquivalenceCheck(u1, u2, static_cast(d1), static_cast(m1)); diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 9e8b9c8ff..04683de0c 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2184,85 +2184,6 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncilla) { EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c3, c4, 1)); } -TEST(DDPackageTest, DDMKroneckerProduct) { - const auto nqubits = 2U; - auto dd = std::make_unique>(nqubits); - const auto inputMatrix = dd::CMat{{1, dd::SQRT2_2}, {dd::SQRT2_2, 1}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - auto identity = dd->makeIdent(1); - auto outputDD = dd->kronecker(inputDD, identity); - const auto expectedMatrix = dd::CMat{{1, 0, dd::SQRT2_2, 0}, - {0, 1, 0, dd::SQRT2_2}, - {dd::SQRT2_2, 0, 1, 0}, - {0, dd::SQRT2_2, 0, 1}}; - EXPECT_EQ(outputDD.getMatrix(), expectedMatrix); -} - -TEST(DDPackageTest, DDMKroneckerProduct2) { - const auto nqubits = 2U; - auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{-dd::SQRT2_2, dd::SQRT2_2}, {dd::SQRT2_2, -dd::SQRT2_2}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - auto identity = dd->makeIdent(1); - auto outputDD = dd->kronecker(inputDD, identity); - const auto expectedMatrix = dd::CMat{{-dd::SQRT2_2, 0, dd::SQRT2_2, 0}, - {0, -dd::SQRT2_2, 0, dd::SQRT2_2}, - {dd::SQRT2_2, 0, -dd::SQRT2_2, 0}, - {0, dd::SQRT2_2, 0, -dd::SQRT2_2}}; - EXPECT_EQ(outputDD.getMatrix(), expectedMatrix); -} - -TEST(DDPackageTest, DDMKroneckerProduct3) { - const auto nqubits = 2U; - auto dd = std::make_unique>(nqubits); - const auto inputMatrix = dd::CMat{{dd::SQRT2_2, 0}, {0, dd::SQRT2_2}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - auto identity = dd->makeIdent(1); - auto outputDD = dd->kronecker(inputDD, identity); - const auto expectedMatrix = dd::CMat{{dd::SQRT2_2, 0, 0, 0}, - {0, dd::SQRT2_2, 0, 0}, - {0, 0, dd::SQRT2_2, 0}, - {0, 0, 0, dd::SQRT2_2}}; - EXPECT_EQ(outputDD.getMatrix(), expectedMatrix); -} - -TEST(DDPackageTest, DDMKroneckerProduct4) { - const auto nqubits = 4U; - auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{0, 0, 1, 0, 0, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 0, 0}, - {dd::SQRT2_2, 0, 0, 0, dd::SQRT2_2, 0, 0, 0}, - {0, dd::SQRT2_2, 0, 0, 0, dd::SQRT2_2, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0, 1}, - {dd::SQRT2_2, 0, 0, 0, -dd::SQRT2_2, 0, 0, 0}, - {0, dd::SQRT2_2, 0, 0, 0, -dd::SQRT2_2, 0, 0}}; - - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - auto identity = dd->makeIdent(1); - auto outputDD = dd->kronecker(inputDD, identity); - const auto expectedMatrix = dd::CMat{ - {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, - {dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0}, - {0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0}, - {0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0}, - {0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, -dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0}, - {0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, -dd::SQRT2_2, 0, 0, 0, 0, 0, 0}, - {0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, -dd::SQRT2_2, 0, 0, 0, 0, 0}, - {0, 0, 0, dd::SQRT2_2, 0, 0, 0, 0, 0, 0, 0, -dd::SQRT2_2, 0, 0, 0, 0}}; - EXPECT_EQ(outputDD.getMatrix(), expectedMatrix); -} - TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperDifferentQubitOrder) { const auto nqubits = 3U; From 54009b2ec554b0fd19018af348744b97d53a11a2 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 27 Nov 2023 14:38:10 +0100 Subject: [PATCH 10/51] :fire: Removed unused include --- include/dd/Package.hpp | 1 - include/dd/Verification.hpp | 1 - 2 files changed, 2 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 56fc61dee..2aeda26db 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -8,7 +8,6 @@ #include "dd/DensityNoiseTable.hpp" #include "dd/Edge.hpp" #include "dd/GateMatrixDefinitions.hpp" -#include "dd/Node.hpp" #include "dd/Package_fwd.hpp" #include "dd/StochasticNoiseOperationTable.hpp" #include "dd/UnaryComputeTable.hpp" diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index 0ddec1fb5..ab1e31f33 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -69,6 +69,5 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, } return dd->partialEquivalenceCheck(u1, u2, static_cast(d1), static_cast(m1)); - // return true; } } // namespace dd From d3e886fa42c64112e62f8e29e0d2972862186c1e Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 27 Nov 2023 15:03:01 +0100 Subject: [PATCH 11/51] :fire: Removed debug print statement and fixed a few comments --- include/dd/Package.hpp | 1 - test/dd/test_package.cpp | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 2aeda26db..79504f4de 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -3118,7 +3118,6 @@ template class Package { bool zeroAncillaPartialEquivalenceCheck(mEdge u1, mEdge u2, Qubit m) { auto u1u2 = multiply(u1, conjugateTranspose(u2)); - u1u2.printMatrix(); return zeroAncillaPartialEquivalenceCheckSubroutine(u1u2, m); } }; diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 04683de0c..fdeb8d3d5 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2115,8 +2115,8 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingTrivialEquivalence) { TEST(DDPackageTest, DDMPartialEquivalenceCheckingTest) { const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); - // only the first qubit has differing gates in the two circuits, - // therefore they should be equivalent if we only measure the second qubit + // only the second qubit has differing gates in the two circuits, + // therefore they should be equivalent if we only measure the third qubit auto hGate = dd->makeGateDD(dd::H_MAT, 3, 1); auto xGate = dd->makeGateDD(dd::X_MAT, 3, 1); auto circuit1 = dd->multiply(xGate, hGate); @@ -2128,8 +2128,8 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingTest) { TEST(DDPackageTest, DDMPartialEquivalenceCheckingTestNotEquivalent) { const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); - // only the first qubit has differing gates in the two circuits, - // therefore they should be equivalent if we only measure the second qubit + // the second qubit has differing gates in the two circuits, + // therefore they should not be equivalent if we only measure the second qubit auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 1); auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); auto circuit1 = dd->multiply(xGate, hGate); @@ -2194,12 +2194,10 @@ TEST(DDPackageTest, c1.h(0); c1.z(2); c1.cswap(1, 0, 2); - // c1.measure(2, 0); qc::QuantumComputation c2{3, 1}; c2.x(1); c2.ch(1, 0); - // c2.measure(2, 0); c1.setLogicalQubitGarbage(1); c1.setLogicalQubitGarbage(2); From 4c45cbe07db4114170fbd0c90774aa990f5783db Mon Sep 17 00:00:00 2001 From: burgholzer Date: Mon, 27 Nov 2023 17:21:13 +0100 Subject: [PATCH 12/51] =?UTF-8?q?=E2=8F=AA=20revert=20unwanted=20submodule?= =?UTF-8?q?=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: burgholzer --- extern/boost/config | 2 +- extern/googletest | 2 +- extern/json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extern/boost/config b/extern/boost/config index 29c39d458..a98574fc1 160000 --- a/extern/boost/config +++ b/extern/boost/config @@ -1 +1 @@ -Subproject commit 29c39d45858d40bee86bd3b58ca14499663f08b5 +Subproject commit a98574fc12c2486e5b03b208936ad0f0da1bdc34 diff --git a/extern/googletest b/extern/googletest index e47544ad3..b10fad38c 160000 --- a/extern/googletest +++ b/extern/googletest @@ -1 +1 @@ -Subproject commit e47544ad31cb3ceecd04cc13e8fe556f8df9fe0b +Subproject commit b10fad38c4026a29ea6561ab15fc4818170d1c10 diff --git a/extern/json b/extern/json index fac07e22c..59da644db 160000 --- a/extern/json +++ b/extern/json @@ -1 +1 @@ -Subproject commit fac07e22c5d7dd0423ccf31c02db5603d27e6556 +Subproject commit 59da644db4e531aeff90560137f971c52fc2fd71 From 27d781ba10a01ffee4fc1dcf56010f553c256574 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Wed, 29 Nov 2023 11:35:52 +0100 Subject: [PATCH 13/51] :sparkles: Added optional flags to buildFunctionality --- include/dd/FunctionalityConstruction.hpp | 8 ++++-- include/dd/Verification.hpp | 11 ++------- src/dd/FunctionalityConstruction.cpp | 31 ++++++++++++++++++------ 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/include/dd/FunctionalityConstruction.hpp b/include/dd/FunctionalityConstruction.hpp index 794f4253a..44575acc3 100644 --- a/include/dd/FunctionalityConstruction.hpp +++ b/include/dd/FunctionalityConstruction.hpp @@ -9,11 +9,15 @@ using namespace qc; template MatrixDD buildFunctionality(const QuantumComputation* qc, - std::unique_ptr>& dd); + std::unique_ptr>& dd, + bool reduceAncillaeQubits = true, + bool reduceGarbageQubits = true); template MatrixDD buildFunctionalityRecursive(const QuantumComputation* qc, - std::unique_ptr>& dd); + std::unique_ptr>& dd, + bool reduceAncillaeQubits = true, + bool reduceGarbageQubits = true); template bool buildFunctionalityRecursive(const QuantumComputation* qc, diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index ab1e31f33..4b65ef9f5 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -51,17 +51,10 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, } } - // pretend to not have any garbage qubits s.t. the buildFunctionality - // function doesn't use reduceGarbage - - std::vector emptyGarbage(n, false); - c1.garbage = emptyGarbage; - c2.garbage = emptyGarbage; - // partialEquivalenceCheck with dd - auto u1 = buildFunctionality(&c1, dd); - auto u2 = buildFunctionality(&c2, dd); + auto u1 = buildFunctionality(&c1, dd, false, false); + auto u2 = buildFunctionality(&c2, dd, false, false); if (d1 == n) { // no ancilla qubits return dd->zeroAncillaPartialEquivalenceCheck(u1, u2, diff --git a/src/dd/FunctionalityConstruction.cpp b/src/dd/FunctionalityConstruction.cpp index 16c027ee7..86e962862 100644 --- a/src/dd/FunctionalityConstruction.cpp +++ b/src/dd/FunctionalityConstruction.cpp @@ -3,7 +3,9 @@ namespace dd { template MatrixDD buildFunctionality(const QuantumComputation* qc, - std::unique_ptr>& dd) { + std::unique_ptr>& dd, + bool reduceAncillaeQubits, + bool reduceGarbageQubits) { const auto nq = qc->getNqubits(); if (nq == 0U) { return MatrixDD::one(); @@ -27,15 +29,21 @@ MatrixDD buildFunctionality(const QuantumComputation* qc, } // correct permutation if necessary changePermutation(e, permutation, qc->outputPermutation, dd); - e = dd->reduceAncillae(e, qc->ancillary); - e = dd->reduceGarbage(e, qc->garbage); + if (reduceAncillaeQubits) { + e = dd->reduceAncillae(e, qc->ancillary); + } + if (reduceGarbageQubits) { + e = dd->reduceGarbage(e, qc->garbage); + } return e; } template MatrixDD buildFunctionalityRecursive(const QuantumComputation* qc, - std::unique_ptr>& dd) { + std::unique_ptr>& dd, + bool reduceAncillaeQubits, + bool reduceGarbageQubits) { if (qc->getNqubits() == 0U) { return MatrixDD::one(); } @@ -60,8 +68,12 @@ MatrixDD buildFunctionalityRecursive(const QuantumComputation* qc, // correct permutation if necessary changePermutation(e, permutation, qc->outputPermutation, dd); - e = dd->reduceAncillae(e, qc->ancillary); - e = dd->reduceGarbage(e, qc->garbage); + if (reduceAncillaeQubits) { + e = dd->reduceAncillae(e, qc->ancillary); + } + if (reduceGarbageQubits) { + e = dd->reduceGarbage(e, qc->garbage); + } return e; } @@ -201,10 +213,13 @@ MatrixDD buildFunctionalityRecursive(const qc::Grover* qc, template MatrixDD buildFunctionality(const qc::QuantumComputation* qc, - std::unique_ptr>& dd); + std::unique_ptr>& dd, + bool reduceAncillaeQubits, bool reduceGarbageQubits); template MatrixDD buildFunctionalityRecursive(const qc::QuantumComputation* qc, - std::unique_ptr>& dd); + std::unique_ptr>& dd, + bool reduceAncillaeQubits, + bool reduceGarbageQubits); template bool buildFunctionalityRecursive(const qc::QuantumComputation* qc, const std::size_t depth, const std::size_t opIdx, From b780cb6826f8c60e4556c438ae5499121328f84b Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Thu, 30 Nov 2023 10:16:56 +0100 Subject: [PATCH 14/51] :rotating_light: :white_check_mark: improved lint and code coverage --- include/dd/Package.hpp | 5 +++- test/dd/test_package.cpp | 54 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 79504f4de..079221200 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -3026,7 +3026,7 @@ template class Package { // add to the compute table with a weight of 1 f.w = Complex::one(); - setMatrixColumnsToZero.insert(e, k, f); + setMatrixRowsToZero.insert(e, k, f); f.w = e.w; return f; } @@ -3081,6 +3081,9 @@ template class Package { if (u1.isTerminal() && u2.isTerminal()) { return u1 == u2; } + if (u1.isZeroTerminal() || u2.isZeroTerminal()) { + return false; + } // add qubits such that u1 and u2 have the same dimension if (u1.isTerminal()) { u1 = kronecker(u1, makeIdent(u2.p->v + 1)); diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index fdeb8d3d5..920af3d0a 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2034,14 +2034,14 @@ TEST(DDPackageTest, DDMShiftAllRows3Qubits) { TEST(DDPackageTest, DDMShiftAllRows5Qubits) { const auto nqubits = 5U; auto dd = std::make_unique>(nqubits); - std::uint64_t n = 1 << nqubits; + const std::uint64_t n = 1 << nqubits; std::vector> row10(n, 0); std::vector> row01(n, 1); for (std::uint64_t i = 0; i < n; i += 2) { row10[i] = 1; row01[i] = 0; } - dd::CMat inputMatrix( + const dd::CMat inputMatrix( n, row10); // inputMatrix = [1, 0, 1, 0...]...[1, 0, 1, 0...]... auto inputDD = dd->makeDDFromMatrix(inputMatrix); @@ -2065,6 +2065,8 @@ TEST(DDPackageTest, DDMSetColumnsToZero) { const auto expectedMatrix = dd::CMat{{1, 0, 1, 0}, {1, 0, 1, 0}, {1, 0, -1, 0}, {1, 0, -1, 0}}; EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); + + EXPECT_EQ(dd->setColumnsToZero(inputDD, 0), inputDD); } TEST(DDPackageTest, @@ -2092,6 +2094,8 @@ TEST(DDPackageTest, DDMSetRowsToZero) { const auto expectedMatrix = dd::CMat{{1, 1, 1, 1}, {0, 0, 0, 0}, {1, 1, -1, -1}, {0, 0, 0, 0}}; EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); + + EXPECT_EQ(dd->setRowsToZero(inputDD, 0), inputDD); } TEST(DDPackageTest, DDMPartialEquivalenceCheckingTrivialEquivalence) { @@ -2206,3 +2210,49 @@ TEST(DDPackageTest, c2.setLogicalQubitGarbage(2); EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); } + +TEST(DDPackageTest, DDMPartialEquivalenceWithDifferentNumberOfQubits) { + auto dd = std::make_unique>(3); + auto controlledSwapGate = dd->makeSWAPDD(3, qc::Controls{1}, 0, 2); + auto hGate = dd->makeGateDD(dd::H_MAT, 3, 2); + auto zGate = dd->makeGateDD(dd::Z_MAT, 3, 0); + auto xGate = dd->makeGateDD(dd::X_MAT, 2, 0); + auto controlledHGate = dd->makeGateDD(dd::H_MAT, 2, qc::Controls{0}, 1); + + auto c1 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); + auto c2 = dd->multiply(controlledHGate, xGate); + + EXPECT_TRUE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); + EXPECT_FALSE(dd->partialEquivalenceCheck(c2, c1, 3, 3)); + EXPECT_FALSE(dd->partialEquivalenceCheck(c2, dd::mEdge::zero(), 2, 1)); + EXPECT_FALSE(dd->partialEquivalenceCheck(c2, dd::mEdge::one(), 2, 1)); + EXPECT_FALSE(dd->partialEquivalenceCheck(dd::mEdge::one(), c1, 2, 1)); + EXPECT_TRUE( + dd->partialEquivalenceCheck(dd::mEdge::one(), dd::mEdge::one(), 0, 1)); + EXPECT_TRUE( + dd->partialEquivalenceCheck(dd::mEdge::one(), dd::mEdge::one(), 0, 0)); +} + +TEST(DDPackageTest, DDMPartialEquivalenceCheckingComputeTable) { + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 0, 2); + auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 2); + auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 0); + auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 2); + + auto c1 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); + auto c2 = dd->multiply(controlledHGate, xGate); + + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); +} From d1b4db05424b792ef4af9eb87756a6a81defde1f Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Wed, 6 Dec 2023 15:13:06 +0100 Subject: [PATCH 15/51] :bug: Fixed bug in helper functions that gave a wrong result for non-normalized matrices --- include/dd/Package.hpp | 19 ++++++++++--------- test/dd/test_package.cpp | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 079221200..87ed08278 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2896,7 +2896,8 @@ template class Package { For the i-th part (i starts from 0), right shifts the contents for (i + offset) columns. **/ - mEdge shiftAllRowsRecursive(mEdge& e, std::int64_t m, std::int64_t offset) { + mEdge shiftAllRowsRecursive(const mEdge& e, std::int64_t m, + std::int64_t offset) { if (e.isTerminal()) { return e; @@ -2932,7 +2933,7 @@ template class Package { } } auto f = makeDDNode(e.p->v, edges); - f.w = e.w; + f.w = cn.lookup(e.w * f.w); return f; } @@ -2945,7 +2946,7 @@ template class Package { For the i-th part (i starts from 0), right shifts the contents for i columns. **/ - mEdge shiftAllRows(mEdge& e, std::int64_t m) { + mEdge shiftAllRows(const mEdge& e, std::int64_t m) { return shiftAllRowsRecursive(e, m, 0); } @@ -2954,7 +2955,7 @@ template class Package { size 2^k. For each part, keeps the leftmost column unchanged, and sets the remaining columns to 0. **/ - mEdge setColumnsToZero(mEdge& e, Qubit k) { + mEdge setColumnsToZero(const mEdge& e, Qubit k) { if (e.isTerminal()) { return e; } @@ -2982,11 +2983,11 @@ template class Package { edges[3] = mEdge::zero(); } auto f = makeDDNode(e.p->v, edges); - + auto temp = cn.lookup(e.w * f.w); // add to the compute table with a weight of 1 f.w = Complex::one(); setMatrixColumnsToZero.insert(e, k, f); - f.w = e.w; + f.w = temp; return f; } @@ -2995,7 +2996,7 @@ template class Package { size 2^k. For each part, keeps the top row unchanged, and sets the remaining entries to 0. **/ - mEdge setRowsToZero(mEdge& e, Qubit k) { + mEdge setRowsToZero(const mEdge& e, Qubit k) { if (e.isTerminal()) { return e; } @@ -3023,11 +3024,11 @@ template class Package { edges[3] = mEdge::zero(); } auto f = makeDDNode(e.p->v, edges); - + auto temp = cn.lookup(e.w * f.w); // add to the compute table with a weight of 1 f.w = Complex::one(); setMatrixRowsToZero.insert(e, k, f); - f.w = e.w; + f.w = temp; return f; } diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 920af3d0a..2c568e62a 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2098,6 +2098,29 @@ TEST(DDPackageTest, DDMSetRowsToZero) { EXPECT_EQ(dd->setRowsToZero(inputDD, 0), inputDD); } +TEST(DDPackageTest, DDMPECFunctionsNotNormalized) { + const auto nqubits = 2U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = dd::CMat{ + {7, 9, 4, 1}, {3, -51, 0, -10000}, {7, 1, -7, -7}, {7, -1, -7, 1}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + + const auto outputMatrix = dd->setRowsToZero(inputDD, 1); + const auto expectedMatrix = + dd::CMat{{7, 9, 4, 1}, {0, 0, 0, 0}, {7, 1, -7, -7}, {0, 0, 0, 0}}; + EXPECT_EQ(outputMatrix, dd->makeDDFromMatrix(expectedMatrix)); + + const auto outputMatrix2 = dd->setColumnsToZero(inputDD, 1); + const auto expectedMatrix2 = + dd::CMat{{7, 0, 4, 0}, {3, 0, 0, 0}, {7, 0, -7, 0}, {7, 0, -7, 0}}; + EXPECT_EQ(outputMatrix2, dd->makeDDFromMatrix(expectedMatrix2)); + + const auto outputMatrix3 = dd->shiftAllRows(outputMatrix2, 1); + const auto expectedMatrix3 = + dd::CMat{{7, 0, 4, 0}, {3, 0, 0, 0}, {0, 7, 0, -7}, {0, 7, 0, -7}}; + EXPECT_EQ(outputMatrix3, dd->makeDDFromMatrix(expectedMatrix3)); +} + TEST(DDPackageTest, DDMPartialEquivalenceCheckingTrivialEquivalence) { const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); From 1ba5ed1b240e226aeec45e803287b8397c5d07b4 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 11 Dec 2023 14:31:02 +0100 Subject: [PATCH 16/51] :bug::zap: Added two compute tables and fixed the elements added to the compute tables --- include/dd/Package.hpp | 70 +++++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 22 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 87ed08278..f4c939fad 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2891,6 +2891,8 @@ template class Package { return newedge; } + ComputeTable shiftAllMatrixRows{}; + /** Equally divides the rows of the matrix represented by e intro 2^m parts. For the i-th part (i starts from 0), right shifts the contents for (i + @@ -2905,6 +2907,16 @@ template class Package { if (m == 0 && offset == 0) { return e; } + mEdge eCopy{e.p, Complex::one()}; + // check if it's in the compute table with an edge weight of one + // only store elements in the compute table if the offset is 0 + if (offset == 0) { + if (const auto* r = shiftAllMatrixRows.lookup(eCopy, m); r != nullptr) { + auto f = *r; + f.w = cn.lookup(e.w * f.w); + return f; + } + } // the matrix of the current DD has dimensions 2^h x 2^h const auto h = e.p->v + 1; const auto mDecremented = (m > 0 ? m - 1 : 0); @@ -2933,6 +2945,10 @@ template class Package { } } auto f = makeDDNode(e.p->v, edges); + // add to the compute table with a weight of 1 + if (offset == 0) { + shiftAllMatrixRows.insert(eCopy, m, f); + } f.w = cn.lookup(e.w * f.w); return f; } @@ -2962,12 +2978,11 @@ template class Package { if (k == 0) { return e; } + mEdge eCopy{e.p, Complex::one()}; // check if it's in the compute table with an edge weight of one - if (const auto* r = - setMatrixColumnsToZero.lookup(mEdge{e.p, Complex::one()}, k); - r != nullptr) { + if (const auto* r = setMatrixColumnsToZero.lookup(eCopy, k); r != nullptr) { auto f = *r; - f.w = e.w; + f.w = cn.lookup(e.w * f.w); return f; } // the matrix of the current DD has dimensions 2^h x 2^h @@ -2983,11 +2998,9 @@ template class Package { edges[3] = mEdge::zero(); } auto f = makeDDNode(e.p->v, edges); - auto temp = cn.lookup(e.w * f.w); // add to the compute table with a weight of 1 - f.w = Complex::one(); - setMatrixColumnsToZero.insert(e, k, f); - f.w = temp; + setMatrixColumnsToZero.insert(eCopy, k, f); + f.w = cn.lookup(e.w * f.w); return f; } @@ -3003,12 +3016,11 @@ template class Package { if (k == 0) { return e; } + mEdge eCopy{e.p, Complex::one()}; // check if it's in the compute table with an edge weight of one - if (const auto* r = - setMatrixRowsToZero.lookup(mEdge{e.p, Complex::one()}, k); - r != nullptr) { + if (const auto* r = setMatrixRowsToZero.lookup(eCopy, k); r != nullptr) { auto f = *r; - f.w = e.w; + f.w = cn.lookup(e.w * f.w); return f; } // the matrix of the current DD has dimensions 2^h x 2^h @@ -3024,11 +3036,9 @@ template class Package { edges[3] = mEdge::zero(); } auto f = makeDDNode(e.p->v, edges); - auto temp = cn.lookup(e.w * f.w); // add to the compute table with a weight of 1 - f.w = Complex::one(); - setMatrixRowsToZero.insert(e, k, f); - f.w = temp; + setMatrixRowsToZero.insert(eCopy, k, f); + f.w = cn.lookup(e.w * f.w); return f; } @@ -3051,17 +3061,33 @@ template class Package { return u5; } - bool zeroAncillaPartialEquivalenceCheckSubroutine(mEdge u, Qubit m) { - if (u.isTerminal()) { + ComputeTable + zeroAncillaPartialEquivalenceCheckSubroutineComputeTable{}; + + bool zeroAncillaPartialEquivalenceCheckSubroutine(mEdge e, Qubit m) { + if (e.isTerminal()) { return m < 1; } if (m == 0) { return true; } - - return u.p->e[1].isZeroTerminal() && u.p->e[2].isZeroTerminal() && - zeroAncillaPartialEquivalenceCheckSubroutine(u.p->e[0], m - 1) && - zeroAncillaPartialEquivalenceCheckSubroutine(u.p->e[3], m - 1); + mEdge eCopy{e.p, Complex::one()}; + // check if it's in the compute table with an edge weight of one + if (const auto* r = + zeroAncillaPartialEquivalenceCheckSubroutineComputeTable.lookup( + eCopy, m); + r != nullptr) { + auto f = *r; + return f; + } + bool result = + e.p->e[1].isZeroTerminal() && e.p->e[2].isZeroTerminal() && + zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[0], m - 1) && + zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[3], m - 1); + // add to the compute table with a weight of 1 + zeroAncillaPartialEquivalenceCheckSubroutineComputeTable.insert(eCopy, m, + result); + return result; } public: From c10d4505c92beb18a300c63705d9dfaec8d15e6c Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 11 Dec 2023 15:02:13 +0100 Subject: [PATCH 17/51] :white_check_mark: added tests and benchmarks for partialEquivalenceCheck --- test/circuits/Grover_1.qasm | 68 + test/circuits/Grover_2.qasm | 92 + test/circuits/add6_196_1.qasm | 245 ++ test/circuits/add6_196_2.qasm | 270 ++ test/circuits/bv_1.qasm | 33 + test/circuits/bv_2.qasm | 66 + test/circuits/entanglement_1.qasm | 14 + test/circuits/entanglement_2.qasm | 46 + .../grover-noancilla_indep_qiskit_3.qasm | 18 + ...ancilla_nativegates_ibm_qiskit_opt0_3.qasm | 58 + ...ancilla_nativegates_ibm_qiskit_opt0_7.qasm | 3762 +++++++++++++++++ ...ancilla_nativegates_ibm_qiskit_opt1_7.qasm | 3600 ++++++++++++++++ test/circuits/period_finding_1.qasm | 407 ++ test/circuits/period_finding_2.qasm | 449 ++ test/circuits/qpeexact_indep_qiskit_30.qasm | 517 +++ ...eexact_nativegates_ibm_qiskit_opt0_30.qasm | 2398 +++++++++++ test/circuits/random_1.qasm | 154 + test/circuits/random_2.qasm | 532 +++ test/dd/test_package.cpp | 156 +- 19 files changed, 12884 insertions(+), 1 deletion(-) create mode 100644 test/circuits/Grover_1.qasm create mode 100644 test/circuits/Grover_2.qasm create mode 100644 test/circuits/add6_196_1.qasm create mode 100644 test/circuits/add6_196_2.qasm create mode 100644 test/circuits/bv_1.qasm create mode 100644 test/circuits/bv_2.qasm create mode 100644 test/circuits/entanglement_1.qasm create mode 100644 test/circuits/entanglement_2.qasm create mode 100644 test/circuits/grover-noancilla_indep_qiskit_3.qasm create mode 100644 test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm create mode 100644 test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm create mode 100644 test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm create mode 100644 test/circuits/period_finding_1.qasm create mode 100644 test/circuits/period_finding_2.qasm create mode 100644 test/circuits/qpeexact_indep_qiskit_30.qasm create mode 100644 test/circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm create mode 100644 test/circuits/random_1.qasm create mode 100644 test/circuits/random_2.qasm diff --git a/test/circuits/Grover_1.qasm b/test/circuits/Grover_1.qasm new file mode 100644 index 000000000..f7d74e5d0 --- /dev/null +++ b/test/circuits/Grover_1.qasm @@ -0,0 +1,68 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[11]; +x q[10]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; +h q[9]; +h q[10]; +mcx q[0], q[10]; +mcx q[0], q[1], q[10]; +mcx q[0], q[1], q[2], q[10]; +mcx q[0], q[1], q[2], q[3], q[10]; +mcx q[0], q[1], q[2], q[3], q[4], q[10]; +mcx q[0], q[1], q[2], q[3], q[4], q[5], q[10]; +mcx q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[10]; +mcx q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[7], q[10]; +mcx q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[7], q[8], q[10]; +mcx q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[7], q[8], q[9], q[10]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; +h q[9]; +x q[0]; +x q[1]; +x q[2]; +x q[3]; +x q[4]; +x q[5]; +x q[6]; +x q[7]; +x q[8]; +x q[9]; +h q[9]; +mcx q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[7], q[8], q[9]; +h q[9]; +x q[0]; +x q[1]; +x q[2]; +x q[3]; +x q[4]; +x q[5]; +x q[6]; +x q[7]; +x q[8]; +x q[9]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; +h q[9]; diff --git a/test/circuits/Grover_2.qasm b/test/circuits/Grover_2.qasm new file mode 100644 index 000000000..038b42667 --- /dev/null +++ b/test/circuits/Grover_2.qasm @@ -0,0 +1,92 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[12]; +swap q[10], q[11]; +swap q[9], q[10]; +swap q[8], q[9]; +swap q[7], q[8]; +swap q[6], q[7]; +swap q[5], q[6]; +swap q[4], q[5]; +swap q[3], q[4]; +swap q[2], q[3]; +swap q[1], q[2]; +swap q[0], q[1]; +x q[10]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; +h q[9]; +h q[10]; +mcx q[0], q[10]; +mcx q[0], q[1], q[10]; +mcx q[0], q[1], q[2], q[10]; +mcx q[0], q[1], q[2], q[3], q[10]; +mcx q[0], q[1], q[2], q[3], q[4], q[11]; +mcx q[11], q[10]; +mcx q[5], q[11], q[10]; +mcx q[5], q[6], q[11], q[10]; +mcx q[5], q[6], q[7], q[11], q[10]; +mcx q[5], q[6], q[7], q[8], q[11], q[10]; +mcx q[5], q[6], q[7], q[8], q[9], q[11], q[10]; +mcx q[0], q[1], q[2], q[3], q[4], q[11]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; +h q[9]; +x q[0]; +x q[1]; +x q[2]; +x q[3]; +x q[4]; +x q[5]; +x q[6]; +x q[7]; +x q[8]; +x q[9]; +h q[9]; +mcx q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[7], q[8], q[9]; +h q[9]; +x q[0]; +x q[1]; +x q[2]; +x q[3]; +x q[4]; +x q[5]; +x q[6]; +x q[7]; +x q[8]; +x q[9]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; +h q[9]; +swap q[0], q[1]; +swap q[1], q[2]; +swap q[2], q[3]; +swap q[3], q[4]; +swap q[4], q[5]; +swap q[5], q[6]; +swap q[6], q[7]; +swap q[7], q[8]; +swap q[8], q[9]; +swap q[9], q[10]; +swap q[10], q[11]; diff --git a/test/circuits/add6_196_1.qasm b/test/circuits/add6_196_1.qasm new file mode 100644 index 000000000..90983b6a0 --- /dev/null +++ b/test/circuits/add6_196_1.qasm @@ -0,0 +1,245 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[19]; +creg c[19]; +h q[7]; +h q[8]; +h q[9]; +h q[10]; +h q[11]; +h q[12]; +h q[13]; +h q[14]; +h q[15]; +h q[16]; +h q[17]; +h q[18]; +mcx q[16],q[10],q[9],q[2]; +ccx q[16],q[10],q[4]; +ccx q[16],q[10],q[3]; +ccx q[17],q[11],q[5]; +ccx q[17],q[11],q[4]; +ccx q[17],q[11],q[3]; +ccx q[15],q[9],q[3]; +ccx q[15],q[9],q[2]; +ccx q[15],q[9],q[1]; +ccx q[15],q[9],q[0]; +mcx q[15],q[9],q[8],q[1]; +mcx q[15],q[9],q[8],q[0]; +mcx q[14],q[8],q[7],q[0]; +mcx q[16],q[15],q[10],q[2]; +mcx q[16],q[15],q[10],q[1]; +mcx q[16],q[15],q[14],q[10],q[1]; +mcx q[18],q[12],q[11],q[4]; +mcx q[18],q[12],q[11],q[3]; +mcx q[18],q[12],q[11],q[2]; +mcx q[18],q[12],q[11],q[1]; +mcx q[17],q[11],q[10],q[3]; +mcx q[14],q[13],q[8],q[0]; +ccx q[14],q[8],q[2]; +ccx q[14],q[8],q[1]; +ccx q[13],q[7],q[1]; +ccx q[13],q[7],q[0]; +x q[16]; +mcx q[17],q[16],q[15],q[11],q[8],q[1]; +mcx q[17],q[16],q[11],q[9],q[8],q[1]; +mcx q[17],q[16],q[11],q[3]; +mcx q[18],q[16],q[12],q[11],q[9],q[2]; +mcx q[18],q[16],q[12],q[11],q[9],q[1]; +mcx q[18],q[17],q[16],q[12],q[9],q[2]; +mcx q[18],q[17],q[16],q[12],q[9],q[1]; +x q[10]; +mcx q[18],q[15],q[14],q[12],q[11],q[10],q[7],q[0]; +mcx q[18],q[17],q[15],q[14],q[12],q[10],q[7],q[0]; +mcx q[17],q[11],q[10],q[9],q[8],q[1]; +mcx q[17],q[15],q[11],q[10],q[8],q[1]; +ccx q[16],q[10],q[4]; +x q[17]; +mcx q[18],q[17],q[12],q[4]; +mcx q[18],q[17],q[15],q[14],q[12],q[10],q[1]; +mcx q[18],q[17],q[15],q[12],q[10],q[8],q[7],q[0]; +mcx q[18],q[17],q[12],q[10],q[9],q[2]; +mcx q[18],q[17],q[12],q[10],q[9],q[1]; +mcx q[18],q[17],q[12],q[10],q[9],q[0]; +mcx q[18],q[17],q[12],q[10],q[9],q[8],q[1]; +mcx q[18],q[17],q[15],q[12],q[10],q[2]; +mcx q[18],q[17],q[15],q[12],q[10],q[1]; +mcx q[18],q[17],q[12],q[10],q[3]; +mcx q[18],q[17],q[14],q[13],q[12],q[10],q[9],q[0]; +x q[10]; +mcx q[18],q[17],q[16],q[12],q[3]; +mcx q[18],q[17],q[16],q[12],q[0]; +mcx q[18],q[17],q[16],q[15],q[12],q[2]; +mcx q[18],q[17],q[16],q[15],q[12],q[1]; +mcx q[18],q[17],q[16],q[15],q[12],q[0]; +x q[11]; +mcx q[18],q[12],q[11],q[10],q[3]; +mcx q[18],q[15],q[12],q[11],q[10],q[2]; +mcx q[18],q[15],q[12],q[11],q[10],q[1]; +x q[10]; +mcx q[18],q[12],q[11],q[10],q[9],q[2]; +mcx q[18],q[15],q[14],q[12],q[11],q[10],q[1]; +mcx q[18],q[14],q[12],q[11],q[10],q[9],q[7],q[0]; +mcx q[18],q[15],q[12],q[11],q[10],q[8],q[7],q[0]; +mcx q[18],q[15],q[13],q[12],q[11],q[10],q[8],q[0]; +mcx q[18],q[16],q[12],q[11],q[3]; +mcx q[18],q[16],q[12],q[11],q[2]; +mcx q[18],q[16],q[12],q[11],q[1]; +ccx q[17],q[11],q[5]; +x q[13]; +mcx q[15],q[14],q[13],q[9],q[0]; +mcx q[15],q[13],q[9],q[8],q[0]; +mcx q[18],q[17],q[13],q[12],q[10],q[9],q[8],q[0]; +x q[10]; +mcx q[18],q[13],q[12],q[11],q[10],q[9],q[8],q[0]; +mcx q[18],q[16],q[15],q[13],q[12],q[11],q[8],q[0]; +x q[16]; +mcx q[18],q[16],q[13],q[12],q[11],q[9],q[8],q[0]; +x q[14]; +mcx q[16],q[14],q[10],q[9],q[1]; +mcx q[15],q[14],q[9],q[1]; +x q[10]; +mcx q[18],q[17],q[15],q[14],q[13],q[12],q[10],q[0]; +mcx q[18],q[17],q[15],q[14],q[12],q[10],q[0]; +mcx q[18],q[17],q[14],q[12],q[10],q[9],q[7],q[0]; +mcx q[18],q[17],q[14],q[12],q[10],q[9],q[1]; +mcx q[18],q[14],q[12],q[11],q[10],q[9],q[1]; +x q[10]; +mcx q[16],q[14],q[13],q[10],q[9],q[0]; +mcx q[16],q[15],q[14],q[13],q[10],q[0]; +x q[16]; +mcx q[18],q[17],q[16],q[14],q[13],q[12],q[9],q[0]; +mcx q[18],q[17],q[16],q[15],q[14],q[13],q[12],q[0]; +x q[7]; +x q[10]; +mcx q[18],q[12],q[11],q[10],q[9],q[8],q[7],q[0]; +ccx q[13],q[7],q[1]; +x q[13]; +mcx q[15],q[14],q[9],q[7],q[0]; +x q[8]; +mcx q[18],q[16],q[15],q[12],q[11],q[8],q[1]; +mcx q[18],q[16],q[12],q[11],q[9],q[8],q[1]; +mcx q[18],q[17],q[16],q[12],q[9],q[8],q[1]; +mcx q[18],q[17],q[16],q[12],q[9],q[8],q[0]; +mcx q[18],q[17],q[16],q[15],q[12],q[8],q[1]; +mcx q[18],q[17],q[16],q[15],q[12],q[8],q[0]; +mcx q[18],q[17],q[15],q[13],q[12],q[10],q[8],q[0]; +mcx q[18],q[17],q[15],q[12],q[10],q[8],q[1]; +mcx q[15],q[9],q[8],q[7],q[0]; +mcx q[15],q[9],q[8],q[0]; +mcx q[18],q[16],q[15],q[12],q[11],q[8],q[7],q[0]; +mcx q[18],q[17],q[16],q[15],q[12],q[8],q[7],q[0]; +mcx q[18],q[17],q[16],q[12],q[9],q[8],q[7],q[0]; +mcx q[18],q[17],q[12],q[10],q[9],q[8],q[7],q[0]; +x q[17]; +mcx q[18],q[16],q[12],q[11],q[9],q[8],q[7],q[0]; +x q[11]; +ccx q[14],q[8],q[2]; +x q[15]; +mcx q[17],q[15],q[11],q[10],q[2]; +mcx q[17],q[15],q[11],q[10],q[7],q[0]; +mcx q[17],q[16],q[15],q[14],q[11],q[7],q[0]; +x q[7]; +mcx q[17],q[15],q[11],q[10],q[8],q[7],q[0]; +mcx q[17],q[15],q[14],q[11],q[10],q[0]; +mcx q[17],q[15],q[14],q[13],q[11],q[10],q[0]; +mcx q[17],q[16],q[15],q[11],q[2]; +x q[14]; +mcx q[17],q[15],q[14],q[11],q[10],q[1]; +mcx q[17],q[16],q[15],q[14],q[11],q[1]; +mcx q[17],q[16],q[15],q[11],q[8],q[7],q[0]; +mcx q[17],q[16],q[15],q[13],q[11],q[8],q[0]; +x q[16]; +mcx q[17],q[15],q[13],q[11],q[10],q[8],q[0]; +x q[10]; +mcx q[16],q[15],q[10],q[8],q[1]; +x q[7]; +mcx q[16],q[15],q[14],q[10],q[7],q[0]; +mcx q[17],q[15],q[14],q[11],q[10],q[7],q[0]; +mcx q[17],q[15],q[14],q[11],q[7],q[0]; +x q[13]; +mcx q[16],q[15],q[10],q[8],q[7],q[0]; +mcx q[16],q[15],q[10],q[7],q[0]; +mcx q[16],q[15],q[13],q[10],q[8],q[0]; +x q[16]; +mcx q[17],q[16],q[15],q[14],q[13],q[11],q[0]; +mcx q[17],q[16],q[15],q[13],q[11],q[0]; +x q[16]; +x q[13]; +x q[11]; +mcx q[18],q[16],q[15],q[12],q[11],q[2]; +mcx q[18],q[16],q[15],q[12],q[11],q[1]; +mcx q[18],q[15],q[14],q[13],q[12],q[11],q[10],q[0]; +mcx q[18],q[16],q[15],q[14],q[13],q[12],q[11],q[0]; +mcx q[18],q[15],q[12],q[11],q[10],q[8],q[1]; +mcx q[18],q[15],q[12],q[11],q[8],q[1]; +x q[16]; +mcx q[18],q[16],q[15],q[14],q[12],q[11],q[1]; +mcx q[18],q[16],q[15],q[14],q[12],q[11],q[0]; +mcx q[18],q[16],q[15],q[14],q[12],q[11],q[7],q[0]; +mcx q[18],q[16],q[15],q[12],q[11],q[7],q[0]; +x q[11]; +x q[17]; +mcx q[18],q[17],q[16],q[15],q[14],q[12],q[1]; +mcx q[18],q[17],q[16],q[15],q[13],q[12],q[8],q[0]; +mcx q[18],q[17],q[16],q[15],q[14],q[12],q[7],q[0]; +x q[7]; +mcx q[18],q[17],q[16],q[15],q[12],q[7],q[0]; +x q[17]; +x q[9]; +mcx q[17],q[16],q[11],q[9],q[2]; +mcx q[17],q[16],q[11],q[9],q[8],q[7],q[0]; +mcx q[17],q[16],q[11],q[9],q[7],q[0]; +mcx q[17],q[16],q[14],q[11],q[9],q[7],q[0]; +mcx q[17],q[16],q[14],q[11],q[9],q[1]; +mcx q[17],q[16],q[13],q[11],q[9],q[8],q[0]; +x q[16]; +mcx q[16],q[13],q[10],q[9],q[8],q[0]; +mcx q[16],q[10],q[9],q[8],q[1]; +mcx q[16],q[10],q[9],q[8],q[0]; +x q[8]; +ccx q[15],q[9],q[3]; +x q[7]; +mcx q[16],q[10],q[9],q[8],q[7],q[0]; +mcx q[16],q[14],q[10],q[9],q[7],q[0]; +x q[10]; +mcx q[17],q[11],q[10],q[9],q[2]; +mcx q[17],q[14],q[11],q[10],q[9],q[1]; +mcx q[17],q[14],q[11],q[10],q[9],q[0]; +mcx q[17],q[11],q[10],q[9],q[8],q[7],q[0]; +mcx q[17],q[14],q[11],q[10],q[9],q[7],q[0]; +mcx q[17],q[11],q[10],q[9],q[8],q[0]; +x q[8]; +mcx q[17],q[13],q[11],q[10],q[9],q[8],q[0]; +x q[14]; +mcx q[17],q[16],q[14],q[13],q[11],q[9],q[0]; +mcx q[17],q[14],q[13],q[11],q[10],q[9],q[0]; +mcx q[17],q[14],q[13],q[11],q[9],q[0]; +x q[14]; +x q[11]; +x q[16]; +mcx q[18],q[16],q[14],q[12],q[11],q[9],q[1]; +mcx q[18],q[16],q[14],q[12],q[11],q[9],q[0]; +mcx q[18],q[16],q[14],q[13],q[12],q[11],q[9],q[0]; +mcx q[18],q[14],q[13],q[12],q[11],q[10],q[9],q[0]; +mcx q[18],q[12],q[11],q[10],q[9],q[8],q[1]; +x q[17]; +mcx q[18],q[17],q[16],q[14],q[12],q[9],q[1]; +mcx q[18],q[17],q[16],q[13],q[12],q[9],q[8],q[0]; +x q[14]; +mcx q[18],q[16],q[14],q[12],q[11],q[9],q[7],q[0]; +mcx q[18],q[17],q[16],q[14],q[12],q[9],q[7],q[0]; +x q[12]; +cx q[12],q[6]; +ccx q[18],q[12],q[5]; +ccx q[18],q[12],q[4]; +ccx q[18],q[12],q[3]; +ccx q[18],q[12],q[2]; +ccx q[18],q[12],q[1]; +x q[18]; +cx q[18],q[6]; +cx q[18],q[5]; +cx q[18],q[4]; +cx q[18],q[3]; +cx q[18],q[2]; +cx q[18],q[1]; diff --git a/test/circuits/add6_196_2.qasm b/test/circuits/add6_196_2.qasm new file mode 100644 index 000000000..08e70c01a --- /dev/null +++ b/test/circuits/add6_196_2.qasm @@ -0,0 +1,270 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[19]; +creg c[19]; +h q[7]; +h q[8]; +h q[9]; +h q[10]; +h q[11]; +h q[12]; +h q[13]; +h q[14]; +h q[15]; +h q[16]; +h q[17]; +h q[18]; +mcx q[16],q[10],q[9],q[2]; +ccx q[16],q[10],q[4]; +ccx q[16],q[10],q[3]; +ccx q[17],q[11],q[5]; +ccx q[17],q[11],q[4]; +ccx q[17],q[11],q[3]; +ccx q[15],q[9],q[3]; +ccx q[15],q[9],q[2]; +ccx q[15],q[9],q[1]; +ccx q[15],q[9],q[0]; +mcx q[15],q[9],q[8],q[1]; +mcx q[15],q[9],q[8],q[0]; +mcx q[14],q[8],q[7],q[0]; +mcx q[16],q[15],q[10],q[2]; +mcx q[16],q[15],q[10],q[1]; +mcx q[16],q[15],q[14],q[10],q[1]; +mcx q[18],q[12],q[11],q[4]; +mcx q[18],q[12],q[11],q[3]; +mcx q[18],q[12],q[11],q[2]; +mcx q[18],q[12],q[11],q[1]; +mcx q[17],q[11],q[10],q[3]; +mcx q[14],q[13],q[8],q[0]; +ccx q[14],q[8],q[2]; +ccx q[14],q[8],q[1]; +ccx q[13],q[7],q[1]; +ccx q[13],q[7],q[0]; +x q[16]; +mcx q[17],q[16],q[15],q[11],q[8],q[1]; +mcx q[17],q[16],q[11],q[9],q[8],q[1]; +mcx q[17],q[16],q[11],q[3]; +mcx q[18],q[16],q[12],q[11],q[9],q[2]; +mcx q[18],q[16],q[12],q[11],q[9],q[1]; +mcx q[18],q[17],q[16],q[12],q[9],q[2]; +mcx q[18],q[17],q[16],q[12],q[9],q[1]; +x q[10]; +mcx q[18],q[15],q[14],q[12],q[11],q[10],q[7],q[0]; +mcx q[18],q[17],q[15],q[14],q[12],q[10],q[7],q[0]; +mcx q[17],q[11],q[10],q[9],q[8],q[1]; +mcx q[17],q[15],q[11],q[10],q[8],q[1]; +ccx q[16],q[10],q[4]; +x q[17]; +mcx q[18],q[17],q[12],q[4]; +mcx q[18],q[17],q[15],q[14],q[12],q[10],q[1]; +mcx q[18],q[17],q[15],q[12],q[10],q[8],q[7],q[0]; +mcx q[18],q[17],q[12],q[10],q[9],q[2]; +mcx q[18],q[17],q[12],q[10],q[9],q[1]; +mcx q[18],q[17],q[12],q[10],q[9],q[0]; +mcx q[18],q[17],q[12],q[10],q[9],q[8],q[1]; +mcx q[18],q[17],q[15],q[12],q[10],q[2]; +mcx q[18],q[17],q[15],q[12],q[10],q[1]; +mcx q[18],q[17],q[12],q[10],q[3]; +mcx q[18],q[17],q[14],q[13],q[12],q[10],q[9],q[0]; +x q[10]; +mcx q[18],q[17],q[16],q[12],q[3]; +mcx q[18],q[17],q[16],q[12],q[0]; +mcx q[18],q[17],q[16],q[15],q[12],q[2]; +mcx q[18],q[17],q[16],q[15],q[12],q[1]; +mcx q[18],q[17],q[16],q[15],q[12],q[0]; +x q[11]; +mcx q[18],q[12],q[11],q[10],q[3]; +mcx q[18],q[15],q[12],q[11],q[10],q[2]; +mcx q[18],q[15],q[12],q[11],q[10],q[1]; +x q[10]; +mcx q[18],q[12],q[11],q[10],q[9],q[2]; +mcx q[18],q[15],q[14],q[12],q[11],q[10],q[1]; +mcx q[18],q[14],q[12],q[11],q[10],q[9],q[7],q[0]; +mcx q[18],q[15],q[12],q[11],q[10],q[8],q[7],q[0]; +mcx q[18],q[15],q[13],q[12],q[11],q[10],q[8],q[0]; +mcx q[18],q[16],q[12],q[11],q[3]; +mcx q[18],q[16],q[12],q[11],q[2]; +mcx q[18],q[16],q[12],q[11],q[1]; +ccx q[17],q[11],q[5]; +x q[13]; +mcx q[15],q[14],q[13],q[9],q[0]; +mcx q[15],q[13],q[9],q[8],q[0]; +mcx q[18],q[17],q[13],q[12],q[10],q[9],q[8],q[0]; +x q[10]; +mcx q[18],q[13],q[12],q[11],q[10],q[9],q[8],q[0]; +mcx q[18],q[16],q[15],q[13],q[12],q[11],q[8],q[0]; +x q[16]; +mcx q[18],q[16],q[13],q[12],q[11],q[9],q[8],q[0]; +x q[14]; +mcx q[16],q[14],q[10],q[9],q[1]; +mcx q[15],q[14],q[9],q[1]; +x q[10]; +mcx q[18],q[17],q[15],q[14],q[13],q[12],q[10],q[0]; +mcx q[18],q[17],q[15],q[14],q[12],q[10],q[0]; +mcx q[18],q[17],q[14],q[12],q[10],q[9],q[7],q[0]; +mcx q[18],q[17],q[14],q[12],q[10],q[9],q[1]; +mcx q[18],q[14],q[12],q[11],q[10],q[9],q[1]; +x q[10]; +mcx q[16],q[14],q[13],q[10],q[9],q[0]; +mcx q[16],q[15],q[14],q[13],q[10],q[0]; +x q[16]; +mcx q[18],q[17],q[16],q[14],q[13],q[12],q[9],q[0]; +mcx q[18],q[17],q[16],q[15],q[14],q[13],q[12],q[0]; +x q[7]; +x q[10]; +mcx q[18],q[12],q[11],q[10],q[9],q[8],q[7],q[0]; +ccx q[13],q[7],q[1]; +x q[13]; +mcx q[15],q[14],q[9],q[7],q[0]; +x q[8]; +mcx q[18],q[16],q[15],q[12],q[11],q[8],q[1]; +mcx q[18],q[16],q[12],q[11],q[9],q[8],q[1]; +mcx q[18],q[17],q[16],q[12],q[9],q[8],q[1]; +mcx q[18],q[17],q[16],q[12],q[9],q[8],q[0]; +mcx q[18],q[17],q[16],q[15],q[12],q[8],q[1]; +mcx q[18],q[17],q[16],q[15],q[12],q[8],q[0]; +mcx q[18],q[17],q[15],q[13],q[12],q[10],q[8],q[0]; +mcx q[18],q[17],q[15],q[12],q[10],q[8],q[1]; +mcx q[15],q[9],q[8],q[7],q[0]; +mcx q[15],q[9],q[8],q[0]; +mcx q[18],q[16],q[15],q[12],q[11],q[8],q[7],q[0]; +mcx q[18],q[17],q[16],q[15],q[12],q[8],q[7],q[0]; +mcx q[18],q[17],q[16],q[12],q[9],q[8],q[7],q[0]; +mcx q[18],q[17],q[12],q[10],q[9],q[8],q[7],q[0]; +x q[17]; +mcx q[18],q[16],q[12],q[11],q[9],q[8],q[7],q[0]; +x q[11]; +ccx q[14],q[8],q[2]; +x q[15]; +mcx q[17],q[15],q[11],q[10],q[2]; +mcx q[17],q[15],q[11],q[10],q[7],q[0]; +mcx q[17],q[16],q[15],q[14],q[11],q[7],q[0]; +x q[7]; +mcx q[17],q[15],q[11],q[10],q[8],q[7],q[0]; +mcx q[17],q[15],q[14],q[11],q[10],q[0]; +mcx q[17],q[15],q[14],q[13],q[11],q[10],q[0]; +mcx q[17],q[16],q[15],q[11],q[2]; +x q[14]; +mcx q[17],q[15],q[14],q[11],q[10],q[1]; +mcx q[17],q[16],q[15],q[14],q[11],q[1]; +mcx q[17],q[16],q[15],q[11],q[8],q[7],q[0]; +mcx q[17],q[16],q[15],q[13],q[11],q[8],q[0]; +x q[16]; +mcx q[17],q[15],q[13],q[11],q[10],q[8],q[0]; +x q[10]; +mcx q[16],q[15],q[10],q[8],q[1]; +x q[7]; +mcx q[16],q[15],q[14],q[10],q[7],q[0]; +mcx q[17],q[15],q[14],q[11],q[10],q[7],q[0]; +mcx q[17],q[15],q[14],q[11],q[7],q[0]; +x q[13]; +mcx q[16],q[15],q[10],q[8],q[7],q[0]; +mcx q[16],q[15],q[10],q[7],q[0]; +mcx q[16],q[15],q[13],q[10],q[8],q[0]; +x q[16]; +mcx q[17],q[16],q[15],q[14],q[13],q[11],q[0]; +mcx q[17],q[16],q[15],q[13],q[11],q[0]; +x q[16]; +x q[13]; +x q[11]; +mcx q[18],q[16],q[15],q[12],q[11],q[2]; +mcx q[18],q[16],q[15],q[12],q[11],q[1]; +mcx q[18],q[15],q[14],q[13],q[12],q[11],q[10],q[0]; +mcx q[18],q[16],q[15],q[14],q[13],q[12],q[11],q[0]; +mcx q[18],q[15],q[12],q[11],q[10],q[8],q[1]; +mcx q[18],q[15],q[12],q[11],q[8],q[1]; +x q[16]; +mcx q[18],q[16],q[15],q[14],q[12],q[11],q[1]; +mcx q[18],q[16],q[15],q[14],q[12],q[11],q[0]; +mcx q[18],q[16],q[15],q[14],q[12],q[11],q[7],q[0]; +mcx q[18],q[16],q[15],q[12],q[11],q[7],q[0]; +x q[11]; +x q[17]; +mcx q[18],q[17],q[16],q[15],q[14],q[12],q[1]; +mcx q[18],q[17],q[16],q[15],q[13],q[12],q[8],q[0]; +mcx q[18],q[17],q[16],q[15],q[14],q[12],q[7],q[0]; +x q[7]; +mcx q[18],q[17],q[16],q[15],q[12],q[7],q[0]; +x q[17]; +x q[9]; +mcx q[17],q[16],q[11],q[9],q[2]; +mcx q[17],q[16],q[11],q[9],q[8],q[7],q[0]; +mcx q[17],q[16],q[11],q[9],q[7],q[0]; +mcx q[17],q[16],q[14],q[11],q[9],q[7],q[0]; +mcx q[17],q[16],q[14],q[11],q[9],q[1]; +mcx q[17],q[16],q[13],q[11],q[9],q[8],q[0]; +x q[16]; +mcx q[16],q[13],q[10],q[9],q[8],q[0]; +mcx q[16],q[10],q[9],q[8],q[1]; +mcx q[16],q[10],q[9],q[8],q[0]; +x q[8]; +ccx q[15],q[9],q[3]; +x q[7]; +mcx q[16],q[10],q[9],q[8],q[7],q[0]; +mcx q[16],q[14],q[10],q[9],q[7],q[0]; +x q[10]; +mcx q[17],q[11],q[10],q[9],q[2]; +mcx q[17],q[14],q[11],q[10],q[9],q[1]; +mcx q[17],q[14],q[11],q[10],q[9],q[0]; +mcx q[17],q[11],q[10],q[9],q[8],q[7],q[0]; +mcx q[17],q[14],q[11],q[10],q[9],q[7],q[0]; +mcx q[17],q[11],q[10],q[9],q[8],q[0]; +x q[8]; +mcx q[17],q[13],q[11],q[10],q[9],q[8],q[0]; +x q[14]; +mcx q[17],q[16],q[14],q[13],q[11],q[9],q[0]; +mcx q[17],q[14],q[13],q[11],q[10],q[9],q[0]; +mcx q[17],q[14],q[13],q[11],q[9],q[0]; +x q[14]; +x q[11]; +x q[16]; +mcx q[18],q[16],q[14],q[12],q[11],q[9],q[1]; +mcx q[18],q[16],q[14],q[12],q[11],q[9],q[0]; +mcx q[18],q[16],q[14],q[13],q[12],q[11],q[9],q[0]; +mcx q[18],q[14],q[13],q[12],q[11],q[10],q[9],q[0]; +mcx q[18],q[12],q[11],q[10],q[9],q[8],q[1]; +x q[17]; +mcx q[18],q[17],q[16],q[14],q[12],q[9],q[1]; +mcx q[18],q[17],q[16],q[13],q[12],q[9],q[8],q[0]; +x q[14]; +mcx q[18],q[16],q[14],q[12],q[11],q[9],q[7],q[0]; +mcx q[18],q[17],q[16],q[14],q[12],q[9],q[7],q[0]; +x q[12]; +h q[12]; +h q[6]; +cx q[6], q[12]; +h q[12]; +h q[6]; +ccx q[18],q[12],q[5]; +ccx q[18],q[12],q[4]; +ccx q[18],q[12],q[3]; +ccx q[18],q[12],q[2]; +ccx q[18],q[12],q[1]; +x q[18]; +cx q[18], q[12]; +cx q[12], q[6]; +cx q[18], q[12]; +cx q[12], q[6]; +h q[18]; +h q[5]; +cx q[5], q[18]; +h q[18]; +h q[5]; +x q[16]; +ccx q[16], q[18], q[4]; +x q[16]; +ccx q[16], q[18], q[4]; +h q[18]; +h q[3]; +cx q[3], q[18]; +h q[18]; +h q[3]; +cx q[18], q[10]; +cx q[10], q[2]; +cx q[18], q[10]; +cx q[10], q[2]; +h q[18]; +h q[1]; +cx q[1], q[18]; +h q[18]; +h q[1]; diff --git a/test/circuits/bv_1.qasm b/test/circuits/bv_1.qasm new file mode 100644 index 000000000..1867a792c --- /dev/null +++ b/test/circuits/bv_1.qasm @@ -0,0 +1,33 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[10]; +creg c[10]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; +x q[9]; +h q[9]; +cx q[0], q[9]; +cx q[1], q[9]; +cx q[2], q[9]; +cx q[3], q[9]; +cx q[4], q[9]; +cx q[5], q[9]; +cx q[6], q[9]; +cx q[7], q[9]; +cx q[8], q[9]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; diff --git a/test/circuits/bv_2.qasm b/test/circuits/bv_2.qasm new file mode 100644 index 000000000..a16ae96e3 --- /dev/null +++ b/test/circuits/bv_2.qasm @@ -0,0 +1,66 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[10]; +creg c[10]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; +x q[9]; +h q[9]; +h q[0]; +h q[9]; +cx q[9], q[0]; +h q[0]; +h q[9]; +cx q[1], q[7]; +cx q[7], q[9]; +cx q[1], q[7]; +cx q[7], q[9]; +x q[6]; +ccx q[6], q[2], q[9]; +x q[6]; +ccx q[6], q[2], q[9]; +h q[3]; +h q[9]; +cx q[9], q[3]; +h q[3]; +h q[9]; +h q[4]; +h q[9]; +cx q[9], q[4]; +h q[4]; +h q[9]; +x q[1]; +ccx q[1], q[5], q[9]; +x q[1]; +ccx q[1], q[5], q[9]; +h q[6]; +h q[9]; +cx q[9], q[6]; +h q[6]; +h q[9]; +h q[7]; +h q[9]; +cx q[9], q[7]; +h q[7]; +h q[9]; +h q[8]; +h q[9]; +cx q[9], q[8]; +h q[8]; +h q[9]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; diff --git a/test/circuits/entanglement_1.qasm b/test/circuits/entanglement_1.qasm new file mode 100644 index 000000000..8063a66d3 --- /dev/null +++ b/test/circuits/entanglement_1.qasm @@ -0,0 +1,14 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[10]; +creg c[10]; +h q[0]; +cx q[0], q[1]; +cx q[0], q[2]; +cx q[0], q[3]; +cx q[0], q[4]; +cx q[0], q[5]; +cx q[0], q[6]; +cx q[0], q[7]; +cx q[0], q[8]; +cx q[0], q[9]; diff --git a/test/circuits/entanglement_2.qasm b/test/circuits/entanglement_2.qasm new file mode 100644 index 000000000..3da96b7bb --- /dev/null +++ b/test/circuits/entanglement_2.qasm @@ -0,0 +1,46 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[10]; +creg c[10]; +h q[0]; +x q[2]; +ccx q[2], q[0], q[1]; +x q[2]; +ccx q[2], q[0], q[1]; +h q[0]; +h q[2]; +cx q[2], q[0]; +h q[0]; +h q[2]; +h q[0]; +h q[3]; +cx q[3], q[0]; +h q[0]; +h q[3]; +h q[0]; +h q[4]; +cx q[4], q[0]; +h q[0]; +h q[4]; +h q[0]; +h q[5]; +cx q[5], q[0]; +h q[0]; +h q[5]; +x q[5]; +ccx q[5], q[0], q[6]; +x q[5]; +ccx q[5], q[0], q[6]; +h q[0]; +h q[7]; +cx q[7], q[0]; +h q[0]; +h q[7]; +cx q[0], q[9]; +cx q[9], q[8]; +cx q[0], q[9]; +cx q[9], q[8]; +cx q[0], q[6]; +cx q[6], q[9]; +cx q[0], q[6]; +cx q[6], q[9]; diff --git a/test/circuits/grover-noancilla_indep_qiskit_3.qasm b/test/circuits/grover-noancilla_indep_qiskit_3.qasm new file mode 100644 index 000000000..e818fecf8 --- /dev/null +++ b/test/circuits/grover-noancilla_indep_qiskit_3.qasm @@ -0,0 +1,18 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[2]; +qreg flag[1]; +creg meas[3]; +h q[0]; +h q[1]; +x flag[0]; +cp(pi/2) q[1],flag[0]; +cx q[1],q[0]; +cp(-pi/2) q[0],flag[0]; +cx q[1],q[0]; +cp(pi/2) q[0],flag[0]; +u2(0,0) q[0]; +u1(-pi) q[1]; +cx q[0],q[1]; +u2(-pi,-pi) q[0]; +u1(-pi) q[1]; diff --git a/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm b/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm new file mode 100644 index 000000000..269a58edf --- /dev/null +++ b/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm @@ -0,0 +1,58 @@ +// Benchmark was created by MQT Bench on 2023-06-29 +// For more information about MQT Bench, please visit https://www.cda.cit.tum.de/mqtbench/ +// MQT Bench version: v1.0.0 +// Qiskit version: {'qiskit-terra': '0.24.1', 'qiskit-aer': '0.12.0', 'qiskit-ignis': None, 'qiskit-ibmq-provider': '0.20.2', 'qiskit': '0.43.1', 'qiskit-nature': '0.6.2', 'qiskit-finance': '0.3.4', 'qiskit-optimization': '0.5.0', 'qiskit-machine-learning': '0.6.1'} +// Used Gate Set: ['rz', 'sx', 'x', 'cx', 'measure'] + +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[2]; +qreg flag[1]; +creg meas[3]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +rz(pi/4) q[1]; +x flag[0]; +cx q[1],flag[0]; +rz(-pi/4) flag[0]; +cx q[1],flag[0]; +rz(pi/4) flag[0]; +cx q[1],q[0]; +rz(-pi/4) q[0]; +cx q[0],flag[0]; +rz(pi/4) flag[0]; +cx q[0],flag[0]; +rz(-pi/4) flag[0]; +cx q[1],q[0]; +rz(pi/4) q[0]; +cx q[0],flag[0]; +rz(-pi/4) flag[0]; +cx q[0],flag[0]; +rz(pi/4) flag[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +x q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +x q[1]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +cx q[0],q[1]; +x q[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +x q[1]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; diff --git a/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm b/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm new file mode 100644 index 000000000..c97c98fe8 --- /dev/null +++ b/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm @@ -0,0 +1,3762 @@ +// Benchmark was created by MQT Bench on 2023-06-29 +// For more information about MQT Bench, please visit https://www.cda.cit.tum.de/mqtbench/ +// MQT Bench version: v1.0.0 +// Qiskit version: {'qiskit-terra': '0.24.1', 'qiskit-aer': '0.12.0', 'qiskit-ignis': None, 'qiskit-ibmq-provider': '0.20.2', 'qiskit': '0.43.1', 'qiskit-nature': '0.6.2', 'qiskit-finance': '0.3.4', 'qiskit-optimization': '0.5.0', 'qiskit-machine-learning': '0.6.1'} +// Used Gate Set: ['rz', 'sx', 'x', 'cx', 'measure'] + +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[6]; +qreg flag[1]; +creg meas[7]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/64) q[5]; +x flag[0]; +cx q[5],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],flag[0]; +rz(pi/64) flag[0]; +cx q[5],q[4]; +rz(-pi/64) q[4]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[4]; +rz(pi/64) q[4]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +x q[1]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +x q[2]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +x q[3]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +x q[4]; +rz(pi/32) q[4]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +x q[0]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +x q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[4],q[5]; +rz(-pi/32) q[5]; +cx q[4],q[5]; +cx q[4],q[3]; +rz(-pi/32) q[3]; +rz(pi/32) q[5]; +cx q[3],q[5]; +rz(pi/32) q[5]; +cx q[3],q[5]; +cx q[4],q[3]; +rz(pi/32) q[3]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +x q[1]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +x q[2]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +x q[3]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +x q[4]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +x q[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(pi/32) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +x q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/64) q[5]; +cx q[5],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],flag[0]; +rz(pi/64) flag[0]; +cx q[5],q[4]; +rz(-pi/64) q[4]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[4]; +rz(pi/64) q[4]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +x q[1]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +x q[2]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +x q[3]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +x q[4]; +rz(pi/32) q[4]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +x q[0]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +x q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[4],q[5]; +rz(-pi/32) q[5]; +cx q[4],q[5]; +cx q[4],q[3]; +rz(-pi/32) q[3]; +rz(pi/32) q[5]; +cx q[3],q[5]; +rz(pi/32) q[5]; +cx q[3],q[5]; +cx q[4],q[3]; +rz(pi/32) q[3]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +x q[1]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +x q[2]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +x q[3]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +x q[4]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +x q[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(pi/32) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +x q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/64) q[5]; +cx q[5],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],flag[0]; +rz(pi/64) flag[0]; +cx q[5],q[4]; +rz(-pi/64) q[4]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[4]; +rz(pi/64) q[4]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +x q[1]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +x q[2]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +x q[3]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +x q[4]; +rz(pi/32) q[4]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +x q[0]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +x q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[4],q[5]; +rz(-pi/32) q[5]; +cx q[4],q[5]; +cx q[4],q[3]; +rz(-pi/32) q[3]; +rz(pi/32) q[5]; +cx q[3],q[5]; +rz(pi/32) q[5]; +cx q[3],q[5]; +cx q[4],q[3]; +rz(pi/32) q[3]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +x q[1]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +x q[2]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +x q[3]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +x q[4]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +x q[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(pi/32) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +x q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/64) q[5]; +cx q[5],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],flag[0]; +rz(pi/64) flag[0]; +cx q[5],q[4]; +rz(-pi/64) q[4]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[4]; +rz(pi/64) q[4]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +x q[1]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +x q[2]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +x q[3]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +x q[4]; +rz(pi/32) q[4]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +x q[0]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +x q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[4],q[5]; +rz(-pi/32) q[5]; +cx q[4],q[5]; +cx q[4],q[3]; +rz(-pi/32) q[3]; +rz(pi/32) q[5]; +cx q[3],q[5]; +rz(pi/32) q[5]; +cx q[3],q[5]; +cx q[4],q[3]; +rz(pi/32) q[3]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +x q[1]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +x q[2]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +x q[3]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +x q[4]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +x q[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(pi/32) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +x q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/64) q[5]; +cx q[5],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],flag[0]; +rz(pi/64) flag[0]; +cx q[5],q[4]; +rz(-pi/64) q[4]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[4]; +rz(pi/64) q[4]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +x q[1]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +x q[2]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +x q[3]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +x q[4]; +rz(pi/32) q[4]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +x q[0]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +x q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[4],q[5]; +rz(-pi/32) q[5]; +cx q[4],q[5]; +cx q[4],q[3]; +rz(-pi/32) q[3]; +rz(pi/32) q[5]; +cx q[3],q[5]; +rz(pi/32) q[5]; +cx q[3],q[5]; +cx q[4],q[3]; +rz(pi/32) q[3]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +x q[1]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +x q[2]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +x q[3]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +x q[4]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +x q[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(pi/32) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +x q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/64) q[5]; +cx q[5],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],flag[0]; +rz(pi/64) flag[0]; +cx q[5],q[4]; +rz(-pi/64) q[4]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[4]; +rz(pi/64) q[4]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +x q[1]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +x q[2]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +x q[3]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +x q[4]; +rz(pi/32) q[4]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +x q[0]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +x q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[4],q[5]; +rz(-pi/32) q[5]; +cx q[4],q[5]; +cx q[4],q[3]; +rz(-pi/32) q[3]; +rz(pi/32) q[5]; +cx q[3],q[5]; +rz(pi/32) q[5]; +cx q[3],q[5]; +cx q[4],q[3]; +rz(pi/32) q[3]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +x q[1]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +x q[2]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +x q[3]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +x q[4]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +x q[0]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(pi/32) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +x q[5]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; diff --git a/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm b/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm new file mode 100644 index 000000000..82bd2e2e8 --- /dev/null +++ b/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm @@ -0,0 +1,3600 @@ +// Benchmark was created by MQT Bench on 2023-06-29 +// For more information about MQT Bench, please visit https://www.cda.cit.tum.de/mqtbench/ +// MQT Bench version: v1.0.0 +// Qiskit version: {'qiskit-terra': '0.24.1', 'qiskit-aer': '0.12.0', 'qiskit-ignis': None, 'qiskit-ibmq-provider': '0.20.2', 'qiskit': '0.43.1', 'qiskit-nature': '0.6.2', 'qiskit-finance': '0.3.4', 'qiskit-optimization': '0.5.0', 'qiskit-machine-learning': '0.6.1'} +// Used Gate Set: ['rz', 'sx', 'x', 'cx', 'measure'] + +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[6]; +qreg flag[1]; +creg meas[7]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +rz(pi/2) q[5]; +sx q[5]; +rz(1.619883712007237) q[5]; +x flag[0]; +cx q[5],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],flag[0]; +rz(pi/64) flag[0]; +cx q[5],q[4]; +rz(-pi/64) q[4]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[4]; +rz(pi/64) q[4]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[4]; +sx q[4]; +rz(1.6689710972195773) q[4]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +rz(-pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(-pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[4],q[5]; +rz(-pi/32) q[5]; +cx q[4],q[5]; +cx q[4],q[3]; +rz(-pi/32) q[3]; +rz(pi/32) q[5]; +cx q[3],q[5]; +rz(pi/32) q[5]; +cx q[3],q[5]; +cx q[4],q[3]; +rz(pi/32) q[3]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(-pi/2) q[1]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[2]; +sx q[2]; +rz(-pi/2) q[2]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[3]; +sx q[3]; +rz(-pi/2) q[3]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(pi/2) q[4]; +sx q[4]; +rz(-pi/2) q[4]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(pi/2) q[0]; +sx q[0]; +rz(-pi/2) q[0]; +rz(1.6689710972195773) q[5]; +sx q[5]; +rz(-1.5217089415825567) q[5]; +cx q[5],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],flag[0]; +rz(pi/64) flag[0]; +cx q[5],q[4]; +rz(-pi/64) q[4]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[4]; +rz(pi/64) q[4]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[4]; +sx q[4]; +rz(1.6689710972195773) q[4]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +rz(-pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(-pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[4],q[5]; +rz(-pi/32) q[5]; +cx q[4],q[5]; +cx q[4],q[3]; +rz(-pi/32) q[3]; +rz(pi/32) q[5]; +cx q[3],q[5]; +rz(pi/32) q[5]; +cx q[3],q[5]; +cx q[4],q[3]; +rz(pi/32) q[3]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(-pi/2) q[1]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[2]; +sx q[2]; +rz(-pi/2) q[2]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[3]; +sx q[3]; +rz(-pi/2) q[3]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(pi/2) q[4]; +sx q[4]; +rz(-pi/2) q[4]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(pi/2) q[0]; +sx q[0]; +rz(-pi/2) q[0]; +rz(1.6689710972195773) q[5]; +sx q[5]; +rz(-1.5217089415825567) q[5]; +cx q[5],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],flag[0]; +rz(pi/64) flag[0]; +cx q[5],q[4]; +rz(-pi/64) q[4]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[4]; +rz(pi/64) q[4]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[4]; +sx q[4]; +rz(1.6689710972195773) q[4]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +rz(-pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(-pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[4],q[5]; +rz(-pi/32) q[5]; +cx q[4],q[5]; +cx q[4],q[3]; +rz(-pi/32) q[3]; +rz(pi/32) q[5]; +cx q[3],q[5]; +rz(pi/32) q[5]; +cx q[3],q[5]; +cx q[4],q[3]; +rz(pi/32) q[3]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(-pi/2) q[1]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[2]; +sx q[2]; +rz(-pi/2) q[2]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[3]; +sx q[3]; +rz(-pi/2) q[3]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(pi/2) q[4]; +sx q[4]; +rz(-pi/2) q[4]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(pi/2) q[0]; +sx q[0]; +rz(-pi/2) q[0]; +rz(1.6689710972195773) q[5]; +sx q[5]; +rz(-1.5217089415825567) q[5]; +cx q[5],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],flag[0]; +rz(pi/64) flag[0]; +cx q[5],q[4]; +rz(-pi/64) q[4]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[4]; +rz(pi/64) q[4]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[4]; +sx q[4]; +rz(1.6689710972195773) q[4]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +rz(-pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(-pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[4],q[5]; +rz(-pi/32) q[5]; +cx q[4],q[5]; +cx q[4],q[3]; +rz(-pi/32) q[3]; +rz(pi/32) q[5]; +cx q[3],q[5]; +rz(pi/32) q[5]; +cx q[3],q[5]; +cx q[4],q[3]; +rz(pi/32) q[3]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(-pi/2) q[1]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[2]; +sx q[2]; +rz(-pi/2) q[2]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[3]; +sx q[3]; +rz(-pi/2) q[3]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(pi/2) q[4]; +sx q[4]; +rz(-pi/2) q[4]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(pi/2) q[0]; +sx q[0]; +rz(-pi/2) q[0]; +rz(1.6689710972195773) q[5]; +sx q[5]; +rz(-1.5217089415825567) q[5]; +cx q[5],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],flag[0]; +rz(pi/64) flag[0]; +cx q[5],q[4]; +rz(-pi/64) q[4]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[4]; +rz(pi/64) q[4]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[4]; +sx q[4]; +rz(1.6689710972195773) q[4]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +rz(-pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(-pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[4],q[5]; +rz(-pi/32) q[5]; +cx q[4],q[5]; +cx q[4],q[3]; +rz(-pi/32) q[3]; +rz(pi/32) q[5]; +cx q[3],q[5]; +rz(pi/32) q[5]; +cx q[3],q[5]; +cx q[4],q[3]; +rz(pi/32) q[3]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(-pi/2) q[1]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[2]; +sx q[2]; +rz(-pi/2) q[2]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[3]; +sx q[3]; +rz(-pi/2) q[3]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(pi/2) q[4]; +sx q[4]; +rz(-pi/2) q[4]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(pi/2) q[0]; +sx q[0]; +rz(-pi/2) q[0]; +rz(1.6689710972195773) q[5]; +sx q[5]; +rz(-1.5217089415825567) q[5]; +cx q[5],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],flag[0]; +rz(pi/64) flag[0]; +cx q[5],q[4]; +rz(-pi/64) q[4]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[4]; +rz(pi/64) q[4]; +cx q[4],flag[0]; +rz(-pi/64) flag[0]; +cx q[4],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[3]; +rz(-pi/64) q[3]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[3]; +rz(pi/64) q[3]; +cx q[3],flag[0]; +rz(-pi/64) flag[0]; +cx q[3],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[2]; +rz(-pi/64) q[2]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[2]; +rz(pi/64) q[2]; +cx q[2],flag[0]; +rz(-pi/64) flag[0]; +cx q[2],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[1]; +rz(-pi/64) q[1]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[1]; +rz(pi/64) q[1]; +cx q[1],flag[0]; +rz(-pi/64) flag[0]; +cx q[1],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[1],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[2],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[3],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[4],q[0]; +rz(-pi/64) q[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +rz(-pi/2) q[4]; +sx q[4]; +rz(1.6689710972195773) q[4]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[0],flag[0]; +rz(-pi/64) flag[0]; +cx q[0],flag[0]; +rz(pi/64) flag[0]; +rz(-pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(-pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[4],q[5]; +rz(-pi/32) q[5]; +cx q[4],q[5]; +cx q[4],q[3]; +rz(-pi/32) q[3]; +rz(pi/32) q[5]; +cx q[3],q[5]; +rz(pi/32) q[5]; +cx q[3],q[5]; +cx q[4],q[3]; +rz(pi/32) q[3]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +rz(-pi/32) q[5]; +cx q[3],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[3],q[2]; +rz(-pi/32) q[2]; +rz(pi/32) q[5]; +cx q[2],q[5]; +rz(pi/32) q[5]; +cx q[2],q[5]; +cx q[4],q[2]; +rz(pi/32) q[2]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +rz(-pi/32) q[5]; +cx q[2],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[2],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[3],q[1]; +rz(-pi/32) q[1]; +rz(pi/32) q[5]; +cx q[1],q[5]; +rz(pi/32) q[5]; +cx q[1],q[5]; +cx q[4],q[1]; +rz(pi/32) q[1]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +rz(-pi/32) q[5]; +cx q[1],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[1],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(-pi/2) q[1]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[2],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[2]; +sx q[2]; +rz(-pi/2) q[2]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +cx q[3],q[0]; +rz(-pi/32) q[0]; +rz(pi/2) q[3]; +sx q[3]; +rz(-pi/2) q[3]; +rz(pi/32) q[5]; +cx q[0],q[5]; +rz(pi/32) q[5]; +cx q[0],q[5]; +cx q[4],q[0]; +rz(pi/32) q[0]; +rz(pi/2) q[4]; +sx q[4]; +rz(-pi/2) q[4]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(-pi/32) q[5]; +cx q[0],q[5]; +rz(pi/2) q[0]; +sx q[0]; +rz(-pi/2) q[0]; +rz(1.6689710972195773) q[5]; +sx q[5]; +rz(-pi/2) q[5]; diff --git a/test/circuits/period_finding_1.qasm b/test/circuits/period_finding_1.qasm new file mode 100644 index 000000000..6a3776863 --- /dev/null +++ b/test/circuits/period_finding_1.qasm @@ -0,0 +1,407 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[8]; + +swap q[0],q[5]; +swap q[1],q[6]; +swap q[2],q[7]; + +h q[0]; +h q[1]; +h q[2]; +x q[7]; +mcx q[0], q[7]; +mcx q[0], q[7], q[4]; +mcx q[0], q[7]; +mcx q[0], q[4]; +mcx q[0], q[4], q[7]; +mcx q[0], q[4]; +mcx q[0], q[5]; +mcx q[0], q[4], q[5]; +mcx q[0], q[4], q[6]; +mcx q[0], q[5], q[7], q[4]; +mcx q[0], q[5], q[6]; +mcx q[0], q[6], q[5]; +mcx q[0], q[4]; +mcx q[0], q[5]; +mcx q[0], q[4], q[5], q[7]; +mcx q[0], q[4]; +mcx q[0], q[5]; +mcx q[0], q[7], q[5]; +mcx q[0], q[4], q[5]; +mcx q[0], q[4], q[6]; +mcx q[0], q[4]; +mcx q[0], q[4], q[5]; +mcx q[0], q[6], q[7], q[4]; +mcx q[0], q[4], q[7], q[6]; +mcx q[0], q[4], q[5]; +mcx q[0], q[5], q[4]; +mcx q[0], q[6]; +mcx q[0], q[6]; +mcx q[0], q[4], q[7], q[6]; +mcx q[0], q[4], q[5]; +mcx q[0], q[4], q[6]; +mcx q[0], q[5], q[6], q[4]; +mcx q[0], q[5], q[6]; +mcx q[0], q[7], q[4], q[5]; +mcx q[0], q[5], q[6]; +mcx q[0], q[7]; +mcx q[0], q[6], q[7], q[4], q[5]; +mcx q[0], q[7]; +mcx q[0], q[6]; +mcx q[0], q[4], q[7]; +mcx q[0], q[4]; +mcx q[0], q[4]; +mcx q[0], q[5]; +mcx q[0], q[4], q[5], q[6]; +mcx q[0], q[4]; +mcx q[0], q[5]; +mcx q[0], q[6], q[4]; +mcx q[0], q[5]; +mcx q[0], q[4], q[5]; +mcx q[0], q[5], q[4]; +mcx q[0], q[5]; +mcx q[0], q[4], q[6]; +mcx q[0], q[4]; +mcx q[0], q[4], q[5]; +mcx q[1], q[7]; +mcx q[1], q[7], q[4]; +mcx q[1], q[7]; +mcx q[1], q[4]; +mcx q[1], q[4], q[7]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[5], q[7], q[4]; +mcx q[1], q[5], q[6]; +mcx q[1], q[6], q[5]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5], q[7]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[7], q[5]; +mcx q[1], q[4], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[4]; +mcx q[1], q[4], q[5]; +mcx q[1], q[6], q[7], q[4]; +mcx q[1], q[4], q[7], q[6]; +mcx q[1], q[4], q[5]; +mcx q[1], q[5], q[4]; +mcx q[1], q[6]; +mcx q[1], q[6]; +mcx q[1], q[4], q[7], q[6]; +mcx q[1], q[4], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[5], q[6], q[4]; +mcx q[1], q[5], q[6]; +mcx q[1], q[7], q[4], q[5]; +mcx q[1], q[5], q[6]; +mcx q[1], q[7]; +mcx q[1], q[6], q[7], q[4], q[5]; +mcx q[1], q[7]; +mcx q[1], q[6]; +mcx q[1], q[4], q[7]; +mcx q[1], q[4]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5], q[6]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[6], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5]; +mcx q[1], q[5], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[4]; +mcx q[1], q[4], q[5]; +mcx q[1], q[7]; +mcx q[1], q[7], q[4]; +mcx q[1], q[7]; +mcx q[1], q[4]; +mcx q[1], q[4], q[7]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[5], q[7], q[4]; +mcx q[1], q[5], q[6]; +mcx q[1], q[6], q[5]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5], q[7]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[7], q[5]; +mcx q[1], q[4], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[4]; +mcx q[1], q[4], q[5]; +mcx q[1], q[6], q[7], q[4]; +mcx q[1], q[4], q[7], q[6]; +mcx q[1], q[4], q[5]; +mcx q[1], q[5], q[4]; +mcx q[1], q[6]; +mcx q[1], q[6]; +mcx q[1], q[4], q[7], q[6]; +mcx q[1], q[4], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[5], q[6], q[4]; +mcx q[1], q[5], q[6]; +mcx q[1], q[7], q[4], q[5]; +mcx q[1], q[5], q[6]; +mcx q[1], q[7]; +mcx q[1], q[6], q[7], q[4], q[5]; +mcx q[1], q[7]; +mcx q[1], q[6]; +mcx q[1], q[4], q[7]; +mcx q[1], q[4]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5], q[6]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[6], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5]; +mcx q[1], q[5], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[4]; +mcx q[1], q[4], q[5]; +mcx q[2], q[7]; +mcx q[2], q[7], q[4]; +mcx q[2], q[7]; +mcx q[2], q[4]; +mcx q[2], q[4], q[7]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[7], q[4]; +mcx q[2], q[5], q[6]; +mcx q[2], q[6], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[7]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[7], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[6], q[7], q[4]; +mcx q[2], q[4], q[7], q[6]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[6]; +mcx q[2], q[6]; +mcx q[2], q[4], q[7], q[6]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[6], q[4]; +mcx q[2], q[5], q[6]; +mcx q[2], q[7], q[4], q[5]; +mcx q[2], q[5], q[6]; +mcx q[2], q[7]; +mcx q[2], q[6], q[7], q[4], q[5]; +mcx q[2], q[7]; +mcx q[2], q[6]; +mcx q[2], q[4], q[7]; +mcx q[2], q[4]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[6]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[6], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[7]; +mcx q[2], q[7], q[4]; +mcx q[2], q[7]; +mcx q[2], q[4]; +mcx q[2], q[4], q[7]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[7], q[4]; +mcx q[2], q[5], q[6]; +mcx q[2], q[6], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[7]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[7], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[6], q[7], q[4]; +mcx q[2], q[4], q[7], q[6]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[6]; +mcx q[2], q[6]; +mcx q[2], q[4], q[7], q[6]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[6], q[4]; +mcx q[2], q[5], q[6]; +mcx q[2], q[7], q[4], q[5]; +mcx q[2], q[5], q[6]; +mcx q[2], q[7]; +mcx q[2], q[6], q[7], q[4], q[5]; +mcx q[2], q[7]; +mcx q[2], q[6]; +mcx q[2], q[4], q[7]; +mcx q[2], q[4]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[6]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[6], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[7]; +mcx q[2], q[7], q[4]; +mcx q[2], q[7]; +mcx q[2], q[4]; +mcx q[2], q[4], q[7]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[7], q[4]; +mcx q[2], q[5], q[6]; +mcx q[2], q[6], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[7]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[7], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[6], q[7], q[4]; +mcx q[2], q[4], q[7], q[6]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[6]; +mcx q[2], q[6]; +mcx q[2], q[4], q[7], q[6]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[6], q[4]; +mcx q[2], q[5], q[6]; +mcx q[2], q[7], q[4], q[5]; +mcx q[2], q[5], q[6]; +mcx q[2], q[7]; +mcx q[2], q[6], q[7], q[4], q[5]; +mcx q[2], q[7]; +mcx q[2], q[6]; +mcx q[2], q[4], q[7]; +mcx q[2], q[4]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[6]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[6], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[7]; +mcx q[2], q[7], q[4]; +mcx q[2], q[7]; +mcx q[2], q[4]; +mcx q[2], q[4], q[7]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[7], q[4]; +mcx q[2], q[5], q[6]; +mcx q[2], q[6], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[7]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[7], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[6], q[7], q[4]; +mcx q[2], q[4], q[7], q[6]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[6]; +mcx q[2], q[6]; +mcx q[2], q[4], q[7], q[6]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[6], q[4]; +mcx q[2], q[5], q[6]; +mcx q[2], q[7], q[4], q[5]; +mcx q[2], q[5], q[6]; +mcx q[2], q[7]; +mcx q[2], q[6], q[7], q[4], q[5]; +mcx q[2], q[7]; +mcx q[2], q[6]; +mcx q[2], q[4], q[7]; +mcx q[2], q[4]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[6]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[6], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +h q[2]; +cswap q[0], q[2], q[3]; +t q[3]; +cswap q[0], q[2], q[3]; +cswap q[1], q[2], q[3]; +s q[3]; +cswap q[1], q[2], q[3]; +h q[1]; +cswap q[0], q[1], q[3]; +s q[3]; +cswap q[0], q[1], q[3]; +h q[0]; +swap q[0], q[2]; + +swap q[0],q[5]; +swap q[1],q[6]; +swap q[2],q[7]; diff --git a/test/circuits/period_finding_2.qasm b/test/circuits/period_finding_2.qasm new file mode 100644 index 000000000..f326f558e --- /dev/null +++ b/test/circuits/period_finding_2.qasm @@ -0,0 +1,449 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[8]; + +swap q[0],q[5]; +swap q[1],q[6]; +swap q[2],q[7]; + +h q[0]; +h q[1]; +h q[2]; +x q[7]; +mcx q[0], q[5]; +mcx q[0], q[5], q[7]; +mcx q[0], q[5]; +mcx q[0], q[4]; +mcx q[0], q[5]; +mcx q[0], q[4], q[5], q[7]; +mcx q[0], q[4]; +mcx q[0], q[5]; +mcx q[0], q[7], q[5]; +mcx q[0], q[5], q[6]; +mcx q[0], q[5]; +mcx q[0], q[4], q[5]; +mcx q[0], q[4], q[6]; +mcx q[0], q[5], q[7], q[4]; +mcx q[0], q[5], q[6]; +mcx q[0], q[6], q[5]; +mcx q[0], q[5]; +mcx q[0], q[5]; +mcx q[0], q[4], q[7], q[5]; +mcx q[0], q[4], q[5]; +mcx q[0], q[4], q[6]; +mcx q[0], q[5], q[4]; +mcx q[0], q[4], q[5]; +mcx q[0], q[5], q[6], q[4]; +mcx q[0], q[7], q[4], q[5]; +mcx q[0], q[6]; +mcx q[0], q[6]; +mcx q[0], q[6]; +mcx q[0], q[7]; +mcx q[0], q[5], q[7], q[4], q[6]; +mcx q[0], q[7]; +mcx q[0], q[5], q[6]; +mcx q[0], q[6], q[5]; +mcx q[0], q[6]; +mcx q[0], q[4], q[7]; +mcx q[0], q[5]; +mcx q[0], q[5], q[4]; +mcx q[0], q[5]; +mcx q[0], q[4]; +mcx q[0], q[4], q[6]; +mcx q[0], q[4]; +mcx q[0], q[4], q[5]; +mcx q[0], q[6], q[4]; +mcx q[0], q[5]; +mcx q[0], q[4]; +mcx q[0], q[5]; +mcx q[0], q[4], q[5], q[6]; +mcx q[0], q[4]; +mcx q[0], q[5]; +mcx q[0], q[6], q[4]; +mcx q[0], q[5]; +mcx q[0], q[4], q[5]; +mcx q[0], q[5], q[4]; +mcx q[0], q[5]; +mcx q[0], q[4], q[6]; +mcx q[0], q[5], q[4]; +mcx q[0], q[4]; +mcx q[0], q[4]; +mcx q[0], q[4], q[5]; +mcx q[0], q[4]; +mcx q[1], q[5]; +mcx q[1], q[5], q[7]; +mcx q[1], q[5]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5], q[7]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[7], q[5]; +mcx q[1], q[5], q[6]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[5], q[7], q[4]; +mcx q[1], q[5], q[6]; +mcx q[1], q[6], q[5]; +mcx q[1], q[5]; +mcx q[1], q[5]; +mcx q[1], q[4], q[7], q[5]; +mcx q[1], q[4], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[5], q[4]; +mcx q[1], q[4], q[5]; +mcx q[1], q[5], q[6], q[4]; +mcx q[1], q[7], q[4], q[5]; +mcx q[1], q[6]; +mcx q[1], q[6]; +mcx q[1], q[6]; +mcx q[1], q[7]; +mcx q[1], q[5], q[7], q[4], q[6]; +mcx q[1], q[7]; +mcx q[1], q[5], q[6]; +mcx q[1], q[6], q[5]; +mcx q[1], q[6]; +mcx q[1], q[4], q[7]; +mcx q[1], q[5]; +mcx q[1], q[5], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4]; +mcx q[1], q[4], q[6]; +mcx q[1], q[4]; +mcx q[1], q[4], q[5]; +mcx q[1], q[6], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5], q[6]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[6], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5]; +mcx q[1], q[5], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[5], q[4]; +mcx q[1], q[4]; +mcx q[1], q[4]; +mcx q[1], q[4], q[5]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[5], q[7]; +mcx q[1], q[5]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5], q[7]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[7], q[5]; +mcx q[1], q[5], q[6]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[5], q[7], q[4]; +mcx q[1], q[5], q[6]; +mcx q[1], q[6], q[5]; +mcx q[1], q[5]; +mcx q[1], q[5]; +mcx q[1], q[4], q[7], q[5]; +mcx q[1], q[4], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[5], q[4]; +mcx q[1], q[4], q[5]; +mcx q[1], q[5], q[6], q[4]; +mcx q[1], q[7], q[4], q[5]; +mcx q[1], q[6]; +mcx q[1], q[6]; +mcx q[1], q[6]; +mcx q[1], q[7]; +mcx q[1], q[5], q[7], q[4], q[6]; +mcx q[1], q[7]; +mcx q[1], q[5], q[6]; +mcx q[1], q[6], q[5]; +mcx q[1], q[6]; +mcx q[1], q[4], q[7]; +mcx q[1], q[5]; +mcx q[1], q[5], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4]; +mcx q[1], q[4], q[6]; +mcx q[1], q[4]; +mcx q[1], q[4], q[5]; +mcx q[1], q[6], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5], q[6]; +mcx q[1], q[4]; +mcx q[1], q[5]; +mcx q[1], q[6], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[5]; +mcx q[1], q[5], q[4]; +mcx q[1], q[5]; +mcx q[1], q[4], q[6]; +mcx q[1], q[5], q[4]; +mcx q[1], q[4]; +mcx q[1], q[4]; +mcx q[1], q[4], q[5]; +mcx q[1], q[4]; +mcx q[2], q[5]; +mcx q[2], q[5], q[7]; +mcx q[2], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[7]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[7], q[5]; +mcx q[2], q[5], q[6]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[7], q[4]; +mcx q[2], q[5], q[6]; +mcx q[2], q[6], q[5]; +mcx q[2], q[5]; +mcx q[2], q[5]; +mcx q[2], q[4], q[7], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[6], q[4]; +mcx q[2], q[7], q[4], q[5]; +mcx q[2], q[6]; +mcx q[2], q[6]; +mcx q[2], q[6]; +mcx q[2], q[7]; +mcx q[2], q[5], q[7], q[4], q[6]; +mcx q[2], q[7]; +mcx q[2], q[5], q[6]; +mcx q[2], q[6], q[5]; +mcx q[2], q[6]; +mcx q[2], q[4], q[7]; +mcx q[2], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4]; +mcx q[2], q[4], q[6]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[6], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[6]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[6], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[4]; +mcx q[2], q[4]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[5], q[7]; +mcx q[2], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[7]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[7], q[5]; +mcx q[2], q[5], q[6]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[7], q[4]; +mcx q[2], q[5], q[6]; +mcx q[2], q[6], q[5]; +mcx q[2], q[5]; +mcx q[2], q[5]; +mcx q[2], q[4], q[7], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[6], q[4]; +mcx q[2], q[7], q[4], q[5]; +mcx q[2], q[6]; +mcx q[2], q[6]; +mcx q[2], q[6]; +mcx q[2], q[7]; +mcx q[2], q[5], q[7], q[4], q[6]; +mcx q[2], q[7]; +mcx q[2], q[5], q[6]; +mcx q[2], q[6], q[5]; +mcx q[2], q[6]; +mcx q[2], q[4], q[7]; +mcx q[2], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4]; +mcx q[2], q[4], q[6]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[6], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[6]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[6], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[4]; +mcx q[2], q[4]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[5], q[7]; +mcx q[2], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[7]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[7], q[5]; +mcx q[2], q[5], q[6]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[7], q[4]; +mcx q[2], q[5], q[6]; +mcx q[2], q[6], q[5]; +mcx q[2], q[5]; +mcx q[2], q[5]; +mcx q[2], q[4], q[7], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[6], q[4]; +mcx q[2], q[7], q[4], q[5]; +mcx q[2], q[6]; +mcx q[2], q[6]; +mcx q[2], q[6]; +mcx q[2], q[7]; +mcx q[2], q[5], q[7], q[4], q[6]; +mcx q[2], q[7]; +mcx q[2], q[5], q[6]; +mcx q[2], q[6], q[5]; +mcx q[2], q[6]; +mcx q[2], q[4], q[7]; +mcx q[2], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4]; +mcx q[2], q[4], q[6]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[6], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[6]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[6], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[4]; +mcx q[2], q[4]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[5], q[7]; +mcx q[2], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[7]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[7], q[5]; +mcx q[2], q[5], q[6]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[7], q[4]; +mcx q[2], q[5], q[6]; +mcx q[2], q[6], q[5]; +mcx q[2], q[5]; +mcx q[2], q[5]; +mcx q[2], q[4], q[7], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[6], q[4]; +mcx q[2], q[7], q[4], q[5]; +mcx q[2], q[6]; +mcx q[2], q[6]; +mcx q[2], q[6]; +mcx q[2], q[7]; +mcx q[2], q[5], q[7], q[4], q[6]; +mcx q[2], q[7]; +mcx q[2], q[5], q[6]; +mcx q[2], q[6], q[5]; +mcx q[2], q[6]; +mcx q[2], q[4], q[7]; +mcx q[2], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4]; +mcx q[2], q[4], q[6]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[6], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5], q[6]; +mcx q[2], q[4]; +mcx q[2], q[5]; +mcx q[2], q[6], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[5]; +mcx q[2], q[5], q[4]; +mcx q[2], q[5]; +mcx q[2], q[4], q[6]; +mcx q[2], q[5], q[4]; +mcx q[2], q[4]; +mcx q[2], q[4]; +mcx q[2], q[4], q[5]; +mcx q[2], q[4]; +h q[2]; +cswap q[0], q[2], q[3]; +t q[3]; +cswap q[0], q[2], q[3]; +cswap q[1], q[2], q[3]; +s q[3]; +cswap q[1], q[2], q[3]; +h q[1]; +cswap q[0], q[1], q[3]; +s q[3]; +cswap q[0], q[1], q[3]; +h q[0]; +swap q[0], q[2]; + +swap q[0],q[5]; +swap q[1],q[6]; +swap q[2],q[7]; diff --git a/test/circuits/qpeexact_indep_qiskit_30.qasm b/test/circuits/qpeexact_indep_qiskit_30.qasm new file mode 100644 index 000000000..615f20855 --- /dev/null +++ b/test/circuits/qpeexact_indep_qiskit_30.qasm @@ -0,0 +1,517 @@ +// Benchmark was created by MQT Bench on 2023-06-29 +// For more information about MQT Bench, please visit https://www.cda.cit.tum.de/mqtbench/ +// MQT Bench version: v1.0.0 +// Qiskit version: {'qiskit-terra': '0.24.1', 'qiskit-aer': '0.12.0', 'qiskit-ignis': None, 'qiskit-ibmq-provider': '0.20.2', 'qiskit': '0.43.1', 'qiskit-nature': '0.6.2', 'qiskit-finance': '0.3.4', 'qiskit-optimization': '0.5.0', 'qiskit-machine-learning': '0.6.1'} + +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[29]; +qreg psi[1]; +creg c[29]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; +h q[9]; +h q[10]; +h q[11]; +h q[12]; +h q[13]; +h q[14]; +h q[15]; +h q[16]; +h q[17]; +h q[18]; +h q[19]; +h q[20]; +h q[21]; +h q[22]; +h q[23]; +h q[24]; +h q[25]; +h q[26]; +h q[27]; +h q[28]; +x psi[0]; +cp(-2.6929568978583567) psi[0],q[0]; +cp(0.8972715114628729) psi[0],q[1]; +cp(1.7945430229257457) psi[0],q[2]; +cp(-2.6940992613280947) psi[0],q[3]; +cp(0.8949867845233965) psi[0],q[4]; +cp(1.789973569046793) psi[0],q[5]; +cp(-2.703238169086) psi[0],q[6]; +cp(0.8767089690075863) psi[0],q[7]; +cp(1.7534179380151727) psi[0],q[8]; +cp(-2.776349431149241) psi[0],q[9]; +cp(0.7304864448811045) psi[0],q[10]; +cp(1.460972889762209) psi[0],q[11]; +cp(2.921945779524418) psi[0],q[12]; +cp(-0.4392937481307505) psi[0],q[13]; +cp(-0.878587496261501) psi[0],q[14]; +cp(-1.757174992523002) psi[0],q[15]; +cp(2.768835322133582) psi[0],q[16]; +cp(-0.7455146629124216) psi[0],q[17]; +cp(-1.4910293258248433) psi[0],q[18]; +cp(-2.9820586516496865) psi[0],q[19]; +cp(0.3190680038802134) psi[0],q[20]; +cp(0.6381360077604268) psi[0],q[21]; +cp(1.2762720155208536) psi[0],q[22]; +cp(13*pi/16) psi[0],q[23]; +cp(-3*pi/8) psi[0],q[24]; +cp(-3*pi/4) psi[0],q[25]; +cp(pi/2) psi[0],q[26]; +cp(pi) psi[0],q[27]; +swap q[0],q[28]; +h q[0]; +swap q[1],q[27]; +cp(-pi/2) q[1],q[0]; +h q[1]; +swap q[10],q[18]; +swap q[11],q[17]; +swap q[12],q[16]; +swap q[13],q[15]; +swap q[2],q[26]; +cp(-pi/4) q[2],q[0]; +cp(-pi/2) q[2],q[1]; +h q[2]; +swap q[3],q[25]; +cp(-pi/8) q[3],q[0]; +cp(-pi/4) q[3],q[1]; +cp(-pi/2) q[3],q[2]; +h q[3]; +swap q[4],q[24]; +cp(-pi/16) q[4],q[0]; +cp(-pi/8) q[4],q[1]; +cp(-pi/4) q[4],q[2]; +cp(-pi/2) q[4],q[3]; +h q[4]; +swap q[5],q[23]; +cp(-pi/32) q[5],q[0]; +cp(-pi/16) q[5],q[1]; +cp(-pi/8) q[5],q[2]; +cp(-pi/4) q[5],q[3]; +cp(-pi/2) q[5],q[4]; +h q[5]; +swap q[6],q[22]; +cp(-pi/64) q[6],q[0]; +cp(-pi/32) q[6],q[1]; +cp(-pi/16) q[6],q[2]; +cp(-pi/8) q[6],q[3]; +cp(-pi/4) q[6],q[4]; +cp(-pi/2) q[6],q[5]; +h q[6]; +swap q[7],q[21]; +cp(-pi/128) q[7],q[0]; +cp(-pi/64) q[7],q[1]; +cp(-pi/32) q[7],q[2]; +cp(-pi/16) q[7],q[3]; +cp(-pi/8) q[7],q[4]; +cp(-pi/4) q[7],q[5]; +cp(-pi/2) q[7],q[6]; +h q[7]; +swap q[8],q[20]; +cp(-pi/256) q[8],q[0]; +cp(-pi/128) q[8],q[1]; +cp(-pi/64) q[8],q[2]; +cp(-pi/32) q[8],q[3]; +cp(-pi/16) q[8],q[4]; +cp(-pi/8) q[8],q[5]; +cp(-pi/4) q[8],q[6]; +cp(-pi/2) q[8],q[7]; +h q[8]; +swap q[9],q[19]; +cp(-pi/512) q[9],q[0]; +cp(-pi/1024) q[10],q[0]; +cp(-pi/2048) q[11],q[0]; +cp(-pi/4096) q[12],q[0]; +cp(-pi/8192) q[13],q[0]; +cp(-pi/16384) q[14],q[0]; +cp(-pi/32768) q[15],q[0]; +cp(-pi/65536) q[16],q[0]; +cp(-pi/131072) q[17],q[0]; +cp(-pi/262144) q[18],q[0]; +cp(-pi/524288) q[19],q[0]; +cp(-pi/1048576) q[20],q[0]; +cp(-pi/2097152) q[21],q[0]; +cp(-pi/4194304) q[22],q[0]; +cp(-pi/8388608) q[23],q[0]; +cp(-pi/16777216) q[24],q[0]; +cp(-pi/33554432) q[25],q[0]; +cp(-pi/67108864) q[26],q[0]; +cp(-pi/134217728) q[27],q[0]; +cp(-pi/268435456) q[28],q[0]; +cp(-pi/256) q[9],q[1]; +cp(-pi/512) q[10],q[1]; +cp(-pi/1024) q[11],q[1]; +cp(-pi/2048) q[12],q[1]; +cp(-pi/4096) q[13],q[1]; +cp(-pi/8192) q[14],q[1]; +cp(-pi/16384) q[15],q[1]; +cp(-pi/32768) q[16],q[1]; +cp(-pi/65536) q[17],q[1]; +cp(-pi/131072) q[18],q[1]; +cp(-pi/262144) q[19],q[1]; +cp(-pi/524288) q[20],q[1]; +cp(-pi/1048576) q[21],q[1]; +cp(-pi/2097152) q[22],q[1]; +cp(-pi/4194304) q[23],q[1]; +cp(-pi/8388608) q[24],q[1]; +cp(-pi/16777216) q[25],q[1]; +cp(-pi/33554432) q[26],q[1]; +cp(-pi/67108864) q[27],q[1]; +cp(-pi/134217728) q[28],q[1]; +cp(-pi/128) q[9],q[2]; +cp(-pi/256) q[10],q[2]; +cp(-pi/512) q[11],q[2]; +cp(-pi/1024) q[12],q[2]; +cp(-pi/2048) q[13],q[2]; +cp(-pi/4096) q[14],q[2]; +cp(-pi/8192) q[15],q[2]; +cp(-pi/16384) q[16],q[2]; +cp(-pi/32768) q[17],q[2]; +cp(-pi/65536) q[18],q[2]; +cp(-pi/131072) q[19],q[2]; +cp(-pi/262144) q[20],q[2]; +cp(-pi/524288) q[21],q[2]; +cp(-pi/1048576) q[22],q[2]; +cp(-pi/2097152) q[23],q[2]; +cp(-pi/4194304) q[24],q[2]; +cp(-pi/8388608) q[25],q[2]; +cp(-pi/16777216) q[26],q[2]; +cp(-pi/33554432) q[27],q[2]; +cp(-pi/67108864) q[28],q[2]; +cp(-pi/64) q[9],q[3]; +cp(-pi/128) q[10],q[3]; +cp(-pi/256) q[11],q[3]; +cp(-pi/512) q[12],q[3]; +cp(-pi/1024) q[13],q[3]; +cp(-pi/2048) q[14],q[3]; +cp(-pi/4096) q[15],q[3]; +cp(-pi/8192) q[16],q[3]; +cp(-pi/16384) q[17],q[3]; +cp(-pi/32768) q[18],q[3]; +cp(-pi/65536) q[19],q[3]; +cp(-pi/131072) q[20],q[3]; +cp(-pi/262144) q[21],q[3]; +cp(-pi/524288) q[22],q[3]; +cp(-pi/1048576) q[23],q[3]; +cp(-pi/2097152) q[24],q[3]; +cp(-pi/4194304) q[25],q[3]; +cp(-pi/8388608) q[26],q[3]; +cp(-pi/16777216) q[27],q[3]; +cp(-pi/33554432) q[28],q[3]; +cp(-pi/32) q[9],q[4]; +cp(-pi/64) q[10],q[4]; +cp(-pi/128) q[11],q[4]; +cp(-pi/256) q[12],q[4]; +cp(-pi/512) q[13],q[4]; +cp(-pi/1024) q[14],q[4]; +cp(-pi/2048) q[15],q[4]; +cp(-pi/4096) q[16],q[4]; +cp(-pi/8192) q[17],q[4]; +cp(-pi/16384) q[18],q[4]; +cp(-pi/32768) q[19],q[4]; +cp(-pi/65536) q[20],q[4]; +cp(-pi/131072) q[21],q[4]; +cp(-pi/262144) q[22],q[4]; +cp(-pi/524288) q[23],q[4]; +cp(-pi/1048576) q[24],q[4]; +cp(-pi/2097152) q[25],q[4]; +cp(-pi/4194304) q[26],q[4]; +cp(-pi/8388608) q[27],q[4]; +cp(-pi/16777216) q[28],q[4]; +cp(-pi/16) q[9],q[5]; +cp(-pi/32) q[10],q[5]; +cp(-pi/64) q[11],q[5]; +cp(-pi/128) q[12],q[5]; +cp(-pi/256) q[13],q[5]; +cp(-pi/512) q[14],q[5]; +cp(-pi/1024) q[15],q[5]; +cp(-pi/2048) q[16],q[5]; +cp(-pi/4096) q[17],q[5]; +cp(-pi/8192) q[18],q[5]; +cp(-pi/16384) q[19],q[5]; +cp(-pi/32768) q[20],q[5]; +cp(-pi/65536) q[21],q[5]; +cp(-pi/131072) q[22],q[5]; +cp(-pi/262144) q[23],q[5]; +cp(-pi/524288) q[24],q[5]; +cp(-pi/1048576) q[25],q[5]; +cp(-pi/2097152) q[26],q[5]; +cp(-pi/4194304) q[27],q[5]; +cp(-pi/8388608) q[28],q[5]; +cp(-pi/8) q[9],q[6]; +cp(-pi/16) q[10],q[6]; +cp(-pi/32) q[11],q[6]; +cp(-pi/64) q[12],q[6]; +cp(-pi/128) q[13],q[6]; +cp(-pi/256) q[14],q[6]; +cp(-pi/512) q[15],q[6]; +cp(-pi/1024) q[16],q[6]; +cp(-pi/2048) q[17],q[6]; +cp(-pi/4096) q[18],q[6]; +cp(-pi/8192) q[19],q[6]; +cp(-pi/16384) q[20],q[6]; +cp(-pi/32768) q[21],q[6]; +cp(-pi/65536) q[22],q[6]; +cp(-pi/131072) q[23],q[6]; +cp(-pi/262144) q[24],q[6]; +cp(-pi/524288) q[25],q[6]; +cp(-pi/1048576) q[26],q[6]; +cp(-pi/2097152) q[27],q[6]; +cp(-pi/4194304) q[28],q[6]; +cp(-pi/4) q[9],q[7]; +cp(-pi/8) q[10],q[7]; +cp(-pi/16) q[11],q[7]; +cp(-pi/32) q[12],q[7]; +cp(-pi/64) q[13],q[7]; +cp(-pi/128) q[14],q[7]; +cp(-pi/256) q[15],q[7]; +cp(-pi/512) q[16],q[7]; +cp(-pi/1024) q[17],q[7]; +cp(-pi/2048) q[18],q[7]; +cp(-pi/4096) q[19],q[7]; +cp(-pi/8192) q[20],q[7]; +cp(-pi/16384) q[21],q[7]; +cp(-pi/32768) q[22],q[7]; +cp(-pi/65536) q[23],q[7]; +cp(-pi/131072) q[24],q[7]; +cp(-pi/262144) q[25],q[7]; +cp(-pi/524288) q[26],q[7]; +cp(-pi/1048576) q[27],q[7]; +cp(-pi/2097152) q[28],q[7]; +cp(-pi/2) q[9],q[8]; +cp(-pi/4) q[10],q[8]; +cp(-pi/8) q[11],q[8]; +cp(-pi/16) q[12],q[8]; +cp(-pi/32) q[13],q[8]; +cp(-pi/64) q[14],q[8]; +cp(-pi/128) q[15],q[8]; +cp(-pi/256) q[16],q[8]; +cp(-pi/512) q[17],q[8]; +cp(-pi/1024) q[18],q[8]; +cp(-pi/2048) q[19],q[8]; +cp(-pi/4096) q[20],q[8]; +cp(-pi/8192) q[21],q[8]; +cp(-pi/16384) q[22],q[8]; +cp(-pi/32768) q[23],q[8]; +cp(-pi/65536) q[24],q[8]; +cp(-pi/131072) q[25],q[8]; +cp(-pi/262144) q[26],q[8]; +cp(-pi/524288) q[27],q[8]; +cp(-pi/1048576) q[28],q[8]; +h q[9]; +cp(-pi/2) q[10],q[9]; +h q[10]; +cp(-pi/4) q[11],q[9]; +cp(-pi/2) q[11],q[10]; +h q[11]; +cp(-pi/8) q[12],q[9]; +cp(-pi/4) q[12],q[10]; +cp(-pi/2) q[12],q[11]; +h q[12]; +cp(-pi/16) q[13],q[9]; +cp(-pi/8) q[13],q[10]; +cp(-pi/4) q[13],q[11]; +cp(-pi/2) q[13],q[12]; +h q[13]; +cp(-pi/32) q[14],q[9]; +cp(-pi/16) q[14],q[10]; +cp(-pi/8) q[14],q[11]; +cp(-pi/4) q[14],q[12]; +cp(-pi/2) q[14],q[13]; +h q[14]; +cp(-pi/64) q[15],q[9]; +cp(-pi/32) q[15],q[10]; +cp(-pi/16) q[15],q[11]; +cp(-pi/8) q[15],q[12]; +cp(-pi/4) q[15],q[13]; +cp(-pi/2) q[15],q[14]; +h q[15]; +cp(-pi/128) q[16],q[9]; +cp(-pi/64) q[16],q[10]; +cp(-pi/32) q[16],q[11]; +cp(-pi/16) q[16],q[12]; +cp(-pi/8) q[16],q[13]; +cp(-pi/4) q[16],q[14]; +cp(-pi/2) q[16],q[15]; +h q[16]; +cp(-pi/256) q[17],q[9]; +cp(-pi/128) q[17],q[10]; +cp(-pi/64) q[17],q[11]; +cp(-pi/32) q[17],q[12]; +cp(-pi/16) q[17],q[13]; +cp(-pi/8) q[17],q[14]; +cp(-pi/4) q[17],q[15]; +cp(-pi/2) q[17],q[16]; +h q[17]; +cp(-pi/512) q[18],q[9]; +cp(-pi/256) q[18],q[10]; +cp(-pi/128) q[18],q[11]; +cp(-pi/64) q[18],q[12]; +cp(-pi/32) q[18],q[13]; +cp(-pi/16) q[18],q[14]; +cp(-pi/8) q[18],q[15]; +cp(-pi/4) q[18],q[16]; +cp(-pi/2) q[18],q[17]; +h q[18]; +cp(-pi/1024) q[19],q[9]; +cp(-pi/512) q[19],q[10]; +cp(-pi/256) q[19],q[11]; +cp(-pi/128) q[19],q[12]; +cp(-pi/64) q[19],q[13]; +cp(-pi/32) q[19],q[14]; +cp(-pi/16) q[19],q[15]; +cp(-pi/8) q[19],q[16]; +cp(-pi/4) q[19],q[17]; +cp(-pi/2) q[19],q[18]; +h q[19]; +cp(-pi/2048) q[20],q[9]; +cp(-pi/1024) q[20],q[10]; +cp(-pi/512) q[20],q[11]; +cp(-pi/256) q[20],q[12]; +cp(-pi/128) q[20],q[13]; +cp(-pi/64) q[20],q[14]; +cp(-pi/32) q[20],q[15]; +cp(-pi/16) q[20],q[16]; +cp(-pi/8) q[20],q[17]; +cp(-pi/4) q[20],q[18]; +cp(-pi/2) q[20],q[19]; +h q[20]; +cp(-pi/4096) q[21],q[9]; +cp(-pi/2048) q[21],q[10]; +cp(-pi/1024) q[21],q[11]; +cp(-pi/512) q[21],q[12]; +cp(-pi/256) q[21],q[13]; +cp(-pi/128) q[21],q[14]; +cp(-pi/64) q[21],q[15]; +cp(-pi/32) q[21],q[16]; +cp(-pi/16) q[21],q[17]; +cp(-pi/8) q[21],q[18]; +cp(-pi/4) q[21],q[19]; +cp(-pi/2) q[21],q[20]; +h q[21]; +cp(-pi/8192) q[22],q[9]; +cp(-pi/4096) q[22],q[10]; +cp(-pi/2048) q[22],q[11]; +cp(-pi/1024) q[22],q[12]; +cp(-pi/512) q[22],q[13]; +cp(-pi/256) q[22],q[14]; +cp(-pi/128) q[22],q[15]; +cp(-pi/64) q[22],q[16]; +cp(-pi/32) q[22],q[17]; +cp(-pi/16) q[22],q[18]; +cp(-pi/8) q[22],q[19]; +cp(-pi/4) q[22],q[20]; +cp(-pi/2) q[22],q[21]; +h q[22]; +cp(-pi/16384) q[23],q[9]; +cp(-pi/8192) q[23],q[10]; +cp(-pi/4096) q[23],q[11]; +cp(-pi/2048) q[23],q[12]; +cp(-pi/1024) q[23],q[13]; +cp(-pi/512) q[23],q[14]; +cp(-pi/256) q[23],q[15]; +cp(-pi/128) q[23],q[16]; +cp(-pi/64) q[23],q[17]; +cp(-pi/32) q[23],q[18]; +cp(-pi/16) q[23],q[19]; +cp(-pi/8) q[23],q[20]; +cp(-pi/4) q[23],q[21]; +cp(-pi/2) q[23],q[22]; +h q[23]; +cp(-pi/32768) q[24],q[9]; +cp(-pi/16384) q[24],q[10]; +cp(-pi/8192) q[24],q[11]; +cp(-pi/4096) q[24],q[12]; +cp(-pi/2048) q[24],q[13]; +cp(-pi/1024) q[24],q[14]; +cp(-pi/512) q[24],q[15]; +cp(-pi/256) q[24],q[16]; +cp(-pi/128) q[24],q[17]; +cp(-pi/64) q[24],q[18]; +cp(-pi/32) q[24],q[19]; +cp(-pi/16) q[24],q[20]; +cp(-pi/8) q[24],q[21]; +cp(-pi/4) q[24],q[22]; +cp(-pi/2) q[24],q[23]; +h q[24]; +cp(-pi/65536) q[25],q[9]; +cp(-pi/32768) q[25],q[10]; +cp(-pi/16384) q[25],q[11]; +cp(-pi/8192) q[25],q[12]; +cp(-pi/4096) q[25],q[13]; +cp(-pi/2048) q[25],q[14]; +cp(-pi/1024) q[25],q[15]; +cp(-pi/512) q[25],q[16]; +cp(-pi/256) q[25],q[17]; +cp(-pi/128) q[25],q[18]; +cp(-pi/64) q[25],q[19]; +cp(-pi/32) q[25],q[20]; +cp(-pi/16) q[25],q[21]; +cp(-pi/8) q[25],q[22]; +cp(-pi/4) q[25],q[23]; +cp(-pi/2) q[25],q[24]; +h q[25]; +cp(-pi/131072) q[26],q[9]; +cp(-pi/65536) q[26],q[10]; +cp(-pi/32768) q[26],q[11]; +cp(-pi/16384) q[26],q[12]; +cp(-pi/8192) q[26],q[13]; +cp(-pi/4096) q[26],q[14]; +cp(-pi/2048) q[26],q[15]; +cp(-pi/1024) q[26],q[16]; +cp(-pi/512) q[26],q[17]; +cp(-pi/256) q[26],q[18]; +cp(-pi/128) q[26],q[19]; +cp(-pi/64) q[26],q[20]; +cp(-pi/32) q[26],q[21]; +cp(-pi/16) q[26],q[22]; +cp(-pi/8) q[26],q[23]; +cp(-pi/4) q[26],q[24]; +cp(-pi/2) q[26],q[25]; +h q[26]; +cp(-pi/262144) q[27],q[9]; +cp(-pi/131072) q[27],q[10]; +cp(-pi/65536) q[27],q[11]; +cp(-pi/32768) q[27],q[12]; +cp(-pi/16384) q[27],q[13]; +cp(-pi/8192) q[27],q[14]; +cp(-pi/4096) q[27],q[15]; +cp(-pi/2048) q[27],q[16]; +cp(-pi/1024) q[27],q[17]; +cp(-pi/512) q[27],q[18]; +cp(-pi/256) q[27],q[19]; +cp(-pi/128) q[27],q[20]; +cp(-pi/64) q[27],q[21]; +cp(-pi/32) q[27],q[22]; +cp(-pi/16) q[27],q[23]; +cp(-pi/8) q[27],q[24]; +cp(-pi/4) q[27],q[25]; +cp(-pi/2) q[27],q[26]; +h q[27]; +cp(-pi/524288) q[28],q[9]; +cp(-pi/262144) q[28],q[10]; +cp(-pi/131072) q[28],q[11]; +cp(-pi/65536) q[28],q[12]; +cp(-pi/32768) q[28],q[13]; +cp(-pi/16384) q[28],q[14]; +cp(-pi/8192) q[28],q[15]; +cp(-pi/4096) q[28],q[16]; +cp(-pi/2048) q[28],q[17]; +cp(-pi/1024) q[28],q[18]; +cp(-pi/512) q[28],q[19]; +cp(-pi/256) q[28],q[20]; +cp(-pi/128) q[28],q[21]; +cp(-pi/64) q[28],q[22]; +cp(-pi/32) q[28],q[23]; +cp(-pi/16) q[28],q[24]; +cp(-pi/8) q[28],q[25]; +cp(-pi/4) q[28],q[26]; +cp(-pi/2) q[28],q[27]; +h q[28]; diff --git a/test/circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm b/test/circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm new file mode 100644 index 000000000..6c9b3dc22 --- /dev/null +++ b/test/circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm @@ -0,0 +1,2398 @@ +// Benchmark was created by MQT Bench on 2023-06-29 +// For more information about MQT Bench, please visit https://www.cda.cit.tum.de/mqtbench/ +// MQT Bench version: v1.0.0 +// Qiskit version: {'qiskit-terra': '0.24.1', 'qiskit-aer': '0.12.0', 'qiskit-ignis': None, 'qiskit-ibmq-provider': '0.20.2', 'qiskit': '0.43.1', 'qiskit-nature': '0.6.2', 'qiskit-finance': '0.3.4', 'qiskit-optimization': '0.5.0', 'qiskit-machine-learning': '0.6.1'} +// Used Gate Set: ['rz', 'sx', 'x', 'cx', 'measure'] + +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[29]; +qreg psi[1]; +creg c[29]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +rz(pi/2) q[6]; +sx q[6]; +rz(pi/2) q[6]; +rz(pi/2) q[7]; +sx q[7]; +rz(pi/2) q[7]; +rz(pi/2) q[8]; +sx q[8]; +rz(pi/2) q[8]; +rz(pi/2) q[9]; +sx q[9]; +rz(pi/2) q[9]; +rz(pi/2) q[10]; +sx q[10]; +rz(pi/2) q[10]; +rz(pi/2) q[11]; +sx q[11]; +rz(pi/2) q[11]; +rz(pi/2) q[12]; +sx q[12]; +rz(pi/2) q[12]; +rz(pi/2) q[13]; +sx q[13]; +rz(pi/2) q[13]; +rz(pi/2) q[14]; +sx q[14]; +rz(pi/2) q[14]; +rz(pi/2) q[15]; +sx q[15]; +rz(pi/2) q[15]; +rz(pi/2) q[16]; +sx q[16]; +rz(pi/2) q[16]; +rz(pi/2) q[17]; +sx q[17]; +rz(pi/2) q[17]; +rz(pi/2) q[18]; +sx q[18]; +rz(pi/2) q[18]; +rz(pi/2) q[19]; +sx q[19]; +rz(pi/2) q[19]; +rz(pi/2) q[20]; +sx q[20]; +rz(pi/2) q[20]; +rz(pi/2) q[21]; +sx q[21]; +rz(pi/2) q[21]; +rz(pi/2) q[22]; +sx q[22]; +rz(pi/2) q[22]; +rz(pi/2) q[23]; +sx q[23]; +rz(pi/2) q[23]; +rz(pi/2) q[24]; +sx q[24]; +rz(pi/2) q[24]; +rz(pi/2) q[25]; +sx q[25]; +rz(pi/2) q[25]; +rz(pi/2) q[26]; +sx q[26]; +rz(pi/2) q[26]; +rz(pi/2) q[27]; +sx q[27]; +rz(pi/2) q[27]; +rz(pi/2) q[28]; +sx q[28]; +rz(pi/2) q[28]; +x psi[0]; +rz(-1.3464784489291783) psi[0]; +cx psi[0],q[0]; +rz(1.3464784489291783) q[0]; +cx psi[0],q[0]; +rz(0.44863575573143644) psi[0]; +cx psi[0],q[1]; +rz(-1.3464784489291783) q[0]; +cx q[0],q[28]; +rz(-0.44863575573143644) q[1]; +cx psi[0],q[1]; +rz(0.8972715114628729) psi[0]; +cx psi[0],q[2]; +rz(0.44863575573143644) q[1]; +rz(-0.8972715114628729) q[2]; +cx psi[0],q[2]; +rz(-1.3470496306640474) psi[0]; +cx psi[0],q[3]; +rz(0.8972715114628729) q[2]; +cx q[28],q[0]; +cx q[0],q[28]; +rz(pi/2) q[0]; +sx q[0]; +rz(pi/2) q[0]; +rz(-pi/536870912) q[28]; +rz(1.3470496306640474) q[3]; +cx psi[0],q[3]; +rz(0.44749339226169826) psi[0]; +cx psi[0],q[4]; +rz(-1.3470496306640474) q[3]; +rz(-0.44749339226169826) q[4]; +cx psi[0],q[4]; +rz(0.8949867845233965) psi[0]; +cx psi[0],q[5]; +rz(0.44749339226169826) q[4]; +rz(-0.8949867845233965) q[5]; +cx psi[0],q[5]; +rz(-1.351619084543) psi[0]; +cx psi[0],q[6]; +rz(0.8949867845233965) q[5]; +rz(1.351619084543) q[6]; +cx psi[0],q[6]; +rz(0.43835448450379316) psi[0]; +cx psi[0],q[7]; +rz(-1.351619084543) q[6]; +rz(-0.43835448450379316) q[7]; +cx psi[0],q[7]; +rz(0.8767089690075863) psi[0]; +cx psi[0],q[8]; +rz(0.43835448450379316) q[7]; +rz(-0.8767089690075863) q[8]; +cx psi[0],q[8]; +rz(-1.3881747155746205) psi[0]; +cx psi[0],q[9]; +rz(0.8767089690075863) q[8]; +rz(1.3881747155746205) q[9]; +cx psi[0],q[9]; +rz(0.36524322244055224) psi[0]; +cx psi[0],q[10]; +rz(-0.36524322244055224) q[10]; +cx psi[0],q[10]; +rz(0.7304864448811045) psi[0]; +cx psi[0],q[11]; +rz(0.36524322244055224) q[10]; +rz(-0.7304864448811045) q[11]; +cx psi[0],q[11]; +rz(1.460972889762209) psi[0]; +cx psi[0],q[12]; +rz(0.7304864448811045) q[11]; +rz(-1.460972889762209) q[12]; +cx psi[0],q[12]; +rz(-0.21964687406537525) psi[0]; +cx psi[0],q[13]; +rz(1.460972889762209) q[12]; +rz(0.21964687406537525) q[13]; +cx psi[0],q[13]; +rz(-0.4392937481307505) psi[0]; +cx psi[0],q[14]; +rz(-0.21964687406537525) q[13]; +rz(0.4392937481307505) q[14]; +cx psi[0],q[14]; +rz(-0.878587496261501) psi[0]; +cx psi[0],q[15]; +rz(-0.4392937481307505) q[14]; +rz(-pi/32768) q[14]; +rz(0.878587496261501) q[15]; +cx psi[0],q[15]; +rz(1.384417661066791) psi[0]; +cx psi[0],q[16]; +rz(-0.878587496261501) q[15]; +cx q[13],q[15]; +cx q[15],q[13]; +cx q[13],q[15]; +rz(-pi/16384) q[13]; +rz(-pi/65536) q[15]; +rz(-1.384417661066791) q[16]; +cx psi[0],q[16]; +rz(-0.3727573314562108) psi[0]; +cx psi[0],q[17]; +rz(1.384417661066791) q[16]; +cx q[12],q[16]; +cx q[16],q[12]; +cx q[12],q[16]; +rz(-pi/8192) q[12]; +rz(-pi/131072) q[16]; +rz(0.3727573314562108) q[17]; +cx psi[0],q[17]; +rz(-0.7455146629124216) psi[0]; +cx psi[0],q[18]; +rz(-0.3727573314562108) q[17]; +cx q[11],q[17]; +cx q[17],q[11]; +cx q[11],q[17]; +rz(-pi/4096) q[11]; +rz(-pi/262144) q[17]; +rz(0.7455146629124216) q[18]; +cx psi[0],q[18]; +rz(-1.4910293258248433) psi[0]; +cx psi[0],q[19]; +rz(-0.7455146629124216) q[18]; +cx q[10],q[18]; +cx q[18],q[10]; +cx q[10],q[18]; +rz(-pi/2048) q[10]; +rz(-pi/524288) q[18]; +rz(1.4910293258248433) q[19]; +cx psi[0],q[19]; +rz(0.1595340019401067) psi[0]; +cx psi[0],q[20]; +rz(-1.4910293258248433) q[19]; +rz(-0.1595340019401067) q[20]; +cx psi[0],q[20]; +rz(0.3190680038802134) psi[0]; +cx psi[0],q[21]; +rz(0.1595340019401067) q[20]; +rz(-0.3190680038802134) q[21]; +cx psi[0],q[21]; +rz(0.6381360077604268) psi[0]; +cx psi[0],q[22]; +rz(0.3190680038802134) q[21]; +rz(-0.6381360077604268) q[22]; +cx psi[0],q[22]; +rz(1.2762720155208536) psi[0]; +cx psi[0],q[23]; +rz(0.6381360077604268) q[22]; +rz(-1.2762720155208536) q[23]; +cx psi[0],q[23]; +rz(-3*pi/16) psi[0]; +cx psi[0],q[24]; +rz(1.2762720155208536) q[23]; +rz(3*pi/16) q[24]; +cx psi[0],q[24]; +rz(-3*pi/8) psi[0]; +cx psi[0],q[25]; +rz(-3*pi/16) q[24]; +rz(3*pi/8) q[25]; +cx psi[0],q[25]; +rz(pi/4) psi[0]; +cx psi[0],q[26]; +rz(-3*pi/8) q[25]; +rz(-pi/4) q[26]; +cx psi[0],q[26]; +rz(pi/2) psi[0]; +cx psi[0],q[27]; +rz(pi/4) q[26]; +cx q[2],q[26]; +cx q[26],q[2]; +cx q[2],q[26]; +rz(-pi/8) q[2]; +rz(-pi/134217728) q[26]; +rz(-pi/2) q[27]; +cx psi[0],q[27]; +rz(pi/2) q[27]; +cx q[1],q[27]; +cx q[27],q[1]; +cx q[1],q[27]; +rz(-pi/4) q[1]; +cx q[1],q[0]; +rz(pi/4) q[0]; +cx q[1],q[0]; +rz(-pi/4) q[0]; +rz(pi/2) q[1]; +sx q[1]; +rz(pi/2) q[1]; +cx q[2],q[0]; +rz(pi/8) q[0]; +cx q[2],q[0]; +rz(-pi/8) q[0]; +rz(-pi/4) q[2]; +cx q[2],q[1]; +rz(pi/4) q[1]; +cx q[2],q[1]; +rz(-pi/4) q[1]; +rz(pi/2) q[2]; +sx q[2]; +rz(pi/2) q[2]; +rz(-pi/268435456) q[27]; +cx q[3],q[25]; +cx q[25],q[3]; +cx q[3],q[25]; +rz(-pi/67108864) q[25]; +rz(-pi/16) q[3]; +cx q[3],q[0]; +rz(pi/16) q[0]; +cx q[3],q[0]; +rz(-pi/16) q[0]; +rz(-pi/8) q[3]; +cx q[3],q[1]; +rz(pi/8) q[1]; +cx q[3],q[1]; +rz(-pi/8) q[1]; +rz(-pi/4) q[3]; +cx q[3],q[2]; +rz(pi/4) q[2]; +cx q[3],q[2]; +rz(-pi/4) q[2]; +rz(pi/2) q[3]; +sx q[3]; +rz(pi/2) q[3]; +cx q[4],q[24]; +cx q[24],q[4]; +cx q[4],q[24]; +rz(-pi/33554432) q[24]; +rz(-pi/32) q[4]; +cx q[4],q[0]; +rz(pi/32) q[0]; +cx q[4],q[0]; +rz(-pi/32) q[0]; +rz(-pi/16) q[4]; +cx q[4],q[1]; +rz(pi/16) q[1]; +cx q[4],q[1]; +rz(-pi/16) q[1]; +rz(-pi/8) q[4]; +cx q[4],q[2]; +rz(pi/8) q[2]; +cx q[4],q[2]; +rz(-pi/8) q[2]; +rz(-pi/4) q[4]; +cx q[4],q[3]; +rz(pi/4) q[3]; +cx q[4],q[3]; +rz(-pi/4) q[3]; +rz(pi/2) q[4]; +sx q[4]; +rz(pi/2) q[4]; +cx q[5],q[23]; +cx q[23],q[5]; +cx q[5],q[23]; +rz(-pi/16777216) q[23]; +rz(-pi/64) q[5]; +cx q[5],q[0]; +rz(pi/64) q[0]; +cx q[5],q[0]; +rz(-pi/64) q[0]; +rz(-pi/32) q[5]; +cx q[5],q[1]; +rz(pi/32) q[1]; +cx q[5],q[1]; +rz(-pi/32) q[1]; +rz(-pi/16) q[5]; +cx q[5],q[2]; +rz(pi/16) q[2]; +cx q[5],q[2]; +rz(-pi/16) q[2]; +rz(-pi/8) q[5]; +cx q[5],q[3]; +rz(pi/8) q[3]; +cx q[5],q[3]; +rz(-pi/8) q[3]; +rz(-pi/4) q[5]; +cx q[5],q[4]; +rz(pi/4) q[4]; +cx q[5],q[4]; +rz(-pi/4) q[4]; +rz(pi/2) q[5]; +sx q[5]; +rz(pi/2) q[5]; +cx q[6],q[22]; +cx q[22],q[6]; +cx q[6],q[22]; +rz(-pi/8388608) q[22]; +rz(-pi/128) q[6]; +cx q[6],q[0]; +rz(pi/128) q[0]; +cx q[6],q[0]; +rz(-pi/128) q[0]; +rz(-pi/64) q[6]; +cx q[6],q[1]; +rz(pi/64) q[1]; +cx q[6],q[1]; +rz(-pi/64) q[1]; +rz(-pi/32) q[6]; +cx q[6],q[2]; +rz(pi/32) q[2]; +cx q[6],q[2]; +rz(-pi/32) q[2]; +rz(-pi/16) q[6]; +cx q[6],q[3]; +rz(pi/16) q[3]; +cx q[6],q[3]; +rz(-pi/16) q[3]; +rz(-pi/8) q[6]; +cx q[6],q[4]; +rz(pi/8) q[4]; +cx q[6],q[4]; +rz(-pi/8) q[4]; +rz(-pi/4) q[6]; +cx q[6],q[5]; +rz(pi/4) q[5]; +cx q[6],q[5]; +rz(-pi/4) q[5]; +rz(pi/2) q[6]; +sx q[6]; +rz(pi/2) q[6]; +cx q[7],q[21]; +cx q[21],q[7]; +cx q[7],q[21]; +rz(-pi/4194304) q[21]; +rz(-pi/256) q[7]; +cx q[7],q[0]; +rz(pi/256) q[0]; +cx q[7],q[0]; +rz(-pi/256) q[0]; +rz(-pi/128) q[7]; +cx q[7],q[1]; +rz(pi/128) q[1]; +cx q[7],q[1]; +rz(-pi/128) q[1]; +rz(-pi/64) q[7]; +cx q[7],q[2]; +rz(pi/64) q[2]; +cx q[7],q[2]; +rz(-pi/64) q[2]; +rz(-pi/32) q[7]; +cx q[7],q[3]; +rz(pi/32) q[3]; +cx q[7],q[3]; +rz(-pi/32) q[3]; +rz(-pi/16) q[7]; +cx q[7],q[4]; +rz(pi/16) q[4]; +cx q[7],q[4]; +rz(-pi/16) q[4]; +rz(-pi/8) q[7]; +cx q[7],q[5]; +rz(pi/8) q[5]; +cx q[7],q[5]; +rz(-pi/8) q[5]; +rz(-pi/4) q[7]; +cx q[7],q[6]; +rz(pi/4) q[6]; +cx q[7],q[6]; +rz(-pi/4) q[6]; +rz(pi/2) q[7]; +sx q[7]; +rz(pi/2) q[7]; +cx q[8],q[20]; +cx q[20],q[8]; +cx q[8],q[20]; +rz(-pi/2097152) q[20]; +rz(-pi/512) q[8]; +cx q[8],q[0]; +rz(pi/512) q[0]; +cx q[8],q[0]; +rz(-pi/512) q[0]; +rz(-pi/256) q[8]; +cx q[8],q[1]; +rz(pi/256) q[1]; +cx q[8],q[1]; +rz(-pi/256) q[1]; +rz(-pi/128) q[8]; +cx q[8],q[2]; +rz(pi/128) q[2]; +cx q[8],q[2]; +rz(-pi/128) q[2]; +rz(-pi/64) q[8]; +cx q[8],q[3]; +rz(pi/64) q[3]; +cx q[8],q[3]; +rz(-pi/64) q[3]; +rz(-pi/32) q[8]; +cx q[8],q[4]; +rz(pi/32) q[4]; +cx q[8],q[4]; +rz(-pi/32) q[4]; +rz(-pi/16) q[8]; +cx q[8],q[5]; +rz(pi/16) q[5]; +cx q[8],q[5]; +rz(-pi/16) q[5]; +rz(-pi/8) q[8]; +cx q[8],q[6]; +rz(pi/8) q[6]; +cx q[8],q[6]; +rz(-pi/8) q[6]; +rz(-pi/4) q[8]; +cx q[8],q[7]; +rz(pi/4) q[7]; +cx q[8],q[7]; +rz(-pi/4) q[7]; +rz(pi/2) q[8]; +sx q[8]; +rz(pi/2) q[8]; +rz(-1.3881747155746205) q[9]; +cx q[9],q[19]; +cx q[19],q[9]; +cx q[9],q[19]; +rz(-pi/1048576) q[19]; +rz(-pi/1024) q[9]; +cx q[9],q[0]; +rz(pi/1024) q[0]; +cx q[9],q[0]; +rz(-pi/1024) q[0]; +cx q[10],q[0]; +rz(pi/2048) q[0]; +cx q[10],q[0]; +rz(-pi/2048) q[0]; +rz(-pi/1024) q[10]; +cx q[11],q[0]; +rz(pi/4096) q[0]; +cx q[11],q[0]; +rz(-pi/4096) q[0]; +rz(-pi/2048) q[11]; +cx q[12],q[0]; +rz(pi/8192) q[0]; +cx q[12],q[0]; +rz(-pi/8192) q[0]; +rz(-pi/4096) q[12]; +cx q[13],q[0]; +rz(pi/16384) q[0]; +cx q[13],q[0]; +rz(-pi/16384) q[0]; +rz(-pi/8192) q[13]; +cx q[14],q[0]; +rz(pi/32768) q[0]; +cx q[14],q[0]; +rz(-pi/32768) q[0]; +rz(-pi/16384) q[14]; +cx q[15],q[0]; +rz(pi/65536) q[0]; +cx q[15],q[0]; +rz(-pi/65536) q[0]; +rz(-pi/32768) q[15]; +cx q[16],q[0]; +rz(pi/131072) q[0]; +cx q[16],q[0]; +rz(-pi/131072) q[0]; +rz(-pi/65536) q[16]; +cx q[17],q[0]; +rz(pi/262144) q[0]; +cx q[17],q[0]; +rz(-pi/262144) q[0]; +rz(-pi/131072) q[17]; +cx q[18],q[0]; +rz(pi/524288) q[0]; +cx q[18],q[0]; +rz(-pi/524288) q[0]; +rz(-pi/262144) q[18]; +cx q[19],q[0]; +rz(pi/1048576) q[0]; +cx q[19],q[0]; +rz(-pi/1048576) q[0]; +rz(-pi/524288) q[19]; +cx q[20],q[0]; +rz(pi/2097152) q[0]; +cx q[20],q[0]; +rz(-pi/2097152) q[0]; +rz(-pi/1048576) q[20]; +cx q[21],q[0]; +rz(pi/4194304) q[0]; +cx q[21],q[0]; +rz(-pi/4194304) q[0]; +rz(-pi/2097152) q[21]; +cx q[22],q[0]; +rz(pi/8388608) q[0]; +cx q[22],q[0]; +rz(-pi/8388608) q[0]; +rz(-pi/4194304) q[22]; +cx q[23],q[0]; +rz(pi/16777216) q[0]; +cx q[23],q[0]; +rz(-pi/16777216) q[0]; +rz(-pi/8388608) q[23]; +cx q[24],q[0]; +rz(pi/33554432) q[0]; +cx q[24],q[0]; +rz(-pi/33554432) q[0]; +rz(-pi/16777216) q[24]; +cx q[25],q[0]; +rz(pi/67108864) q[0]; +cx q[25],q[0]; +rz(-pi/67108864) q[0]; +rz(-pi/33554432) q[25]; +cx q[26],q[0]; +rz(pi/134217728) q[0]; +cx q[26],q[0]; +rz(-pi/134217728) q[0]; +rz(-pi/67108864) q[26]; +cx q[27],q[0]; +rz(pi/268435456) q[0]; +cx q[27],q[0]; +rz(-pi/268435456) q[0]; +rz(-pi/134217728) q[27]; +cx q[28],q[0]; +rz(pi/536870912) q[0]; +cx q[28],q[0]; +rz(-pi/536870912) q[0]; +rz(-pi/268435456) q[28]; +rz(-pi/512) q[9]; +cx q[9],q[1]; +rz(pi/512) q[1]; +cx q[9],q[1]; +rz(-pi/512) q[1]; +cx q[10],q[1]; +rz(pi/1024) q[1]; +cx q[10],q[1]; +rz(-pi/1024) q[1]; +rz(-pi/512) q[10]; +cx q[11],q[1]; +rz(pi/2048) q[1]; +cx q[11],q[1]; +rz(-pi/2048) q[1]; +rz(-pi/1024) q[11]; +cx q[12],q[1]; +rz(pi/4096) q[1]; +cx q[12],q[1]; +rz(-pi/4096) q[1]; +rz(-pi/2048) q[12]; +cx q[13],q[1]; +rz(pi/8192) q[1]; +cx q[13],q[1]; +rz(-pi/8192) q[1]; +rz(-pi/4096) q[13]; +cx q[14],q[1]; +rz(pi/16384) q[1]; +cx q[14],q[1]; +rz(-pi/16384) q[1]; +rz(-pi/8192) q[14]; +cx q[15],q[1]; +rz(pi/32768) q[1]; +cx q[15],q[1]; +rz(-pi/32768) q[1]; +rz(-pi/16384) q[15]; +cx q[16],q[1]; +rz(pi/65536) q[1]; +cx q[16],q[1]; +rz(-pi/65536) q[1]; +rz(-pi/32768) q[16]; +cx q[17],q[1]; +rz(pi/131072) q[1]; +cx q[17],q[1]; +rz(-pi/131072) q[1]; +rz(-pi/65536) q[17]; +cx q[18],q[1]; +rz(pi/262144) q[1]; +cx q[18],q[1]; +rz(-pi/262144) q[1]; +rz(-pi/131072) q[18]; +cx q[19],q[1]; +rz(pi/524288) q[1]; +cx q[19],q[1]; +rz(-pi/524288) q[1]; +rz(-pi/262144) q[19]; +cx q[20],q[1]; +rz(pi/1048576) q[1]; +cx q[20],q[1]; +rz(-pi/1048576) q[1]; +rz(-pi/524288) q[20]; +cx q[21],q[1]; +rz(pi/2097152) q[1]; +cx q[21],q[1]; +rz(-pi/2097152) q[1]; +rz(-pi/1048576) q[21]; +cx q[22],q[1]; +rz(pi/4194304) q[1]; +cx q[22],q[1]; +rz(-pi/4194304) q[1]; +rz(-pi/2097152) q[22]; +cx q[23],q[1]; +rz(pi/8388608) q[1]; +cx q[23],q[1]; +rz(-pi/8388608) q[1]; +rz(-pi/4194304) q[23]; +cx q[24],q[1]; +rz(pi/16777216) q[1]; +cx q[24],q[1]; +rz(-pi/16777216) q[1]; +rz(-pi/8388608) q[24]; +cx q[25],q[1]; +rz(pi/33554432) q[1]; +cx q[25],q[1]; +rz(-pi/33554432) q[1]; +rz(-pi/16777216) q[25]; +cx q[26],q[1]; +rz(pi/67108864) q[1]; +cx q[26],q[1]; +rz(-pi/67108864) q[1]; +rz(-pi/33554432) q[26]; +cx q[27],q[1]; +rz(pi/134217728) q[1]; +cx q[27],q[1]; +rz(-pi/134217728) q[1]; +rz(-pi/67108864) q[27]; +cx q[28],q[1]; +rz(pi/268435456) q[1]; +cx q[28],q[1]; +rz(-pi/268435456) q[1]; +rz(-pi/134217728) q[28]; +rz(-pi/256) q[9]; +cx q[9],q[2]; +rz(pi/256) q[2]; +cx q[9],q[2]; +rz(-pi/256) q[2]; +cx q[10],q[2]; +rz(pi/512) q[2]; +cx q[10],q[2]; +rz(-pi/256) q[10]; +rz(-pi/512) q[2]; +cx q[11],q[2]; +rz(pi/1024) q[2]; +cx q[11],q[2]; +rz(-pi/512) q[11]; +rz(-pi/1024) q[2]; +cx q[12],q[2]; +rz(pi/2048) q[2]; +cx q[12],q[2]; +rz(-pi/1024) q[12]; +rz(-pi/2048) q[2]; +cx q[13],q[2]; +rz(pi/4096) q[2]; +cx q[13],q[2]; +rz(-pi/2048) q[13]; +rz(-pi/4096) q[2]; +cx q[14],q[2]; +rz(pi/8192) q[2]; +cx q[14],q[2]; +rz(-pi/4096) q[14]; +rz(-pi/8192) q[2]; +cx q[15],q[2]; +rz(pi/16384) q[2]; +cx q[15],q[2]; +rz(-pi/8192) q[15]; +rz(-pi/16384) q[2]; +cx q[16],q[2]; +rz(pi/32768) q[2]; +cx q[16],q[2]; +rz(-pi/16384) q[16]; +rz(-pi/32768) q[2]; +cx q[17],q[2]; +rz(pi/65536) q[2]; +cx q[17],q[2]; +rz(-pi/32768) q[17]; +rz(-pi/65536) q[2]; +cx q[18],q[2]; +rz(pi/131072) q[2]; +cx q[18],q[2]; +rz(-pi/65536) q[18]; +rz(-pi/131072) q[2]; +cx q[19],q[2]; +rz(pi/262144) q[2]; +cx q[19],q[2]; +rz(-pi/131072) q[19]; +rz(-pi/262144) q[2]; +cx q[20],q[2]; +rz(pi/524288) q[2]; +cx q[20],q[2]; +rz(-pi/524288) q[2]; +rz(-pi/262144) q[20]; +cx q[21],q[2]; +rz(pi/1048576) q[2]; +cx q[21],q[2]; +rz(-pi/1048576) q[2]; +rz(-pi/524288) q[21]; +cx q[22],q[2]; +rz(pi/2097152) q[2]; +cx q[22],q[2]; +rz(-pi/2097152) q[2]; +rz(-pi/1048576) q[22]; +cx q[23],q[2]; +rz(pi/4194304) q[2]; +cx q[23],q[2]; +rz(-pi/4194304) q[2]; +rz(-pi/2097152) q[23]; +cx q[24],q[2]; +rz(pi/8388608) q[2]; +cx q[24],q[2]; +rz(-pi/8388608) q[2]; +rz(-pi/4194304) q[24]; +cx q[25],q[2]; +rz(pi/16777216) q[2]; +cx q[25],q[2]; +rz(-pi/16777216) q[2]; +rz(-pi/8388608) q[25]; +cx q[26],q[2]; +rz(pi/33554432) q[2]; +cx q[26],q[2]; +rz(-pi/33554432) q[2]; +rz(-pi/16777216) q[26]; +cx q[27],q[2]; +rz(pi/67108864) q[2]; +cx q[27],q[2]; +rz(-pi/67108864) q[2]; +rz(-pi/33554432) q[27]; +cx q[28],q[2]; +rz(pi/134217728) q[2]; +cx q[28],q[2]; +rz(-pi/134217728) q[2]; +rz(-pi/67108864) q[28]; +rz(-pi/128) q[9]; +cx q[9],q[3]; +rz(pi/128) q[3]; +cx q[9],q[3]; +rz(-pi/128) q[3]; +cx q[10],q[3]; +rz(pi/256) q[3]; +cx q[10],q[3]; +rz(-pi/128) q[10]; +rz(-pi/256) q[3]; +cx q[11],q[3]; +rz(pi/512) q[3]; +cx q[11],q[3]; +rz(-pi/256) q[11]; +rz(-pi/512) q[3]; +cx q[12],q[3]; +rz(pi/1024) q[3]; +cx q[12],q[3]; +rz(-pi/512) q[12]; +rz(-pi/1024) q[3]; +cx q[13],q[3]; +rz(pi/2048) q[3]; +cx q[13],q[3]; +rz(-pi/1024) q[13]; +rz(-pi/2048) q[3]; +cx q[14],q[3]; +rz(pi/4096) q[3]; +cx q[14],q[3]; +rz(-pi/2048) q[14]; +rz(-pi/4096) q[3]; +cx q[15],q[3]; +rz(pi/8192) q[3]; +cx q[15],q[3]; +rz(-pi/4096) q[15]; +rz(-pi/8192) q[3]; +cx q[16],q[3]; +rz(pi/16384) q[3]; +cx q[16],q[3]; +rz(-pi/8192) q[16]; +rz(-pi/16384) q[3]; +cx q[17],q[3]; +rz(pi/32768) q[3]; +cx q[17],q[3]; +rz(-pi/16384) q[17]; +rz(-pi/32768) q[3]; +cx q[18],q[3]; +rz(pi/65536) q[3]; +cx q[18],q[3]; +rz(-pi/32768) q[18]; +rz(-pi/65536) q[3]; +cx q[19],q[3]; +rz(pi/131072) q[3]; +cx q[19],q[3]; +rz(-pi/65536) q[19]; +rz(-pi/131072) q[3]; +cx q[20],q[3]; +rz(pi/262144) q[3]; +cx q[20],q[3]; +rz(-pi/131072) q[20]; +rz(-pi/262144) q[3]; +cx q[21],q[3]; +rz(pi/524288) q[3]; +cx q[21],q[3]; +rz(-pi/262144) q[21]; +rz(-pi/524288) q[3]; +cx q[22],q[3]; +rz(pi/1048576) q[3]; +cx q[22],q[3]; +rz(-pi/524288) q[22]; +rz(-pi/1048576) q[3]; +cx q[23],q[3]; +rz(pi/2097152) q[3]; +cx q[23],q[3]; +rz(-pi/1048576) q[23]; +rz(-pi/2097152) q[3]; +cx q[24],q[3]; +rz(pi/4194304) q[3]; +cx q[24],q[3]; +rz(-pi/2097152) q[24]; +rz(-pi/4194304) q[3]; +cx q[25],q[3]; +rz(pi/8388608) q[3]; +cx q[25],q[3]; +rz(-pi/4194304) q[25]; +rz(-pi/8388608) q[3]; +cx q[26],q[3]; +rz(pi/16777216) q[3]; +cx q[26],q[3]; +rz(-pi/8388608) q[26]; +rz(-pi/16777216) q[3]; +cx q[27],q[3]; +rz(pi/33554432) q[3]; +cx q[27],q[3]; +rz(-pi/16777216) q[27]; +rz(-pi/33554432) q[3]; +cx q[28],q[3]; +rz(pi/67108864) q[3]; +cx q[28],q[3]; +rz(-pi/33554432) q[28]; +rz(-pi/67108864) q[3]; +rz(-pi/64) q[9]; +cx q[9],q[4]; +rz(pi/64) q[4]; +cx q[9],q[4]; +rz(-pi/64) q[4]; +cx q[10],q[4]; +rz(pi/128) q[4]; +cx q[10],q[4]; +rz(-pi/64) q[10]; +rz(-pi/128) q[4]; +cx q[11],q[4]; +rz(pi/256) q[4]; +cx q[11],q[4]; +rz(-pi/128) q[11]; +rz(-pi/256) q[4]; +cx q[12],q[4]; +rz(pi/512) q[4]; +cx q[12],q[4]; +rz(-pi/256) q[12]; +rz(-pi/512) q[4]; +cx q[13],q[4]; +rz(pi/1024) q[4]; +cx q[13],q[4]; +rz(-pi/512) q[13]; +rz(-pi/1024) q[4]; +cx q[14],q[4]; +rz(pi/2048) q[4]; +cx q[14],q[4]; +rz(-pi/1024) q[14]; +rz(-pi/2048) q[4]; +cx q[15],q[4]; +rz(pi/4096) q[4]; +cx q[15],q[4]; +rz(-pi/2048) q[15]; +rz(-pi/4096) q[4]; +cx q[16],q[4]; +rz(pi/8192) q[4]; +cx q[16],q[4]; +rz(-pi/4096) q[16]; +rz(-pi/8192) q[4]; +cx q[17],q[4]; +rz(pi/16384) q[4]; +cx q[17],q[4]; +rz(-pi/8192) q[17]; +rz(-pi/16384) q[4]; +cx q[18],q[4]; +rz(pi/32768) q[4]; +cx q[18],q[4]; +rz(-pi/16384) q[18]; +rz(-pi/32768) q[4]; +cx q[19],q[4]; +rz(pi/65536) q[4]; +cx q[19],q[4]; +rz(-pi/32768) q[19]; +rz(-pi/65536) q[4]; +cx q[20],q[4]; +rz(pi/131072) q[4]; +cx q[20],q[4]; +rz(-pi/65536) q[20]; +rz(-pi/131072) q[4]; +cx q[21],q[4]; +rz(pi/262144) q[4]; +cx q[21],q[4]; +rz(-pi/131072) q[21]; +rz(-pi/262144) q[4]; +cx q[22],q[4]; +rz(pi/524288) q[4]; +cx q[22],q[4]; +rz(-pi/262144) q[22]; +rz(-pi/524288) q[4]; +cx q[23],q[4]; +rz(pi/1048576) q[4]; +cx q[23],q[4]; +rz(-pi/524288) q[23]; +rz(-pi/1048576) q[4]; +cx q[24],q[4]; +rz(pi/2097152) q[4]; +cx q[24],q[4]; +rz(-pi/1048576) q[24]; +rz(-pi/2097152) q[4]; +cx q[25],q[4]; +rz(pi/4194304) q[4]; +cx q[25],q[4]; +rz(-pi/2097152) q[25]; +rz(-pi/4194304) q[4]; +cx q[26],q[4]; +rz(pi/8388608) q[4]; +cx q[26],q[4]; +rz(-pi/4194304) q[26]; +rz(-pi/8388608) q[4]; +cx q[27],q[4]; +rz(pi/16777216) q[4]; +cx q[27],q[4]; +rz(-pi/8388608) q[27]; +rz(-pi/16777216) q[4]; +cx q[28],q[4]; +rz(pi/33554432) q[4]; +cx q[28],q[4]; +rz(-pi/16777216) q[28]; +rz(-pi/33554432) q[4]; +rz(-pi/32) q[9]; +cx q[9],q[5]; +rz(pi/32) q[5]; +cx q[9],q[5]; +rz(-pi/32) q[5]; +cx q[10],q[5]; +rz(pi/64) q[5]; +cx q[10],q[5]; +rz(-pi/32) q[10]; +rz(-pi/64) q[5]; +cx q[11],q[5]; +rz(pi/128) q[5]; +cx q[11],q[5]; +rz(-pi/64) q[11]; +rz(-pi/128) q[5]; +cx q[12],q[5]; +rz(pi/256) q[5]; +cx q[12],q[5]; +rz(-pi/128) q[12]; +rz(-pi/256) q[5]; +cx q[13],q[5]; +rz(pi/512) q[5]; +cx q[13],q[5]; +rz(-pi/256) q[13]; +rz(-pi/512) q[5]; +cx q[14],q[5]; +rz(pi/1024) q[5]; +cx q[14],q[5]; +rz(-pi/512) q[14]; +rz(-pi/1024) q[5]; +cx q[15],q[5]; +rz(pi/2048) q[5]; +cx q[15],q[5]; +rz(-pi/1024) q[15]; +rz(-pi/2048) q[5]; +cx q[16],q[5]; +rz(pi/4096) q[5]; +cx q[16],q[5]; +rz(-pi/2048) q[16]; +rz(-pi/4096) q[5]; +cx q[17],q[5]; +rz(pi/8192) q[5]; +cx q[17],q[5]; +rz(-pi/4096) q[17]; +rz(-pi/8192) q[5]; +cx q[18],q[5]; +rz(pi/16384) q[5]; +cx q[18],q[5]; +rz(-pi/8192) q[18]; +rz(-pi/16384) q[5]; +cx q[19],q[5]; +rz(pi/32768) q[5]; +cx q[19],q[5]; +rz(-pi/16384) q[19]; +rz(-pi/32768) q[5]; +cx q[20],q[5]; +rz(pi/65536) q[5]; +cx q[20],q[5]; +rz(-pi/32768) q[20]; +rz(-pi/65536) q[5]; +cx q[21],q[5]; +rz(pi/131072) q[5]; +cx q[21],q[5]; +rz(-pi/65536) q[21]; +rz(-pi/131072) q[5]; +cx q[22],q[5]; +rz(pi/262144) q[5]; +cx q[22],q[5]; +rz(-pi/131072) q[22]; +rz(-pi/262144) q[5]; +cx q[23],q[5]; +rz(pi/524288) q[5]; +cx q[23],q[5]; +rz(-pi/262144) q[23]; +rz(-pi/524288) q[5]; +cx q[24],q[5]; +rz(pi/1048576) q[5]; +cx q[24],q[5]; +rz(-pi/524288) q[24]; +rz(-pi/1048576) q[5]; +cx q[25],q[5]; +rz(pi/2097152) q[5]; +cx q[25],q[5]; +rz(-pi/1048576) q[25]; +rz(-pi/2097152) q[5]; +cx q[26],q[5]; +rz(pi/4194304) q[5]; +cx q[26],q[5]; +rz(-pi/2097152) q[26]; +rz(-pi/4194304) q[5]; +cx q[27],q[5]; +rz(pi/8388608) q[5]; +cx q[27],q[5]; +rz(-pi/4194304) q[27]; +rz(-pi/8388608) q[5]; +cx q[28],q[5]; +rz(pi/16777216) q[5]; +cx q[28],q[5]; +rz(-pi/8388608) q[28]; +rz(-pi/16777216) q[5]; +rz(-pi/16) q[9]; +cx q[9],q[6]; +rz(pi/16) q[6]; +cx q[9],q[6]; +rz(-pi/16) q[6]; +cx q[10],q[6]; +rz(pi/32) q[6]; +cx q[10],q[6]; +rz(-pi/16) q[10]; +rz(-pi/32) q[6]; +cx q[11],q[6]; +rz(pi/64) q[6]; +cx q[11],q[6]; +rz(-pi/32) q[11]; +rz(-pi/64) q[6]; +cx q[12],q[6]; +rz(pi/128) q[6]; +cx q[12],q[6]; +rz(-pi/64) q[12]; +rz(-pi/128) q[6]; +cx q[13],q[6]; +rz(pi/256) q[6]; +cx q[13],q[6]; +rz(-pi/128) q[13]; +rz(-pi/256) q[6]; +cx q[14],q[6]; +rz(pi/512) q[6]; +cx q[14],q[6]; +rz(-pi/256) q[14]; +rz(-pi/512) q[6]; +cx q[15],q[6]; +rz(pi/1024) q[6]; +cx q[15],q[6]; +rz(-pi/512) q[15]; +rz(-pi/1024) q[6]; +cx q[16],q[6]; +rz(pi/2048) q[6]; +cx q[16],q[6]; +rz(-pi/1024) q[16]; +rz(-pi/2048) q[6]; +cx q[17],q[6]; +rz(pi/4096) q[6]; +cx q[17],q[6]; +rz(-pi/2048) q[17]; +rz(-pi/4096) q[6]; +cx q[18],q[6]; +rz(pi/8192) q[6]; +cx q[18],q[6]; +rz(-pi/4096) q[18]; +rz(-pi/8192) q[6]; +cx q[19],q[6]; +rz(pi/16384) q[6]; +cx q[19],q[6]; +rz(-pi/8192) q[19]; +rz(-pi/16384) q[6]; +cx q[20],q[6]; +rz(pi/32768) q[6]; +cx q[20],q[6]; +rz(-pi/16384) q[20]; +rz(-pi/32768) q[6]; +cx q[21],q[6]; +rz(pi/65536) q[6]; +cx q[21],q[6]; +rz(-pi/32768) q[21]; +rz(-pi/65536) q[6]; +cx q[22],q[6]; +rz(pi/131072) q[6]; +cx q[22],q[6]; +rz(-pi/65536) q[22]; +rz(-pi/131072) q[6]; +cx q[23],q[6]; +rz(pi/262144) q[6]; +cx q[23],q[6]; +rz(-pi/131072) q[23]; +rz(-pi/262144) q[6]; +cx q[24],q[6]; +rz(pi/524288) q[6]; +cx q[24],q[6]; +rz(-pi/262144) q[24]; +rz(-pi/524288) q[6]; +cx q[25],q[6]; +rz(pi/1048576) q[6]; +cx q[25],q[6]; +rz(-pi/524288) q[25]; +rz(-pi/1048576) q[6]; +cx q[26],q[6]; +rz(pi/2097152) q[6]; +cx q[26],q[6]; +rz(-pi/1048576) q[26]; +rz(-pi/2097152) q[6]; +cx q[27],q[6]; +rz(pi/4194304) q[6]; +cx q[27],q[6]; +rz(-pi/2097152) q[27]; +rz(-pi/4194304) q[6]; +cx q[28],q[6]; +rz(pi/8388608) q[6]; +cx q[28],q[6]; +rz(-pi/4194304) q[28]; +rz(-pi/8388608) q[6]; +rz(-pi/8) q[9]; +cx q[9],q[7]; +rz(pi/8) q[7]; +cx q[9],q[7]; +rz(-pi/8) q[7]; +cx q[10],q[7]; +rz(pi/16) q[7]; +cx q[10],q[7]; +rz(-pi/8) q[10]; +rz(-pi/16) q[7]; +cx q[11],q[7]; +rz(pi/32) q[7]; +cx q[11],q[7]; +rz(-pi/16) q[11]; +rz(-pi/32) q[7]; +cx q[12],q[7]; +rz(pi/64) q[7]; +cx q[12],q[7]; +rz(-pi/32) q[12]; +rz(-pi/64) q[7]; +cx q[13],q[7]; +rz(pi/128) q[7]; +cx q[13],q[7]; +rz(-pi/64) q[13]; +rz(-pi/128) q[7]; +cx q[14],q[7]; +rz(pi/256) q[7]; +cx q[14],q[7]; +rz(-pi/128) q[14]; +rz(-pi/256) q[7]; +cx q[15],q[7]; +rz(pi/512) q[7]; +cx q[15],q[7]; +rz(-pi/256) q[15]; +rz(-pi/512) q[7]; +cx q[16],q[7]; +rz(pi/1024) q[7]; +cx q[16],q[7]; +rz(-pi/512) q[16]; +rz(-pi/1024) q[7]; +cx q[17],q[7]; +rz(pi/2048) q[7]; +cx q[17],q[7]; +rz(-pi/1024) q[17]; +rz(-pi/2048) q[7]; +cx q[18],q[7]; +rz(pi/4096) q[7]; +cx q[18],q[7]; +rz(-pi/2048) q[18]; +rz(-pi/4096) q[7]; +cx q[19],q[7]; +rz(pi/8192) q[7]; +cx q[19],q[7]; +rz(-pi/4096) q[19]; +rz(-pi/8192) q[7]; +cx q[20],q[7]; +rz(pi/16384) q[7]; +cx q[20],q[7]; +rz(-pi/8192) q[20]; +rz(-pi/16384) q[7]; +cx q[21],q[7]; +rz(pi/32768) q[7]; +cx q[21],q[7]; +rz(-pi/16384) q[21]; +rz(-pi/32768) q[7]; +cx q[22],q[7]; +rz(pi/65536) q[7]; +cx q[22],q[7]; +rz(-pi/32768) q[22]; +rz(-pi/65536) q[7]; +cx q[23],q[7]; +rz(pi/131072) q[7]; +cx q[23],q[7]; +rz(-pi/65536) q[23]; +rz(-pi/131072) q[7]; +cx q[24],q[7]; +rz(pi/262144) q[7]; +cx q[24],q[7]; +rz(-pi/131072) q[24]; +rz(-pi/262144) q[7]; +cx q[25],q[7]; +rz(pi/524288) q[7]; +cx q[25],q[7]; +rz(-pi/262144) q[25]; +rz(-pi/524288) q[7]; +cx q[26],q[7]; +rz(pi/1048576) q[7]; +cx q[26],q[7]; +rz(-pi/524288) q[26]; +rz(-pi/1048576) q[7]; +cx q[27],q[7]; +rz(pi/2097152) q[7]; +cx q[27],q[7]; +rz(-pi/1048576) q[27]; +rz(-pi/2097152) q[7]; +cx q[28],q[7]; +rz(pi/4194304) q[7]; +cx q[28],q[7]; +rz(-pi/2097152) q[28]; +rz(-pi/4194304) q[7]; +rz(-pi/4) q[9]; +cx q[9],q[8]; +rz(pi/4) q[8]; +cx q[9],q[8]; +rz(-pi/4) q[8]; +cx q[10],q[8]; +rz(pi/8) q[8]; +cx q[10],q[8]; +rz(-pi/4) q[10]; +rz(-pi/8) q[8]; +cx q[11],q[8]; +rz(pi/16) q[8]; +cx q[11],q[8]; +rz(-pi/8) q[11]; +rz(-pi/16) q[8]; +cx q[12],q[8]; +rz(pi/32) q[8]; +cx q[12],q[8]; +rz(-pi/16) q[12]; +rz(-pi/32) q[8]; +cx q[13],q[8]; +rz(pi/64) q[8]; +cx q[13],q[8]; +rz(-pi/32) q[13]; +rz(-pi/64) q[8]; +cx q[14],q[8]; +rz(pi/128) q[8]; +cx q[14],q[8]; +rz(-pi/64) q[14]; +rz(-pi/128) q[8]; +cx q[15],q[8]; +rz(pi/256) q[8]; +cx q[15],q[8]; +rz(-pi/128) q[15]; +rz(-pi/256) q[8]; +cx q[16],q[8]; +rz(pi/512) q[8]; +cx q[16],q[8]; +rz(-pi/256) q[16]; +rz(-pi/512) q[8]; +cx q[17],q[8]; +rz(pi/1024) q[8]; +cx q[17],q[8]; +rz(-pi/512) q[17]; +rz(-pi/1024) q[8]; +cx q[18],q[8]; +rz(pi/2048) q[8]; +cx q[18],q[8]; +rz(-pi/1024) q[18]; +rz(-pi/2048) q[8]; +cx q[19],q[8]; +rz(pi/4096) q[8]; +cx q[19],q[8]; +rz(-pi/2048) q[19]; +rz(-pi/4096) q[8]; +cx q[20],q[8]; +rz(pi/8192) q[8]; +cx q[20],q[8]; +rz(-pi/4096) q[20]; +rz(-pi/8192) q[8]; +cx q[21],q[8]; +rz(pi/16384) q[8]; +cx q[21],q[8]; +rz(-pi/8192) q[21]; +rz(-pi/16384) q[8]; +cx q[22],q[8]; +rz(pi/32768) q[8]; +cx q[22],q[8]; +rz(-pi/16384) q[22]; +rz(-pi/32768) q[8]; +cx q[23],q[8]; +rz(pi/65536) q[8]; +cx q[23],q[8]; +rz(-pi/32768) q[23]; +rz(-pi/65536) q[8]; +cx q[24],q[8]; +rz(pi/131072) q[8]; +cx q[24],q[8]; +rz(-pi/65536) q[24]; +rz(-pi/131072) q[8]; +cx q[25],q[8]; +rz(pi/262144) q[8]; +cx q[25],q[8]; +rz(-pi/131072) q[25]; +rz(-pi/262144) q[8]; +cx q[26],q[8]; +rz(pi/524288) q[8]; +cx q[26],q[8]; +rz(-pi/262144) q[26]; +rz(-pi/524288) q[8]; +cx q[27],q[8]; +rz(pi/1048576) q[8]; +cx q[27],q[8]; +rz(-pi/524288) q[27]; +rz(-pi/1048576) q[8]; +cx q[28],q[8]; +rz(pi/2097152) q[8]; +cx q[28],q[8]; +rz(-pi/1048576) q[28]; +rz(-pi/2097152) q[8]; +rz(pi/2) q[9]; +sx q[9]; +rz(pi/2) q[9]; +cx q[10],q[9]; +rz(pi/4) q[9]; +cx q[10],q[9]; +rz(pi/2) q[10]; +sx q[10]; +rz(pi/2) q[10]; +rz(-pi/4) q[9]; +cx q[11],q[9]; +rz(pi/8) q[9]; +cx q[11],q[9]; +rz(-pi/4) q[11]; +cx q[11],q[10]; +rz(pi/4) q[10]; +cx q[11],q[10]; +rz(-pi/4) q[10]; +rz(pi/2) q[11]; +sx q[11]; +rz(pi/2) q[11]; +rz(-pi/8) q[9]; +cx q[12],q[9]; +rz(pi/16) q[9]; +cx q[12],q[9]; +rz(-pi/8) q[12]; +cx q[12],q[10]; +rz(pi/8) q[10]; +cx q[12],q[10]; +rz(-pi/8) q[10]; +rz(-pi/4) q[12]; +cx q[12],q[11]; +rz(pi/4) q[11]; +cx q[12],q[11]; +rz(-pi/4) q[11]; +rz(pi/2) q[12]; +sx q[12]; +rz(pi/2) q[12]; +rz(-pi/16) q[9]; +cx q[13],q[9]; +rz(pi/32) q[9]; +cx q[13],q[9]; +rz(-pi/16) q[13]; +cx q[13],q[10]; +rz(pi/16) q[10]; +cx q[13],q[10]; +rz(-pi/16) q[10]; +rz(-pi/8) q[13]; +cx q[13],q[11]; +rz(pi/8) q[11]; +cx q[13],q[11]; +rz(-pi/8) q[11]; +rz(-pi/4) q[13]; +cx q[13],q[12]; +rz(pi/4) q[12]; +cx q[13],q[12]; +rz(-pi/4) q[12]; +rz(pi/2) q[13]; +sx q[13]; +rz(pi/2) q[13]; +rz(-pi/32) q[9]; +cx q[14],q[9]; +rz(pi/64) q[9]; +cx q[14],q[9]; +rz(-pi/32) q[14]; +cx q[14],q[10]; +rz(pi/32) q[10]; +cx q[14],q[10]; +rz(-pi/32) q[10]; +rz(-pi/16) q[14]; +cx q[14],q[11]; +rz(pi/16) q[11]; +cx q[14],q[11]; +rz(-pi/16) q[11]; +rz(-pi/8) q[14]; +cx q[14],q[12]; +rz(pi/8) q[12]; +cx q[14],q[12]; +rz(-pi/8) q[12]; +rz(-pi/4) q[14]; +cx q[14],q[13]; +rz(pi/4) q[13]; +cx q[14],q[13]; +rz(-pi/4) q[13]; +rz(pi/2) q[14]; +sx q[14]; +rz(pi/2) q[14]; +rz(-pi/64) q[9]; +cx q[15],q[9]; +rz(pi/128) q[9]; +cx q[15],q[9]; +rz(-pi/64) q[15]; +cx q[15],q[10]; +rz(pi/64) q[10]; +cx q[15],q[10]; +rz(-pi/64) q[10]; +rz(-pi/32) q[15]; +cx q[15],q[11]; +rz(pi/32) q[11]; +cx q[15],q[11]; +rz(-pi/32) q[11]; +rz(-pi/16) q[15]; +cx q[15],q[12]; +rz(pi/16) q[12]; +cx q[15],q[12]; +rz(-pi/16) q[12]; +rz(-pi/8) q[15]; +cx q[15],q[13]; +rz(pi/8) q[13]; +cx q[15],q[13]; +rz(-pi/8) q[13]; +rz(-pi/4) q[15]; +cx q[15],q[14]; +rz(pi/4) q[14]; +cx q[15],q[14]; +rz(-pi/4) q[14]; +rz(pi/2) q[15]; +sx q[15]; +rz(pi/2) q[15]; +rz(-pi/128) q[9]; +cx q[16],q[9]; +rz(pi/256) q[9]; +cx q[16],q[9]; +rz(-pi/128) q[16]; +cx q[16],q[10]; +rz(pi/128) q[10]; +cx q[16],q[10]; +rz(-pi/128) q[10]; +rz(-pi/64) q[16]; +cx q[16],q[11]; +rz(pi/64) q[11]; +cx q[16],q[11]; +rz(-pi/64) q[11]; +rz(-pi/32) q[16]; +cx q[16],q[12]; +rz(pi/32) q[12]; +cx q[16],q[12]; +rz(-pi/32) q[12]; +rz(-pi/16) q[16]; +cx q[16],q[13]; +rz(pi/16) q[13]; +cx q[16],q[13]; +rz(-pi/16) q[13]; +rz(-pi/8) q[16]; +cx q[16],q[14]; +rz(pi/8) q[14]; +cx q[16],q[14]; +rz(-pi/8) q[14]; +rz(-pi/4) q[16]; +cx q[16],q[15]; +rz(pi/4) q[15]; +cx q[16],q[15]; +rz(-pi/4) q[15]; +rz(pi/2) q[16]; +sx q[16]; +rz(pi/2) q[16]; +rz(-pi/256) q[9]; +cx q[17],q[9]; +rz(pi/512) q[9]; +cx q[17],q[9]; +rz(-pi/256) q[17]; +cx q[17],q[10]; +rz(pi/256) q[10]; +cx q[17],q[10]; +rz(-pi/256) q[10]; +rz(-pi/128) q[17]; +cx q[17],q[11]; +rz(pi/128) q[11]; +cx q[17],q[11]; +rz(-pi/128) q[11]; +rz(-pi/64) q[17]; +cx q[17],q[12]; +rz(pi/64) q[12]; +cx q[17],q[12]; +rz(-pi/64) q[12]; +rz(-pi/32) q[17]; +cx q[17],q[13]; +rz(pi/32) q[13]; +cx q[17],q[13]; +rz(-pi/32) q[13]; +rz(-pi/16) q[17]; +cx q[17],q[14]; +rz(pi/16) q[14]; +cx q[17],q[14]; +rz(-pi/16) q[14]; +rz(-pi/8) q[17]; +cx q[17],q[15]; +rz(pi/8) q[15]; +cx q[17],q[15]; +rz(-pi/8) q[15]; +rz(-pi/4) q[17]; +cx q[17],q[16]; +rz(pi/4) q[16]; +cx q[17],q[16]; +rz(-pi/4) q[16]; +rz(pi/2) q[17]; +sx q[17]; +rz(pi/2) q[17]; +rz(-pi/512) q[9]; +cx q[18],q[9]; +rz(pi/1024) q[9]; +cx q[18],q[9]; +rz(-pi/512) q[18]; +cx q[18],q[10]; +rz(pi/512) q[10]; +cx q[18],q[10]; +rz(-pi/512) q[10]; +rz(-pi/256) q[18]; +cx q[18],q[11]; +rz(pi/256) q[11]; +cx q[18],q[11]; +rz(-pi/256) q[11]; +rz(-pi/128) q[18]; +cx q[18],q[12]; +rz(pi/128) q[12]; +cx q[18],q[12]; +rz(-pi/128) q[12]; +rz(-pi/64) q[18]; +cx q[18],q[13]; +rz(pi/64) q[13]; +cx q[18],q[13]; +rz(-pi/64) q[13]; +rz(-pi/32) q[18]; +cx q[18],q[14]; +rz(pi/32) q[14]; +cx q[18],q[14]; +rz(-pi/32) q[14]; +rz(-pi/16) q[18]; +cx q[18],q[15]; +rz(pi/16) q[15]; +cx q[18],q[15]; +rz(-pi/16) q[15]; +rz(-pi/8) q[18]; +cx q[18],q[16]; +rz(pi/8) q[16]; +cx q[18],q[16]; +rz(-pi/8) q[16]; +rz(-pi/4) q[18]; +cx q[18],q[17]; +rz(pi/4) q[17]; +cx q[18],q[17]; +rz(-pi/4) q[17]; +rz(pi/2) q[18]; +sx q[18]; +rz(pi/2) q[18]; +rz(-pi/1024) q[9]; +cx q[19],q[9]; +rz(pi/2048) q[9]; +cx q[19],q[9]; +rz(-pi/1024) q[19]; +cx q[19],q[10]; +rz(pi/1024) q[10]; +cx q[19],q[10]; +rz(-pi/1024) q[10]; +rz(-pi/512) q[19]; +cx q[19],q[11]; +rz(pi/512) q[11]; +cx q[19],q[11]; +rz(-pi/512) q[11]; +rz(-pi/256) q[19]; +cx q[19],q[12]; +rz(pi/256) q[12]; +cx q[19],q[12]; +rz(-pi/256) q[12]; +rz(-pi/128) q[19]; +cx q[19],q[13]; +rz(pi/128) q[13]; +cx q[19],q[13]; +rz(-pi/128) q[13]; +rz(-pi/64) q[19]; +cx q[19],q[14]; +rz(pi/64) q[14]; +cx q[19],q[14]; +rz(-pi/64) q[14]; +rz(-pi/32) q[19]; +cx q[19],q[15]; +rz(pi/32) q[15]; +cx q[19],q[15]; +rz(-pi/32) q[15]; +rz(-pi/16) q[19]; +cx q[19],q[16]; +rz(pi/16) q[16]; +cx q[19],q[16]; +rz(-pi/16) q[16]; +rz(-pi/8) q[19]; +cx q[19],q[17]; +rz(pi/8) q[17]; +cx q[19],q[17]; +rz(-pi/8) q[17]; +rz(-pi/4) q[19]; +cx q[19],q[18]; +rz(pi/4) q[18]; +cx q[19],q[18]; +rz(-pi/4) q[18]; +rz(pi/2) q[19]; +sx q[19]; +rz(pi/2) q[19]; +rz(-pi/2048) q[9]; +cx q[20],q[9]; +rz(pi/4096) q[9]; +cx q[20],q[9]; +rz(-pi/2048) q[20]; +cx q[20],q[10]; +rz(pi/2048) q[10]; +cx q[20],q[10]; +rz(-pi/2048) q[10]; +rz(-pi/1024) q[20]; +cx q[20],q[11]; +rz(pi/1024) q[11]; +cx q[20],q[11]; +rz(-pi/1024) q[11]; +rz(-pi/512) q[20]; +cx q[20],q[12]; +rz(pi/512) q[12]; +cx q[20],q[12]; +rz(-pi/512) q[12]; +rz(-pi/256) q[20]; +cx q[20],q[13]; +rz(pi/256) q[13]; +cx q[20],q[13]; +rz(-pi/256) q[13]; +rz(-pi/128) q[20]; +cx q[20],q[14]; +rz(pi/128) q[14]; +cx q[20],q[14]; +rz(-pi/128) q[14]; +rz(-pi/64) q[20]; +cx q[20],q[15]; +rz(pi/64) q[15]; +cx q[20],q[15]; +rz(-pi/64) q[15]; +rz(-pi/32) q[20]; +cx q[20],q[16]; +rz(pi/32) q[16]; +cx q[20],q[16]; +rz(-pi/32) q[16]; +rz(-pi/16) q[20]; +cx q[20],q[17]; +rz(pi/16) q[17]; +cx q[20],q[17]; +rz(-pi/16) q[17]; +rz(-pi/8) q[20]; +cx q[20],q[18]; +rz(pi/8) q[18]; +cx q[20],q[18]; +rz(-pi/8) q[18]; +rz(-pi/4) q[20]; +cx q[20],q[19]; +rz(pi/4) q[19]; +cx q[20],q[19]; +rz(-pi/4) q[19]; +rz(pi/2) q[20]; +sx q[20]; +rz(pi/2) q[20]; +rz(-pi/4096) q[9]; +cx q[21],q[9]; +rz(pi/8192) q[9]; +cx q[21],q[9]; +rz(-pi/4096) q[21]; +cx q[21],q[10]; +rz(pi/4096) q[10]; +cx q[21],q[10]; +rz(-pi/4096) q[10]; +rz(-pi/2048) q[21]; +cx q[21],q[11]; +rz(pi/2048) q[11]; +cx q[21],q[11]; +rz(-pi/2048) q[11]; +rz(-pi/1024) q[21]; +cx q[21],q[12]; +rz(pi/1024) q[12]; +cx q[21],q[12]; +rz(-pi/1024) q[12]; +rz(-pi/512) q[21]; +cx q[21],q[13]; +rz(pi/512) q[13]; +cx q[21],q[13]; +rz(-pi/512) q[13]; +rz(-pi/256) q[21]; +cx q[21],q[14]; +rz(pi/256) q[14]; +cx q[21],q[14]; +rz(-pi/256) q[14]; +rz(-pi/128) q[21]; +cx q[21],q[15]; +rz(pi/128) q[15]; +cx q[21],q[15]; +rz(-pi/128) q[15]; +rz(-pi/64) q[21]; +cx q[21],q[16]; +rz(pi/64) q[16]; +cx q[21],q[16]; +rz(-pi/64) q[16]; +rz(-pi/32) q[21]; +cx q[21],q[17]; +rz(pi/32) q[17]; +cx q[21],q[17]; +rz(-pi/32) q[17]; +rz(-pi/16) q[21]; +cx q[21],q[18]; +rz(pi/16) q[18]; +cx q[21],q[18]; +rz(-pi/16) q[18]; +rz(-pi/8) q[21]; +cx q[21],q[19]; +rz(pi/8) q[19]; +cx q[21],q[19]; +rz(-pi/8) q[19]; +rz(-pi/4) q[21]; +cx q[21],q[20]; +rz(pi/4) q[20]; +cx q[21],q[20]; +rz(-pi/4) q[20]; +rz(pi/2) q[21]; +sx q[21]; +rz(pi/2) q[21]; +rz(-pi/8192) q[9]; +cx q[22],q[9]; +rz(pi/16384) q[9]; +cx q[22],q[9]; +rz(-pi/8192) q[22]; +cx q[22],q[10]; +rz(pi/8192) q[10]; +cx q[22],q[10]; +rz(-pi/8192) q[10]; +rz(-pi/4096) q[22]; +cx q[22],q[11]; +rz(pi/4096) q[11]; +cx q[22],q[11]; +rz(-pi/4096) q[11]; +rz(-pi/2048) q[22]; +cx q[22],q[12]; +rz(pi/2048) q[12]; +cx q[22],q[12]; +rz(-pi/2048) q[12]; +rz(-pi/1024) q[22]; +cx q[22],q[13]; +rz(pi/1024) q[13]; +cx q[22],q[13]; +rz(-pi/1024) q[13]; +rz(-pi/512) q[22]; +cx q[22],q[14]; +rz(pi/512) q[14]; +cx q[22],q[14]; +rz(-pi/512) q[14]; +rz(-pi/256) q[22]; +cx q[22],q[15]; +rz(pi/256) q[15]; +cx q[22],q[15]; +rz(-pi/256) q[15]; +rz(-pi/128) q[22]; +cx q[22],q[16]; +rz(pi/128) q[16]; +cx q[22],q[16]; +rz(-pi/128) q[16]; +rz(-pi/64) q[22]; +cx q[22],q[17]; +rz(pi/64) q[17]; +cx q[22],q[17]; +rz(-pi/64) q[17]; +rz(-pi/32) q[22]; +cx q[22],q[18]; +rz(pi/32) q[18]; +cx q[22],q[18]; +rz(-pi/32) q[18]; +rz(-pi/16) q[22]; +cx q[22],q[19]; +rz(pi/16) q[19]; +cx q[22],q[19]; +rz(-pi/16) q[19]; +rz(-pi/8) q[22]; +cx q[22],q[20]; +rz(pi/8) q[20]; +cx q[22],q[20]; +rz(-pi/8) q[20]; +rz(-pi/4) q[22]; +cx q[22],q[21]; +rz(pi/4) q[21]; +cx q[22],q[21]; +rz(-pi/4) q[21]; +rz(pi/2) q[22]; +sx q[22]; +rz(pi/2) q[22]; +rz(-pi/16384) q[9]; +cx q[23],q[9]; +rz(pi/32768) q[9]; +cx q[23],q[9]; +rz(-pi/16384) q[23]; +cx q[23],q[10]; +rz(pi/16384) q[10]; +cx q[23],q[10]; +rz(-pi/16384) q[10]; +rz(-pi/8192) q[23]; +cx q[23],q[11]; +rz(pi/8192) q[11]; +cx q[23],q[11]; +rz(-pi/8192) q[11]; +rz(-pi/4096) q[23]; +cx q[23],q[12]; +rz(pi/4096) q[12]; +cx q[23],q[12]; +rz(-pi/4096) q[12]; +rz(-pi/2048) q[23]; +cx q[23],q[13]; +rz(pi/2048) q[13]; +cx q[23],q[13]; +rz(-pi/2048) q[13]; +rz(-pi/1024) q[23]; +cx q[23],q[14]; +rz(pi/1024) q[14]; +cx q[23],q[14]; +rz(-pi/1024) q[14]; +rz(-pi/512) q[23]; +cx q[23],q[15]; +rz(pi/512) q[15]; +cx q[23],q[15]; +rz(-pi/512) q[15]; +rz(-pi/256) q[23]; +cx q[23],q[16]; +rz(pi/256) q[16]; +cx q[23],q[16]; +rz(-pi/256) q[16]; +rz(-pi/128) q[23]; +cx q[23],q[17]; +rz(pi/128) q[17]; +cx q[23],q[17]; +rz(-pi/128) q[17]; +rz(-pi/64) q[23]; +cx q[23],q[18]; +rz(pi/64) q[18]; +cx q[23],q[18]; +rz(-pi/64) q[18]; +rz(-pi/32) q[23]; +cx q[23],q[19]; +rz(pi/32) q[19]; +cx q[23],q[19]; +rz(-pi/32) q[19]; +rz(-pi/16) q[23]; +cx q[23],q[20]; +rz(pi/16) q[20]; +cx q[23],q[20]; +rz(-pi/16) q[20]; +rz(-pi/8) q[23]; +cx q[23],q[21]; +rz(pi/8) q[21]; +cx q[23],q[21]; +rz(-pi/8) q[21]; +rz(-pi/4) q[23]; +cx q[23],q[22]; +rz(pi/4) q[22]; +cx q[23],q[22]; +rz(-pi/4) q[22]; +rz(pi/2) q[23]; +sx q[23]; +rz(pi/2) q[23]; +rz(-pi/32768) q[9]; +cx q[24],q[9]; +rz(pi/65536) q[9]; +cx q[24],q[9]; +rz(-pi/32768) q[24]; +cx q[24],q[10]; +rz(pi/32768) q[10]; +cx q[24],q[10]; +rz(-pi/32768) q[10]; +rz(-pi/16384) q[24]; +cx q[24],q[11]; +rz(pi/16384) q[11]; +cx q[24],q[11]; +rz(-pi/16384) q[11]; +rz(-pi/8192) q[24]; +cx q[24],q[12]; +rz(pi/8192) q[12]; +cx q[24],q[12]; +rz(-pi/8192) q[12]; +rz(-pi/4096) q[24]; +cx q[24],q[13]; +rz(pi/4096) q[13]; +cx q[24],q[13]; +rz(-pi/4096) q[13]; +rz(-pi/2048) q[24]; +cx q[24],q[14]; +rz(pi/2048) q[14]; +cx q[24],q[14]; +rz(-pi/2048) q[14]; +rz(-pi/1024) q[24]; +cx q[24],q[15]; +rz(pi/1024) q[15]; +cx q[24],q[15]; +rz(-pi/1024) q[15]; +rz(-pi/512) q[24]; +cx q[24],q[16]; +rz(pi/512) q[16]; +cx q[24],q[16]; +rz(-pi/512) q[16]; +rz(-pi/256) q[24]; +cx q[24],q[17]; +rz(pi/256) q[17]; +cx q[24],q[17]; +rz(-pi/256) q[17]; +rz(-pi/128) q[24]; +cx q[24],q[18]; +rz(pi/128) q[18]; +cx q[24],q[18]; +rz(-pi/128) q[18]; +rz(-pi/64) q[24]; +cx q[24],q[19]; +rz(pi/64) q[19]; +cx q[24],q[19]; +rz(-pi/64) q[19]; +rz(-pi/32) q[24]; +cx q[24],q[20]; +rz(pi/32) q[20]; +cx q[24],q[20]; +rz(-pi/32) q[20]; +rz(-pi/16) q[24]; +cx q[24],q[21]; +rz(pi/16) q[21]; +cx q[24],q[21]; +rz(-pi/16) q[21]; +rz(-pi/8) q[24]; +cx q[24],q[22]; +rz(pi/8) q[22]; +cx q[24],q[22]; +rz(-pi/8) q[22]; +rz(-pi/4) q[24]; +cx q[24],q[23]; +rz(pi/4) q[23]; +cx q[24],q[23]; +rz(-pi/4) q[23]; +rz(pi/2) q[24]; +sx q[24]; +rz(pi/2) q[24]; +rz(-pi/65536) q[9]; +cx q[25],q[9]; +rz(pi/131072) q[9]; +cx q[25],q[9]; +rz(-pi/65536) q[25]; +cx q[25],q[10]; +rz(pi/65536) q[10]; +cx q[25],q[10]; +rz(-pi/65536) q[10]; +rz(-pi/32768) q[25]; +cx q[25],q[11]; +rz(pi/32768) q[11]; +cx q[25],q[11]; +rz(-pi/32768) q[11]; +rz(-pi/16384) q[25]; +cx q[25],q[12]; +rz(pi/16384) q[12]; +cx q[25],q[12]; +rz(-pi/16384) q[12]; +rz(-pi/8192) q[25]; +cx q[25],q[13]; +rz(pi/8192) q[13]; +cx q[25],q[13]; +rz(-pi/8192) q[13]; +rz(-pi/4096) q[25]; +cx q[25],q[14]; +rz(pi/4096) q[14]; +cx q[25],q[14]; +rz(-pi/4096) q[14]; +rz(-pi/2048) q[25]; +cx q[25],q[15]; +rz(pi/2048) q[15]; +cx q[25],q[15]; +rz(-pi/2048) q[15]; +rz(-pi/1024) q[25]; +cx q[25],q[16]; +rz(pi/1024) q[16]; +cx q[25],q[16]; +rz(-pi/1024) q[16]; +rz(-pi/512) q[25]; +cx q[25],q[17]; +rz(pi/512) q[17]; +cx q[25],q[17]; +rz(-pi/512) q[17]; +rz(-pi/256) q[25]; +cx q[25],q[18]; +rz(pi/256) q[18]; +cx q[25],q[18]; +rz(-pi/256) q[18]; +rz(-pi/128) q[25]; +cx q[25],q[19]; +rz(pi/128) q[19]; +cx q[25],q[19]; +rz(-pi/128) q[19]; +rz(-pi/64) q[25]; +cx q[25],q[20]; +rz(pi/64) q[20]; +cx q[25],q[20]; +rz(-pi/64) q[20]; +rz(-pi/32) q[25]; +cx q[25],q[21]; +rz(pi/32) q[21]; +cx q[25],q[21]; +rz(-pi/32) q[21]; +rz(-pi/16) q[25]; +cx q[25],q[22]; +rz(pi/16) q[22]; +cx q[25],q[22]; +rz(-pi/16) q[22]; +rz(-pi/8) q[25]; +cx q[25],q[23]; +rz(pi/8) q[23]; +cx q[25],q[23]; +rz(-pi/8) q[23]; +rz(-pi/4) q[25]; +cx q[25],q[24]; +rz(pi/4) q[24]; +cx q[25],q[24]; +rz(-pi/4) q[24]; +rz(pi/2) q[25]; +sx q[25]; +rz(pi/2) q[25]; +rz(-pi/131072) q[9]; +cx q[26],q[9]; +rz(pi/262144) q[9]; +cx q[26],q[9]; +rz(-pi/131072) q[26]; +cx q[26],q[10]; +rz(pi/131072) q[10]; +cx q[26],q[10]; +rz(-pi/131072) q[10]; +rz(-pi/65536) q[26]; +cx q[26],q[11]; +rz(pi/65536) q[11]; +cx q[26],q[11]; +rz(-pi/65536) q[11]; +rz(-pi/32768) q[26]; +cx q[26],q[12]; +rz(pi/32768) q[12]; +cx q[26],q[12]; +rz(-pi/32768) q[12]; +rz(-pi/16384) q[26]; +cx q[26],q[13]; +rz(pi/16384) q[13]; +cx q[26],q[13]; +rz(-pi/16384) q[13]; +rz(-pi/8192) q[26]; +cx q[26],q[14]; +rz(pi/8192) q[14]; +cx q[26],q[14]; +rz(-pi/8192) q[14]; +rz(-pi/4096) q[26]; +cx q[26],q[15]; +rz(pi/4096) q[15]; +cx q[26],q[15]; +rz(-pi/4096) q[15]; +rz(-pi/2048) q[26]; +cx q[26],q[16]; +rz(pi/2048) q[16]; +cx q[26],q[16]; +rz(-pi/2048) q[16]; +rz(-pi/1024) q[26]; +cx q[26],q[17]; +rz(pi/1024) q[17]; +cx q[26],q[17]; +rz(-pi/1024) q[17]; +rz(-pi/512) q[26]; +cx q[26],q[18]; +rz(pi/512) q[18]; +cx q[26],q[18]; +rz(-pi/512) q[18]; +rz(-pi/256) q[26]; +cx q[26],q[19]; +rz(pi/256) q[19]; +cx q[26],q[19]; +rz(-pi/256) q[19]; +rz(-pi/128) q[26]; +cx q[26],q[20]; +rz(pi/128) q[20]; +cx q[26],q[20]; +rz(-pi/128) q[20]; +rz(-pi/64) q[26]; +cx q[26],q[21]; +rz(pi/64) q[21]; +cx q[26],q[21]; +rz(-pi/64) q[21]; +rz(-pi/32) q[26]; +cx q[26],q[22]; +rz(pi/32) q[22]; +cx q[26],q[22]; +rz(-pi/32) q[22]; +rz(-pi/16) q[26]; +cx q[26],q[23]; +rz(pi/16) q[23]; +cx q[26],q[23]; +rz(-pi/16) q[23]; +rz(-pi/8) q[26]; +cx q[26],q[24]; +rz(pi/8) q[24]; +cx q[26],q[24]; +rz(-pi/8) q[24]; +rz(-pi/4) q[26]; +cx q[26],q[25]; +rz(pi/4) q[25]; +cx q[26],q[25]; +rz(-pi/4) q[25]; +rz(pi/2) q[26]; +sx q[26]; +rz(pi/2) q[26]; +rz(-pi/262144) q[9]; +cx q[27],q[9]; +rz(pi/524288) q[9]; +cx q[27],q[9]; +rz(-pi/262144) q[27]; +cx q[27],q[10]; +rz(pi/262144) q[10]; +cx q[27],q[10]; +rz(-pi/262144) q[10]; +rz(-pi/131072) q[27]; +cx q[27],q[11]; +rz(pi/131072) q[11]; +cx q[27],q[11]; +rz(-pi/131072) q[11]; +rz(-pi/65536) q[27]; +cx q[27],q[12]; +rz(pi/65536) q[12]; +cx q[27],q[12]; +rz(-pi/65536) q[12]; +rz(-pi/32768) q[27]; +cx q[27],q[13]; +rz(pi/32768) q[13]; +cx q[27],q[13]; +rz(-pi/32768) q[13]; +rz(-pi/16384) q[27]; +cx q[27],q[14]; +rz(pi/16384) q[14]; +cx q[27],q[14]; +rz(-pi/16384) q[14]; +rz(-pi/8192) q[27]; +cx q[27],q[15]; +rz(pi/8192) q[15]; +cx q[27],q[15]; +rz(-pi/8192) q[15]; +rz(-pi/4096) q[27]; +cx q[27],q[16]; +rz(pi/4096) q[16]; +cx q[27],q[16]; +rz(-pi/4096) q[16]; +rz(-pi/2048) q[27]; +cx q[27],q[17]; +rz(pi/2048) q[17]; +cx q[27],q[17]; +rz(-pi/2048) q[17]; +rz(-pi/1024) q[27]; +cx q[27],q[18]; +rz(pi/1024) q[18]; +cx q[27],q[18]; +rz(-pi/1024) q[18]; +rz(-pi/512) q[27]; +cx q[27],q[19]; +rz(pi/512) q[19]; +cx q[27],q[19]; +rz(-pi/512) q[19]; +rz(-pi/256) q[27]; +cx q[27],q[20]; +rz(pi/256) q[20]; +cx q[27],q[20]; +rz(-pi/256) q[20]; +rz(-pi/128) q[27]; +cx q[27],q[21]; +rz(pi/128) q[21]; +cx q[27],q[21]; +rz(-pi/128) q[21]; +rz(-pi/64) q[27]; +cx q[27],q[22]; +rz(pi/64) q[22]; +cx q[27],q[22]; +rz(-pi/64) q[22]; +rz(-pi/32) q[27]; +cx q[27],q[23]; +rz(pi/32) q[23]; +cx q[27],q[23]; +rz(-pi/32) q[23]; +rz(-pi/16) q[27]; +cx q[27],q[24]; +rz(pi/16) q[24]; +cx q[27],q[24]; +rz(-pi/16) q[24]; +rz(-pi/8) q[27]; +cx q[27],q[25]; +rz(pi/8) q[25]; +cx q[27],q[25]; +rz(-pi/8) q[25]; +rz(-pi/4) q[27]; +cx q[27],q[26]; +rz(pi/4) q[26]; +cx q[27],q[26]; +rz(-pi/4) q[26]; +rz(pi/2) q[27]; +sx q[27]; +rz(pi/2) q[27]; +rz(-pi/524288) q[9]; +cx q[28],q[9]; +rz(pi/1048576) q[9]; +cx q[28],q[9]; +rz(-pi/524288) q[28]; +cx q[28],q[10]; +rz(pi/524288) q[10]; +cx q[28],q[10]; +rz(-pi/524288) q[10]; +rz(-pi/262144) q[28]; +cx q[28],q[11]; +rz(pi/262144) q[11]; +cx q[28],q[11]; +rz(-pi/262144) q[11]; +rz(-pi/131072) q[28]; +cx q[28],q[12]; +rz(pi/131072) q[12]; +cx q[28],q[12]; +rz(-pi/131072) q[12]; +rz(-pi/65536) q[28]; +cx q[28],q[13]; +rz(pi/65536) q[13]; +cx q[28],q[13]; +rz(-pi/65536) q[13]; +rz(-pi/32768) q[28]; +cx q[28],q[14]; +rz(pi/32768) q[14]; +cx q[28],q[14]; +rz(-pi/32768) q[14]; +rz(-pi/16384) q[28]; +cx q[28],q[15]; +rz(pi/16384) q[15]; +cx q[28],q[15]; +rz(-pi/16384) q[15]; +rz(-pi/8192) q[28]; +cx q[28],q[16]; +rz(pi/8192) q[16]; +cx q[28],q[16]; +rz(-pi/8192) q[16]; +rz(-pi/4096) q[28]; +cx q[28],q[17]; +rz(pi/4096) q[17]; +cx q[28],q[17]; +rz(-pi/4096) q[17]; +rz(-pi/2048) q[28]; +cx q[28],q[18]; +rz(pi/2048) q[18]; +cx q[28],q[18]; +rz(-pi/2048) q[18]; +rz(-pi/1024) q[28]; +cx q[28],q[19]; +rz(pi/1024) q[19]; +cx q[28],q[19]; +rz(-pi/1024) q[19]; +rz(-pi/512) q[28]; +cx q[28],q[20]; +rz(pi/512) q[20]; +cx q[28],q[20]; +rz(-pi/512) q[20]; +rz(-pi/256) q[28]; +cx q[28],q[21]; +rz(pi/256) q[21]; +cx q[28],q[21]; +rz(-pi/256) q[21]; +rz(-pi/128) q[28]; +cx q[28],q[22]; +rz(pi/128) q[22]; +cx q[28],q[22]; +rz(-pi/128) q[22]; +rz(-pi/64) q[28]; +cx q[28],q[23]; +rz(pi/64) q[23]; +cx q[28],q[23]; +rz(-pi/64) q[23]; +rz(-pi/32) q[28]; +cx q[28],q[24]; +rz(pi/32) q[24]; +cx q[28],q[24]; +rz(-pi/32) q[24]; +rz(-pi/16) q[28]; +cx q[28],q[25]; +rz(pi/16) q[25]; +cx q[28],q[25]; +rz(-pi/16) q[25]; +rz(-pi/8) q[28]; +cx q[28],q[26]; +rz(pi/8) q[26]; +cx q[28],q[26]; +rz(-pi/8) q[26]; +rz(-pi/4) q[28]; +cx q[28],q[27]; +rz(pi/4) q[27]; +cx q[28],q[27]; +rz(-pi/4) q[27]; +rz(pi/2) q[28]; +sx q[28]; +rz(pi/2) q[28]; +rz(-pi/1048576) q[9]; diff --git a/test/circuits/random_1.qasm b/test/circuits/random_1.qasm new file mode 100644 index 000000000..aea6900dd --- /dev/null +++ b/test/circuits/random_1.qasm @@ -0,0 +1,154 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[10]; +creg c[10]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; +h q[9]; +ccx q[0], q[6], q[7]; +ccx q[0], q[3], q[7]; +cx q[4], q[2]; +h q[8]; +cx q[5], q[1]; +s q[5]; +h q[6]; +s q[9]; +t q[6]; +cx q[4], q[7]; +s q[4]; +t q[2]; +cx q[3], q[7]; +ccx q[6], q[0], q[9]; +h q[3]; +s q[3]; +t q[8]; +t q[3]; +t q[8]; +cx q[6], q[7]; +h q[9]; +t q[8]; +s q[3]; +cx q[3], q[0]; +h q[7]; +t q[9]; +h q[8]; +h q[2]; +cx q[9], q[5]; +ccx q[2], q[1], q[7]; +s q[3]; +t q[6]; +cx q[7], q[3]; +t q[2]; +ccx q[8], q[2], q[1]; +t q[7]; +t q[2]; +s q[2]; +cx q[5], q[6]; +s q[0]; +ccx q[0], q[5], q[3]; +h q[4]; +cx q[6], q[9]; +s q[6]; +cx q[3], q[8]; +t q[8]; +cx q[9], q[7]; +h q[2]; +cx q[7], q[6]; +s q[6]; +ccx q[9], q[5], q[8]; +cx q[7], q[2]; +ccx q[7], q[1], q[6]; +h q[0]; +cx q[8], q[1]; +h q[5]; +h q[2]; +h q[9]; +cx q[7], q[2]; +cx q[6], q[8]; +cx q[5], q[4]; +cx q[6], q[5]; +ccx q[8], q[2], q[3]; +t q[9]; +h q[3]; +ccx q[9], q[7], q[0]; +h q[4]; +cx q[3], q[4]; +h q[0]; +ccx q[8], q[1], q[4]; +s q[7]; +s q[5]; +ccx q[6], q[3], q[5]; +s q[1]; +ccx q[3], q[6], q[1]; +t q[7]; +ccx q[6], q[7], q[8]; +s q[4]; +ccx q[5], q[1], q[0]; +s q[6]; +ccx q[6], q[3], q[1]; +cx q[1], q[0]; +t q[4]; +t q[7]; +cx q[3], q[4]; +cx q[4], q[8]; +cx q[8], q[4]; +cx q[7], q[5]; +t q[4]; +cx q[7], q[9]; +cx q[1], q[8]; +t q[6]; +s q[9]; +cx q[9], q[1]; +ccx q[4], q[0], q[9]; +t q[5]; +h q[6]; +ccx q[5], q[4], q[9]; +s q[3]; +s q[4]; +h q[8]; +h q[3]; +ccx q[1], q[6], q[3]; +ccx q[9], q[7], q[0]; +cx q[3], q[5]; +ccx q[3], q[8], q[9]; +t q[0]; +ccx q[0], q[9], q[5]; +cx q[5], q[9]; +s q[2]; +h q[9]; +t q[2]; +h q[8]; +ccx q[5], q[1], q[6]; +cx q[9], q[5]; +h q[2]; +cx q[7], q[9]; +cx q[7], q[9]; +s q[5]; +cx q[5], q[8]; +ccx q[7], q[6], q[3]; +h q[6]; +s q[0]; +s q[3]; +ccx q[6], q[5], q[8]; +cx q[0], q[9]; +h q[2]; +t q[3]; +h q[9]; +s q[1]; +ccx q[5], q[2], q[4]; +h q[6]; +ccx q[6], q[1], q[5]; +s q[7]; +s q[2]; +cx q[7], q[5]; +h q[2]; +s q[9]; +cx q[2], q[8]; +cx q[1], q[6]; diff --git a/test/circuits/random_2.qasm b/test/circuits/random_2.qasm new file mode 100644 index 000000000..cb7d21c38 --- /dev/null +++ b/test/circuits/random_2.qasm @@ -0,0 +1,532 @@ +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[10]; +creg c[10]; +h q[0]; +h q[1]; +h q[2]; +h q[3]; +h q[4]; +h q[5]; +h q[6]; +h q[7]; +h q[8]; +h q[9]; +h q[7]; +cx q[7], q[6]; +tdg q[6]; +cx q[0], q[6]; +t q[6]; +cx q[7], q[6]; +tdg q[6]; +cx q[0], q[6]; +t q[6]; +cx q[0], q[7]; +tdg q[7]; +cx q[0], q[7]; +t q[0]; +t q[7]; +h q[7]; +h q[7]; +cx q[7], q[3]; +tdg q[3]; +cx q[0], q[3]; +t q[3]; +cx q[7], q[3]; +tdg q[3]; +cx q[0], q[3]; +t q[3]; +cx q[0], q[7]; +tdg q[7]; +cx q[0], q[7]; +t q[0]; +t q[7]; +h q[7]; +cx q[4], q[2]; +h q[8]; +cx q[5], q[1]; +s q[5]; +h q[6]; +s q[9]; +t q[6]; +cx q[4], q[7]; +s q[4]; +t q[2]; +cx q[3], q[7]; +h q[9]; +cx q[9], q[0]; +tdg q[0]; +cx q[6], q[0]; +t q[0]; +cx q[9], q[0]; +tdg q[0]; +cx q[6], q[0]; +t q[0]; +cx q[6], q[9]; +tdg q[9]; +cx q[6], q[9]; +t q[6]; +t q[9]; +h q[9]; +h q[3]; +s q[3]; +t q[8]; +t q[3]; +t q[8]; +cx q[6], q[7]; +h q[9]; +t q[8]; +s q[3]; +cx q[3], q[0]; +h q[7]; +t q[9]; +h q[8]; +h q[2]; +cx q[9], q[5]; +h q[7]; +cx q[7], q[1]; +tdg q[1]; +cx q[2], q[1]; +t q[1]; +cx q[7], q[1]; +tdg q[1]; +cx q[2], q[1]; +t q[1]; +cx q[2], q[7]; +tdg q[7]; +cx q[2], q[7]; +t q[2]; +t q[7]; +h q[7]; +s q[3]; +t q[6]; +cx q[7], q[3]; +t q[2]; +h q[1]; +cx q[1], q[2]; +tdg q[2]; +cx q[8], q[2]; +t q[2]; +cx q[1], q[2]; +tdg q[2]; +cx q[8], q[2]; +t q[2]; +cx q[8], q[1]; +tdg q[1]; +cx q[8], q[1]; +t q[8]; +t q[1]; +h q[1]; +t q[7]; +t q[2]; +s q[2]; +cx q[5], q[6]; +s q[0]; +h q[3]; +cx q[3], q[5]; +tdg q[5]; +cx q[0], q[5]; +t q[5]; +cx q[3], q[5]; +tdg q[5]; +cx q[0], q[5]; +t q[5]; +cx q[0], q[3]; +tdg q[3]; +cx q[0], q[3]; +t q[0]; +t q[3]; +h q[3]; +h q[4]; +cx q[6], q[9]; +s q[6]; +cx q[3], q[8]; +t q[8]; +cx q[9], q[7]; +h q[2]; +cx q[7], q[6]; +s q[6]; +h q[8]; +cx q[8], q[5]; +tdg q[5]; +cx q[9], q[5]; +t q[5]; +cx q[8], q[5]; +tdg q[5]; +cx q[9], q[5]; +t q[5]; +cx q[9], q[8]; +tdg q[8]; +cx q[9], q[8]; +t q[9]; +t q[8]; +h q[8]; +cx q[7], q[2]; +h q[6]; +cx q[6], q[1]; +tdg q[1]; +cx q[7], q[1]; +t q[1]; +cx q[6], q[1]; +tdg q[1]; +cx q[7], q[1]; +t q[1]; +cx q[7], q[6]; +tdg q[6]; +cx q[7], q[6]; +t q[7]; +t q[6]; +h q[6]; +h q[0]; +cx q[8], q[1]; +h q[5]; +h q[2]; +h q[9]; +cx q[7], q[2]; +cx q[6], q[8]; +cx q[5], q[4]; +cx q[6], q[5]; +h q[3]; +cx q[3], q[2]; +tdg q[2]; +cx q[8], q[2]; +t q[2]; +cx q[3], q[2]; +tdg q[2]; +cx q[8], q[2]; +t q[2]; +cx q[8], q[3]; +tdg q[3]; +cx q[8], q[3]; +t q[8]; +t q[3]; +h q[3]; +t q[9]; +h q[3]; +h q[0]; +cx q[0], q[7]; +tdg q[7]; +cx q[9], q[7]; +t q[7]; +cx q[0], q[7]; +tdg q[7]; +cx q[9], q[7]; +t q[7]; +cx q[9], q[0]; +tdg q[0]; +cx q[9], q[0]; +t q[9]; +t q[0]; +h q[0]; +h q[4]; +cx q[3], q[4]; +h q[0]; +h q[4]; +cx q[4], q[1]; +tdg q[1]; +cx q[8], q[1]; +t q[1]; +cx q[4], q[1]; +tdg q[1]; +cx q[8], q[1]; +t q[1]; +cx q[8], q[4]; +tdg q[4]; +cx q[8], q[4]; +t q[8]; +t q[4]; +h q[4]; +s q[7]; +s q[5]; +h q[5]; +cx q[5], q[3]; +tdg q[3]; +cx q[6], q[3]; +t q[3]; +cx q[5], q[3]; +tdg q[3]; +cx q[6], q[3]; +t q[3]; +cx q[6], q[5]; +tdg q[5]; +cx q[6], q[5]; +t q[6]; +t q[5]; +h q[5]; +s q[1]; +h q[1]; +cx q[1], q[6]; +tdg q[6]; +cx q[3], q[6]; +t q[6]; +cx q[1], q[6]; +tdg q[6]; +cx q[3], q[6]; +t q[6]; +cx q[3], q[1]; +tdg q[1]; +cx q[3], q[1]; +t q[3]; +t q[1]; +h q[1]; +t q[7]; +h q[8]; +cx q[8], q[7]; +tdg q[7]; +cx q[6], q[7]; +t q[7]; +cx q[8], q[7]; +tdg q[7]; +cx q[6], q[7]; +t q[7]; +cx q[6], q[8]; +tdg q[8]; +cx q[6], q[8]; +t q[6]; +t q[8]; +h q[8]; +s q[4]; +h q[0]; +cx q[0], q[1]; +tdg q[1]; +cx q[5], q[1]; +t q[1]; +cx q[0], q[1]; +tdg q[1]; +cx q[5], q[1]; +t q[1]; +cx q[5], q[0]; +tdg q[0]; +cx q[5], q[0]; +t q[5]; +t q[0]; +h q[0]; +s q[6]; +h q[1]; +cx q[1], q[3]; +tdg q[3]; +cx q[6], q[3]; +t q[3]; +cx q[1], q[3]; +tdg q[3]; +cx q[6], q[3]; +t q[3]; +cx q[6], q[1]; +tdg q[1]; +cx q[6], q[1]; +t q[6]; +t q[1]; +h q[1]; +cx q[1], q[0]; +t q[4]; +t q[7]; +cx q[3], q[4]; +cx q[4], q[8]; +cx q[8], q[4]; +cx q[7], q[5]; +t q[4]; +cx q[7], q[9]; +cx q[1], q[8]; +t q[6]; +s q[9]; +cx q[9], q[1]; +h q[9]; +cx q[9], q[0]; +tdg q[0]; +cx q[4], q[0]; +t q[0]; +cx q[9], q[0]; +tdg q[0]; +cx q[4], q[0]; +t q[0]; +cx q[4], q[9]; +tdg q[9]; +cx q[4], q[9]; +t q[4]; +t q[9]; +h q[9]; +t q[5]; +h q[6]; +h q[9]; +cx q[9], q[4]; +tdg q[4]; +cx q[5], q[4]; +t q[4]; +cx q[9], q[4]; +tdg q[4]; +cx q[5], q[4]; +t q[4]; +cx q[5], q[9]; +tdg q[9]; +cx q[5], q[9]; +t q[5]; +t q[9]; +h q[9]; +s q[3]; +s q[4]; +h q[8]; +h q[3]; +h q[3]; +cx q[3], q[6]; +tdg q[6]; +cx q[1], q[6]; +t q[6]; +cx q[3], q[6]; +tdg q[6]; +cx q[1], q[6]; +t q[6]; +cx q[1], q[3]; +tdg q[3]; +cx q[1], q[3]; +t q[1]; +t q[3]; +h q[3]; +h q[0]; +cx q[0], q[7]; +tdg q[7]; +cx q[9], q[7]; +t q[7]; +cx q[0], q[7]; +tdg q[7]; +cx q[9], q[7]; +t q[7]; +cx q[9], q[0]; +tdg q[0]; +cx q[9], q[0]; +t q[9]; +t q[0]; +h q[0]; +cx q[3], q[5]; +h q[9]; +cx q[9], q[8]; +tdg q[8]; +cx q[3], q[8]; +t q[8]; +cx q[9], q[8]; +tdg q[8]; +cx q[3], q[8]; +t q[8]; +cx q[3], q[9]; +tdg q[9]; +cx q[3], q[9]; +t q[3]; +t q[9]; +h q[9]; +t q[0]; +h q[5]; +cx q[5], q[9]; +tdg q[9]; +cx q[0], q[9]; +t q[9]; +cx q[5], q[9]; +tdg q[9]; +cx q[0], q[9]; +t q[9]; +cx q[0], q[5]; +tdg q[5]; +cx q[0], q[5]; +t q[0]; +t q[5]; +h q[5]; +cx q[5], q[9]; +s q[2]; +h q[9]; +t q[2]; +h q[8]; +h q[6]; +cx q[6], q[1]; +tdg q[1]; +cx q[5], q[1]; +t q[1]; +cx q[6], q[1]; +tdg q[1]; +cx q[5], q[1]; +t q[1]; +cx q[5], q[6]; +tdg q[6]; +cx q[5], q[6]; +t q[5]; +t q[6]; +h q[6]; +cx q[9], q[5]; +h q[2]; +cx q[7], q[9]; +cx q[7], q[9]; +s q[5]; +cx q[5], q[8]; +h q[3]; +cx q[3], q[6]; +tdg q[6]; +cx q[7], q[6]; +t q[6]; +cx q[3], q[6]; +tdg q[6]; +cx q[7], q[6]; +t q[6]; +cx q[7], q[3]; +tdg q[3]; +cx q[7], q[3]; +t q[7]; +t q[3]; +h q[3]; +h q[6]; +s q[0]; +s q[3]; +h q[8]; +cx q[8], q[5]; +tdg q[5]; +cx q[6], q[5]; +t q[5]; +cx q[8], q[5]; +tdg q[5]; +cx q[6], q[5]; +t q[5]; +cx q[6], q[8]; +tdg q[8]; +cx q[6], q[8]; +t q[6]; +t q[8]; +h q[8]; +cx q[0], q[9]; +h q[2]; +t q[3]; +h q[9]; +s q[1]; +h q[4]; +cx q[4], q[2]; +tdg q[2]; +cx q[5], q[2]; +t q[2]; +cx q[4], q[2]; +tdg q[2]; +cx q[5], q[2]; +t q[2]; +cx q[5], q[4]; +tdg q[4]; +cx q[5], q[4]; +t q[5]; +t q[4]; +h q[4]; +h q[6]; +h q[5]; +cx q[5], q[1]; +tdg q[1]; +cx q[6], q[1]; +t q[1]; +cx q[5], q[1]; +tdg q[1]; +cx q[6], q[1]; +t q[1]; +cx q[6], q[5]; +tdg q[5]; +cx q[6], q[5]; +t q[6]; +t q[5]; +h q[5]; +s q[7]; +s q[2]; +cx q[7], q[5]; +h q[2]; +s q[9]; +cx q[2], q[8]; +cx q[1], q[6]; diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 2c568e62a..76ac2a168 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2098,7 +2098,7 @@ TEST(DDPackageTest, DDMSetRowsToZero) { EXPECT_EQ(dd->setRowsToZero(inputDD, 0), inputDD); } -TEST(DDPackageTest, DDMPECFunctionsNotNormalized) { +TEST(DDPackageTest, DDMPartialEquivalenceCheckingFunctionsNotNormalized) { const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{ @@ -2279,3 +2279,157 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingComputeTable) { EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); } + +TEST(DDPackageTest, DDMPECMQTBenchGrover3Qubits) { + auto dd = std::make_unique>(7); + + qc::QuantumComputation c1{ + "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm"}; + qc::QuantumComputation c2{"./circuits/grover-noancilla_indep_qiskit_3.qasm"}; + + // 3 measured qubits and 3 data qubits, full equivalence + EXPECT_TRUE(dd->partialEquivalenceCheck( + buildFunctionality(&c1, dd, false, false), + buildFunctionality(&c2, dd, false, false), 3, 3)); +} + +TEST(DDPackageTest, DDMPECMQTBenchGrover7Qubits) { + auto dd = std::make_unique>(7); + + qc::QuantumComputation c1{ + "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm"}; + qc::QuantumComputation c2{ + "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm"}; + + // 7 measured qubits and 7 data qubits, full equivalence + EXPECT_TRUE(dd->partialEquivalenceCheck( + buildFunctionality(&c1, dd, false, false), + buildFunctionality(&c2, dd, false, false), 7, 7)); +} + +TEST(DDPackageTest, DDMZAPECMQTBenchQPE30Qubits) { + // zero ancilla partial equivalence test + auto dd = std::make_unique>(31); + + // 30 qubits + qc::QuantumComputation c1{ + "./circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm"}; + qc::QuantumComputation c2{"./circuits/qpeexact_indep_qiskit_30.qasm"}; + + // buildFunctionality is already very very slow... + // auto f1 = buildFunctionality(&c1, dd, false, false); + // auto f2 = buildFunctionality(&c2, dd, false, false); + + // 29 measured qubits and 30 data qubits + // calls zeroAncillaPartialEquivalenceCheck + + // EXPECT_TRUE(dd->partialEquivalenceCheck(f1, f2, 30, 29)); + EXPECT_TRUE(true); +} + +TEST(DDPackageTest, DDMZAPECSliQEC) { + auto dd = std::make_unique>(20); + + // full equivalence, 10 qubits + qc::QuantumComputation c1{"./circuits/entanglement_1.qasm"}; + qc::QuantumComputation c2{"./circuits/entanglement_2.qasm"}; + + // calls zeroAncillaPartialEquivalenceCheck + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); + + // full equivalence, 19 qubits + qc::QuantumComputation c3{"./circuits/add6_196_1.qasm"}; + qc::QuantumComputation c4{"./circuits/add6_196_2.qasm"}; + + // calls zeroAncillaPartialEquivalenceCheck + EXPECT_TRUE(dd::partialEquivalenceCheck(c3, c4, dd)); + + // full equivalence, 10 qubits + qc::QuantumComputation c5{"./circuits/bv_1.qasm"}; + qc::QuantumComputation c6{"./circuits/bv_2.qasm"}; + + // calls zeroAncillaPartialEquivalenceCheck + EXPECT_TRUE(dd::partialEquivalenceCheck(c5, c6, dd)); +} + +TEST(DDPackageTest, DDMZAPECSliQECRandomCircuit) { + // doesn't terminate + auto dd = std::make_unique>(20); + // full equivalence, 10 qubits + qc::QuantumComputation c1{"./circuits/random_1.qasm"}; + qc::QuantumComputation c2{"./circuits/random_2.qasm"}; + + // calls buildFunctionality for c1 and c2 -> this takes already 2 minutes on + // my computer then it calls zeroAncillaPartialEquivalenceCheck, which calls + // multiply, that is very very slow on my computer + // EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); + EXPECT_TRUE(true); +} + +TEST(DDPackageTest, DDMPECSliQECGrover) { + // doesn't terminate + auto dd = std::make_unique>(22); + + qc::QuantumComputation c1{ + "./circuits/Grover_1.qasm"}; // 11 qubits, 11 data qubits + qc::QuantumComputation c2{ + "./circuits/Grover_2.qasm"}; // 12 qubits, 11 data qubits + + // 11 measured qubits and 11 data qubits + // auto c1Dd = buildFunctionality(&c1, dd, false, false); + // auto c2Dd = buildFunctionality(&c2, dd, false, false); + // adds 10 ancillary qubits -> total number of qubits is 22 + // doesn't terminate + // EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 11, 11)); + EXPECT_TRUE(true); +} + +TEST(DDPackageTest, DDMPECSliQECAdd) { + // doesn't terminate + auto dd = std::make_unique>(20); + + // full equivalence, 19 qubits + // but this test uses algorithm for partial equivalence, not the "zero + // ancilla" version + qc::QuantumComputation c1{"./circuits/add6_196_1.qasm"}; + qc::QuantumComputation c2{"./circuits/add6_196_2.qasm"}; + + // just for benchmarking reasons, we only measure 8 qubits + auto c1Dd = buildFunctionality(&c1, dd, false, false); + auto c2Dd = buildFunctionality(&c2, dd, false, false); + // doesn't add ancillary qubits -> total number of qubits is 19 + EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 8, 8)); +} + +TEST(DDPackageTest, DDMPECSliQECPeriodFinding) { + auto dd = std::make_unique>(20); + // 8 qubits, 3 data qubits + qc::QuantumComputation c1{"./circuits/period_finding_1.qasm"}; + // 8 qubits, 3 data qubits + qc::QuantumComputation c2{"./circuits/period_finding_2.qasm"}; + + // 3 measured qubits and 3 data qubits + + c2.setLogicalQubitAncillary(0); + c2.setLogicalQubitGarbage(0); + c2.setLogicalQubitAncillary(1); + c2.setLogicalQubitGarbage(1); + c2.setLogicalQubitAncillary(2); + c2.setLogicalQubitGarbage(2); + c2.setLogicalQubitAncillary(3); + c2.setLogicalQubitGarbage(3); + c2.setLogicalQubitAncillary(4); + c2.setLogicalQubitGarbage(4); + + c1.setLogicalQubitAncillary(0); + c1.setLogicalQubitGarbage(0); + c1.setLogicalQubitAncillary(1); + c1.setLogicalQubitGarbage(1); + c1.setLogicalQubitAncillary(2); + c1.setLogicalQubitGarbage(2); + c1.setLogicalQubitAncillary(3); + c1.setLogicalQubitGarbage(3); + c1.setLogicalQubitAncillary(4); + c1.setLogicalQubitGarbage(4); + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); +} From 345ef110e7e5e7cabe0e667c3c46dc3a68e6a885 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Sun, 31 Dec 2023 13:34:06 +0100 Subject: [PATCH 18/51] :construction: initial draft for generating random benchmarks --- include/dd/Verification.hpp | 3 ++ src/dd/CMakeLists.txt | 1 + src/dd/Verification.cpp | 77 +++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 src/dd/Verification.cpp diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index 4b65ef9f5..77d26454b 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -63,4 +63,7 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, return dd->partialEquivalenceCheck(u1, u2, static_cast(d1), static_cast(m1)); } + +std::pair +generateRandomBenchmark(Qubit n, Qubit d, Qubit m); } // namespace dd diff --git a/src/dd/CMakeLists.txt b/src/dd/CMakeLists.txt index ce713d7b7..94cedfd6b 100644 --- a/src/dd/CMakeLists.txt +++ b/src/dd/CMakeLists.txt @@ -18,6 +18,7 @@ if(NOT TARGET ${PROJECT_NAME}-dd) RealNumber.cpp RealNumberUniqueTable.cpp Simulation.cpp + Verification.cpp statistics/MemoryManagerStatistics.cpp statistics/Statistics.cpp statistics/TableStatistics.cpp diff --git a/src/dd/Verification.cpp b/src/dd/Verification.cpp new file mode 100644 index 000000000..7bcdf86ae --- /dev/null +++ b/src/dd/Verification.cpp @@ -0,0 +1,77 @@ +#include "dd/Verification.hpp" + +#include "QuantumComputation.hpp" +#include "operations/OpType.hpp" +#include "operations/StandardOperation.hpp" + +#include +#include + +namespace dd { + +void addDecomposedCxxGate(QuantumComputation& circuit, Qubit control1, + Qubit control2, Qubit target) { + circuit.h(target); + circuit.cx(control1, target); + circuit.tdg(target); + circuit.cx(control2, target); + circuit.t(target); + circuit.cx(control1, target); + circuit.t(control1); + circuit.tdg(target); + circuit.cx(control2, target); + circuit.cx(control2, control1); + circuit.t(target); + circuit.t(control2); + circuit.tdg(control1); + circuit.h(target); + circuit.cx(control2, control1); +} + +std::pair +generateRandomBenchmark(Qubit n, Qubit d, Qubit m) { + if (d > n) { + throw std::runtime_error("The number of data or measured qubits can't be " + "bigger than the total number of qubits. n = " + + std::to_string(n) + ";d = " + std::to_string(d) + + "; m = " + std::to_string(m)); + } + qc::QuantumComputation circuit1{n}; + qc::QuantumComputation circuit2{n}; + // H gates + for (Qubit i = 0U; i < d; i++) { + circuit1.h(i); + circuit2.h(i); + } + // Totally equivalent subcircuits + // generate a random subcircuit with d qubits and 3d gates to apply on both + // circuits, but all the Toffoli gates in C2 are decomposed + + for (Qubit i = 0U; i < 3 * d; i++) { + auto randomTarget = static_cast(rand() % d); + auto randomControl1 = static_cast(rand() % (d - 1)); + if (randomControl1 == randomTarget) { + randomControl1 = d - 1; + } + auto randomControl2 = static_cast(rand() % (d - 2)); + if (randomControl2 == randomTarget) { + randomControl2 = d - 1; + } + if (randomControl2 == randomControl1) { + randomControl2 = d - 2; + } + auto randomStandardOperation = static_cast(rand() % Compound); + circuit1.emplace_back(n, randomTarget, + randomStandardOperation); + if (randomStandardOperation == opTypeFromString("mcx")) { + addDecomposedCxxGate(circuit2, randomControl1, randomControl2, + randomTarget); + } else { + circuit2.emplace_back(n, randomTarget, + randomStandardOperation); + } + } + + return std::make_pair(circuit1, circuit2); +} +} // namespace dd From 400c13d1c47179f181d37ef1f92142ea352823bf Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Thu, 4 Jan 2024 10:40:51 +0100 Subject: [PATCH 19/51] implemented PEC algorithm for inverse qubit order and modified tests accordingly --- include/dd/Package.hpp | 270 +++++++++++---------- include/dd/Verification.hpp | 24 +- test/circuits/Grover_2.qasm | 22 -- test/circuits/period_finding_1.qasm | 9 - test/circuits/period_finding_2.qasm | 9 - test/dd/test_package.cpp | 352 ++++++++++++++++------------ 6 files changed, 340 insertions(+), 346 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index f4c939fad..f22d541f0 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2890,175 +2890,163 @@ template class Package { return newedge; } - - ComputeTable shiftAllMatrixRows{}; - - /** - Equally divides the rows of the matrix represented by e intro 2^m parts. - For the i-th part (i starts from 0), right shifts the contents for (i + - offset) columns. - **/ - mEdge shiftAllRowsRecursive(const mEdge& e, std::int64_t m, - std::int64_t offset) { - + // only keeps the first 2^d columns + mEdge setColumnsToZero(const mEdge& e, Qubit d) { if (e.isTerminal()) { return e; } - if (m == 0 && offset == 0) { + // the matrix of the current DD has dimensions 2^n x 2^n + const auto n = e.p->v + 1; + + if (d >= n) { return e; } - mEdge eCopy{e.p, Complex::one()}; - // check if it's in the compute table with an edge weight of one - // only store elements in the compute table if the offset is 0 - if (offset == 0) { - if (const auto* r = shiftAllMatrixRows.lookup(eCopy, m); r != nullptr) { - auto f = *r; - f.w = cn.lookup(e.w * f.w); - return f; - } - } - // the matrix of the current DD has dimensions 2^h x 2^h - const auto h = e.p->v + 1; - const auto mDecremented = (m > 0 ? m - 1 : 0); + std::array edges{}; - if (offset == 1 << (h - 1)) { - // shift the first half of the matrix by 2^(h-1) - edges[0] = mEdge::zero(); - edges[1] = shiftAllRowsRecursive(e.p->e[0], mDecremented, 0); - // shift the second half of the matrix by 2^(h-1) - edges[2] = mEdge::zero(); - edges[3] = shiftAllRowsRecursive(e.p->e[2], mDecremented, - m > 0 ? 1 << (m - 1) : 0); - } else { - // don't shift the first half of the matrix yet - edges[0] = shiftAllRowsRecursive(e.p->e[0], mDecremented, offset); - edges[1] = shiftAllRowsRecursive(e.p->e[1], mDecremented, offset); - if (m == h) { - // shift the second half of the matrix by 2^(h-1) - edges[2] = mEdge::zero(); - edges[3] = shiftAllRowsRecursive(e.p->e[2], mDecremented, offset); - } else { - // don't shift the second half of the matrix yet - auto newOffset = (m > 0 ? 1 << (m - 1) : 0) + offset; - edges[2] = shiftAllRowsRecursive(e.p->e[2], mDecremented, newOffset); - edges[3] = shiftAllRowsRecursive(e.p->e[3], mDecremented, newOffset); - } - } + edges[0] = setColumnsToZero(e.p->e[0], d); + edges[1] = mEdge::zero(); + edges[2] = setColumnsToZero(e.p->e[2], d); + edges[3] = mEdge::zero(); + auto f = makeDDNode(e.p->v, edges); - // add to the compute table with a weight of 1 - if (offset == 0) { - shiftAllMatrixRows.insert(eCopy, m, f); - } f.w = cn.lookup(e.w * f.w); return f; } - - ComputeTable setMatrixColumnsToZero{}; - ComputeTable setMatrixRowsToZero{}; - -public: - /** - Equally divides the rows of the matrix represented by e intro 2^m parts. - For the i-th part (i starts from 0), right shifts the contents for i - columns. - **/ - mEdge shiftAllRows(const mEdge& e, std::int64_t m) { - return shiftAllRowsRecursive(e, m, 0); - } - - /** - Equally divides the columns of the matrix represented by e intro parts of - size 2^k. For each part, keeps the leftmost column unchanged, and sets the - remaining columns to 0. - **/ - mEdge setColumnsToZero(const mEdge& e, Qubit k) { - if (e.isTerminal()) { - return e; - } - if (k == 0) { + mEdge keepOnlyIthRow(const mEdge& e, std::int64_t i) { + if (e.isZeroTerminal()) { return e; } - mEdge eCopy{e.p, Complex::one()}; - // check if it's in the compute table with an edge weight of one - if (const auto* r = setMatrixColumnsToZero.lookup(eCopy, k); r != nullptr) { - auto f = *r; - f.w = cn.lookup(e.w * f.w); - return f; + if (e.isTerminal()) { + if (i == 0) { + return e; + } + return mEdge::zero(); } - // the matrix of the current DD has dimensions 2^h x 2^h - const auto h = e.p->v + 1; + // the matrix of the current DD has dimensions 2^n x 2^n + const auto n = e.p->v + 1; + const auto twoPowNMinusOne = 1 << (n - 1); std::array edges{}; - edges[0] = setColumnsToZero(e.p->e[0], k); - edges[2] = setColumnsToZero(e.p->e[2], k); - if (k < h) { - edges[1] = setColumnsToZero(e.p->e[1], k); - edges[3] = setColumnsToZero(e.p->e[3], k); + if (i < twoPowNMinusOne) { + edges[0] = keepOnlyIthRow(e.p->e[0], i); + edges[1] = keepOnlyIthRow(e.p->e[1], i); + edges[2] = mEdge::zero(); + edges[3] = mEdge::zero(); } else { + edges[0] = mEdge::zero(); edges[1] = mEdge::zero(); - edges[3] = mEdge::zero(); + edges[2] = keepOnlyIthRow(e.p->e[2], i - twoPowNMinusOne); + edges[3] = keepOnlyIthRow(e.p->e[3], i - twoPowNMinusOne); } + auto f = makeDDNode(e.p->v, edges); - // add to the compute table with a weight of 1 - setMatrixColumnsToZero.insert(eCopy, k, f); f.w = cn.lookup(e.w * f.w); return f; } - /** - Equally divides the rows of the matrix represented by e intro parts of - size 2^k. For each part, keeps the top row unchanged, and sets the remaining - entries to 0. - **/ - mEdge setRowsToZero(const mEdge& e, Qubit k) { - if (e.isTerminal()) { + Equally divides the rows of the matrix represented by e (of size 2^n x 2^n) + into 2^g parts of size 2^m (where g = n - m). + For each part the (upperOffset + i)-th row is shifted by i*2^d columns. + **/ + mEdge shiftAllRowsRecursive(const mEdge& e, Qubit m, Qubit d, + std::int64_t upperOffset) { + if (e.isTerminal() && upperOffset == 0) { return e; } - if (k == 0) { + if (e.isTerminal()) { + return mEdge::zero(); + } + if (upperOffset == 0 && m == 0) { return e; } - mEdge eCopy{e.p, Complex::one()}; - // check if it's in the compute table with an edge weight of one - if (const auto* r = setMatrixRowsToZero.lookup(eCopy, k); r != nullptr) { - auto f = *r; - f.w = cn.lookup(e.w * f.w); - return f; + // the matrix of the current DD has dimensions 2^n x 2^n + const auto n = e.p->v + 1; + if (upperOffset < 0 && m < n) { + throw std::runtime_error("offset less than 0."); + } + if (upperOffset >= (1 << n) || upperOffset < 0) { + return mEdge::zero(); + } + + if (d >= n && m >= n) { + return keepOnlyIthRow(e, upperOffset); } - // the matrix of the current DD has dimensions 2^h x 2^h - const auto h = e.p->v + 1; + std::array edges{}; - edges[0] = setRowsToZero(e.p->e[0], k); - edges[1] = setRowsToZero(e.p->e[1], k); - if (k < h) { - edges[2] = setRowsToZero(e.p->e[2], k); - edges[3] = setRowsToZero(e.p->e[3], k); + + // if the current submatrix size is less than 2^m, + // then the offset of the lower half needs to be adapted + bool adaptOffsetOfLowerMatrixHalf = n <= m; + edges[0] = shiftAllRowsRecursive(e.p->e[0], m, d, upperOffset); + if (n <= d) { + // CASE 1: this (sub)matrix has size < 2^d + // -> we need to keep all the columns of this submatrix + edges[1] = shiftAllRowsRecursive(e.p->e[1], m, d, upperOffset); + if (adaptOffsetOfLowerMatrixHalf) { + upperOffset -= (1 << (n - 1)); + } + edges[2] = shiftAllRowsRecursive(e.p->e[2], m, d, upperOffset); + edges[3] = shiftAllRowsRecursive(e.p->e[3], m, d, upperOffset); } else { - edges[2] = mEdge::zero(); - edges[3] = mEdge::zero(); + std::int64_t addedOffset{1 << (n - 1 - d)}; + if (upperOffset + addedOffset < (1 << m)) { + // CASE 2: this submatrix doesn't contain ancilla qubits + // -> we don't need to set any columns to zero + edges[1] = + shiftAllRowsRecursive(e.p->e[0], m, d, upperOffset + addedOffset); + + if (adaptOffsetOfLowerMatrixHalf) { + upperOffset -= (1 << (n - 1)); + } + edges[2] = shiftAllRowsRecursive(e.p->e[2], m, d, upperOffset); + edges[3] = + shiftAllRowsRecursive(e.p->e[2], m, d, upperOffset + addedOffset); + } else { + // CASE 3: the right half of the matrix represents the ancilla qubits, + // therefore it is set to zero + edges[1] = mEdge::zero(); + if (adaptOffsetOfLowerMatrixHalf) { + upperOffset -= (1 << (n - 1)); + } + edges[2] = shiftAllRowsRecursive(e.p->e[2], m, d, upperOffset); + edges[3] = mEdge::zero(); + } } + auto f = makeDDNode(e.p->v, edges); - // add to the compute table with a weight of 1 - setMatrixRowsToZero.insert(eCopy, k, f); f.w = cn.lookup(e.w * f.w); return f; } +public: + /** + Equally divides the rows of the matrix represented by e into parts + of size 2^m. + For each part we keep only the first 2^d columns + and the i-th row of each part is shifted by i*2^d columns. + **/ + mEdge shiftAllRows(const mEdge& e, Qubit m, Qubit d) { + return shiftAllRowsRecursive(e, m, d, 0); + } + private: - mEdge partialEquivalenceCheckSubroutine(mEdge& u, Qubit m, Qubit k, + // TODO: use compute tables + ComputeTable shiftAllMatrixRows{}; + + mEdge partialEquivalenceCheckSubroutine(mEdge u, Qubit m, Qubit k, Qubit extra) { - auto u1{u}; // add extra ancillary qubits if (extra > 0) { if (u.p->v + 1U + extra > nqubits) { resize(u.p->v + 1U + extra); } auto idExtra = makeIdent(extra); - u1 = kronecker(u, idExtra); + u = kronecker(idExtra, u); } - auto u2 = setColumnsToZero(u1, k); - auto u3 = shiftAllRows(u2, m); - auto u4 = multiply(conjugateTranspose(u1), u3); - auto u5 = setRowsToZero(u4, k); - return u5; + const auto n = static_cast(u.p->v + 1); + Qubit d = n - k; + u = setColumnsToZero(u, d); + auto u2 = shiftAllRows(u, m, d); + return multiply(conjugateTranspose(u), u2); } ComputeTable @@ -3092,15 +3080,15 @@ template class Package { public: /** - Checks for partial equivalence between the two circuits u1 and u2, - where the last d qubits of the circuits are the data qubits and - the last m qubits are the measured qubits. - @param u1 DD representation of first circuit - @param u2 DD representation of second circuit - @param d Number of data qubits - @param m Number of measured qubits - @return true if the two circuits u1 and u2 are partially equivalent. - **/ + Checks for partial equivalence between the two circuits u1 and u2, + where the first d qubits of the circuits are the data qubits and + the first m qubits are the measured qubits. + @param u1 DD representation of first circuit + @param u2 DD representation of second circuit + @param d Number of data qubits + @param m Number of measured qubits + @return true if the two circuits u1 and u2 are partially equivalent. + **/ bool partialEquivalenceCheck(mEdge u1, mEdge u2, Qubit d, Qubit m) { if (m == 0) { return true; @@ -3113,13 +3101,17 @@ template class Package { } // add qubits such that u1 and u2 have the same dimension if (u1.isTerminal()) { - u1 = kronecker(u1, makeIdent(u2.p->v + 1)); + auto w = u1.w; + u1 = makeIdent(u2.p->v + 1); + u1.w = w; } else if (u2.isTerminal()) { - u2 = kronecker(u2, makeIdent(u1.p->v + 1)); + auto w = u2.w; + u2 = makeIdent(u1.p->v + 1); + u2.w = w; } else if (u1.p->v < u2.p->v) { - u1 = kronecker(u1, makeIdent(u2.p->v - u1.p->v)); + u1 = kronecker(makeIdent(u2.p->v - u1.p->v), u1); } else if (u1.p->v > u2.p->v) { - u2 = kronecker(u2, makeIdent(u1.p->v - u2.p->v)); + u2 = kronecker(makeIdent(u1.p->v - u2.p->v), u2); } const Qubit h = u1.p->v + 1; @@ -3146,7 +3138,7 @@ template class Package { @return true if the two circuits u1 and u2 are partially equivalent. **/ bool zeroAncillaPartialEquivalenceCheck(mEdge u1, mEdge u2, Qubit m) { - + // TODO adapt to new order of qubits auto u1u2 = multiply(u1, conjugateTranspose(u2)); return zeroAncillaPartialEquivalenceCheckSubroutine(u1u2, m); } diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index 4b65ef9f5..c86300124 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -3,10 +3,10 @@ namespace dd { -// get next garbage qubit before n +// get next garbage qubit after n inline Qubit getNextGarbage(Qubit n, const std::vector& garbage) { - while (n > 0 && !garbage.at(n)) { - --n; + while (n < garbage.size() && !garbage.at(n)) { + n++; } return n; } @@ -39,14 +39,14 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, // add swaps in order to put the measured (= not garbage) qubits in the end auto garbage = c1.getGarbage(); auto n = static_cast(garbage.size()); - auto nextGarbage = getNextGarbage(n - 1, garbage); + auto nextGarbage = getNextGarbage(0, garbage); // find the first garbage qubit at the end - for (Qubit i = 0U; i < n - static_cast(m1); i++) { + for (Qubit i = n - 1; i >= static_cast(m1); i--) { if (!garbage.at(i)) { - // swap it to the end + // swap it to the beginning c1.swap(i, nextGarbage); c2.swap(i, nextGarbage); - --nextGarbage; + ++nextGarbage; nextGarbage = getNextGarbage(nextGarbage, garbage); } } @@ -55,11 +55,11 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, auto u1 = buildFunctionality(&c1, dd, false, false); auto u2 = buildFunctionality(&c2, dd, false, false); - if (d1 == n) { - // no ancilla qubits - return dd->zeroAncillaPartialEquivalenceCheck(u1, u2, - static_cast(m1)); - } + // if (d1 == n) { + // // no ancilla qubits + // return dd->zeroAncillaPartialEquivalenceCheck(u1, u2, + // static_cast(m1)); + // } return dd->partialEquivalenceCheck(u1, u2, static_cast(d1), static_cast(m1)); } diff --git a/test/circuits/Grover_2.qasm b/test/circuits/Grover_2.qasm index 038b42667..10aef8f77 100644 --- a/test/circuits/Grover_2.qasm +++ b/test/circuits/Grover_2.qasm @@ -1,17 +1,6 @@ OPENQASM 2.0; include "qelib1.inc"; qreg q[12]; -swap q[10], q[11]; -swap q[9], q[10]; -swap q[8], q[9]; -swap q[7], q[8]; -swap q[6], q[7]; -swap q[5], q[6]; -swap q[4], q[5]; -swap q[3], q[4]; -swap q[2], q[3]; -swap q[1], q[2]; -swap q[0], q[1]; x q[10]; h q[0]; h q[1]; @@ -79,14 +68,3 @@ h q[6]; h q[7]; h q[8]; h q[9]; -swap q[0], q[1]; -swap q[1], q[2]; -swap q[2], q[3]; -swap q[3], q[4]; -swap q[4], q[5]; -swap q[5], q[6]; -swap q[6], q[7]; -swap q[7], q[8]; -swap q[8], q[9]; -swap q[9], q[10]; -swap q[10], q[11]; diff --git a/test/circuits/period_finding_1.qasm b/test/circuits/period_finding_1.qasm index 6a3776863..c8e1902d7 100644 --- a/test/circuits/period_finding_1.qasm +++ b/test/circuits/period_finding_1.qasm @@ -1,11 +1,6 @@ OPENQASM 2.0; include "qelib1.inc"; qreg q[8]; - -swap q[0],q[5]; -swap q[1],q[6]; -swap q[2],q[7]; - h q[0]; h q[1]; h q[2]; @@ -401,7 +396,3 @@ s q[3]; cswap q[0], q[1], q[3]; h q[0]; swap q[0], q[2]; - -swap q[0],q[5]; -swap q[1],q[6]; -swap q[2],q[7]; diff --git a/test/circuits/period_finding_2.qasm b/test/circuits/period_finding_2.qasm index f326f558e..df934fd3a 100644 --- a/test/circuits/period_finding_2.qasm +++ b/test/circuits/period_finding_2.qasm @@ -1,11 +1,6 @@ OPENQASM 2.0; include "qelib1.inc"; qreg q[8]; - -swap q[0],q[5]; -swap q[1],q[6]; -swap q[2],q[7]; - h q[0]; h q[1]; h q[2]; @@ -443,7 +438,3 @@ s q[3]; cswap q[0], q[1], q[3]; h q[0]; swap q[0], q[2]; - -swap q[0],q[5]; -swap q[1],q[6]; -swap q[2],q[7]; diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 76ac2a168..4ae646cb1 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -1,16 +1,23 @@ +#include "Definitions.hpp" +#include "QuantumComputation.hpp" #include "dd/Export.hpp" +#include "dd/FunctionalityConstruction.hpp" #include "dd/GateMatrixDefinitions.hpp" #include "dd/Package.hpp" #include "dd/Verification.hpp" #include "dd/statistics/PackageStatistics.hpp" #include "operations/Control.hpp" +#include "operations/OpType.hpp" +#include "operations/StandardOperation.hpp" +#include #include #include #include #include #include #include +#include using namespace qc::literals; @@ -1972,43 +1979,43 @@ TEST(DDPackageTest, DDMShiftAllRows) { const auto inputMatrix = dd::CMat{{1, 0, 0, 0}, {-1, 0, 0, 0}, {-1, 0, 0, 0}, {1, 0, 0, 0}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - const auto outputMatrix = dd->shiftAllRows(inputDD, 1); + const auto outputMatrix = dd->shiftAllRows(inputDD, 1, 0); const auto expectedMatrix = - dd::CMat{{1, 0, 0, 0}, {-1, 0, 0, 0}, {0, -1, 0, 0}, {0, 1, 0, 0}}; + dd::CMat{{1, 0, 0, 0}, {0, -1, 0, 0}, {-1, 0, 0, 0}, {0, 1, 0, 0}}; EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); - const auto outputMatrix2 = dd->shiftAllRows(inputDD, 2); + const auto outputMatrix2 = dd->shiftAllRows(inputDD, 2, 0); const auto expectedMatrix2 = dd::CMat{{1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, -1, 0}, {0, 0, 0, 1}}; EXPECT_EQ(outputMatrix2.getMatrix(), expectedMatrix2); } -TEST(DDPackageTest, DDMShiftAllRows3Qubits) { +TEST(DDPackageTest, DDMShiftAllRows3Qubits0) { const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = - dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, - {-1, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, - {-1, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}}; + dd::CMat{{1, 3, 3, 3, 3, 3, 3, 3}, {-1, 3, 3, 3, 3, 3, 3, 3}, + {-1, 3, 3, 3, 3, 3, 3, 3}, {1, 3, 3, 3, 3, 3, 3, 3}, + {1, 3, 3, 3, 3, 3, 3, 3}, {-1, 3, 3, 3, 3, 3, 3, 3}, + {-1, 3, 3, 3, 3, 3, 3, 3}, {1, 3, 3, 3, 3, 3, 3, 3}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - const auto outputMatrix = dd->shiftAllRows(inputDD, 2); + const auto outputMatrix = dd->shiftAllRows(inputDD, 2, 0); const auto expectedMatrix = - dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, - {0, -1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, -1, 0, 0, 0, 0, 0}, - {0, 0, 0, -1, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0}}; + dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, + {0, 0, -1, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, + {0, 0, -1, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0}}; EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); - const auto outputMatrix4 = dd->shiftAllRows(inputDD, 1); + const auto outputMatrix4 = dd->shiftAllRows(inputDD, 1, 0); const auto expectedMatrix4 = - dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 0, 0}, - {-1, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, - {0, -1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}}; + dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, + {-1, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, + {-1, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}}; EXPECT_EQ(outputMatrix4.getMatrix(), expectedMatrix4); - const auto outputMatrix2 = dd->shiftAllRows(inputDD, 3); + const auto outputMatrix2 = dd->shiftAllRows(inputDD, 3, 0); const auto expectedMatrix2 = dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, {0, 0, -1, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0}, @@ -2017,17 +2024,17 @@ TEST(DDPackageTest, DDMShiftAllRows3Qubits) { EXPECT_EQ(outputMatrix2.getMatrix(), expectedMatrix2); const auto inputMatrix2 = - dd::CMat{{1, 0, 0, 0, 1, 0, 0, 0}, {-1, 0, 0, 0, 1, 0, 0, 0}, - {-1, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 0, 0}, - {1, 0, 0, 0, 1, 0, 0, 0}, {-1, 0, 0, 0, 1, 0, 0, 0}, - {-1, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 0, 0}}; + dd::CMat{{1, 1, 3, 3, 3, 3, 3, 3}, {-1, 1, 3, 3, 3, 3, 3, 3}, + {-1, 1, 3, 3, 3, 3, 3, 3}, {1, 1, 3, 3, 3, 3, 3, 3}, + {1, 1, 3, 3, 3, 3, 3, 3}, {-1, 1, 3, 3, 3, 3, 3, 3}, + {-1, 1, 3, 3, 3, 3, 3, 3}, {1, 1, 3, 3, 3, 3, 3, 3}}; auto inputDD2 = dd->makeDDFromMatrix(inputMatrix2); - const auto outputMatrix3 = dd->shiftAllRows(inputDD2, 1); + const auto outputMatrix3 = dd->shiftAllRows(inputDD2, 1, 1); const auto expectedMatrix3 = - dd::CMat{{1, 0, 0, 0, 1, 0, 0, 0}, {-1, 0, 0, 0, 1, 0, 0, 0}, - {-1, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 0, 0}, - {0, 1, 0, 0, 0, 1, 0, 0}, {0, -1, 0, 0, 0, 1, 0, 0}, - {0, -1, 0, 0, 0, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0, 0}}; + dd::CMat{{1, 1, 0, 0, 0, 0, 0, 0}, {0, 0, -1, 1, 0, 0, 0, 0}, + {-1, 1, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 0}, {0, 0, -1, 1, 0, 0, 0, 0}, + {-1, 1, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 0, 0}}; EXPECT_EQ(outputMatrix3.getMatrix(), expectedMatrix3); } @@ -2037,36 +2044,21 @@ TEST(DDPackageTest, DDMShiftAllRows5Qubits) { const std::uint64_t n = 1 << nqubits; std::vector> row10(n, 0); std::vector> row01(n, 1); - for (std::uint64_t i = 0; i < n; i += 2) { + for (std::uint64_t i = 0; i < n / 2; i++) { row10[i] = 1; row01[i] = 0; } - const dd::CMat inputMatrix( - n, row10); // inputMatrix = [1, 0, 1, 0...]...[1, 0, 1, 0...]... + // inputMatrix = [1, 1, ... 0, 0 ...]...[1, 1, ... 0, 0...]... + const dd::CMat inputMatrix(n, row10); auto inputDD = dd->makeDDFromMatrix(inputMatrix); - const auto outputMatrix = dd->shiftAllRows(inputDD, 1); - dd::CMat expectedMatrix(n / 2, row10); - dd::CMat expectedMatrixPart2(n / 2, row01); - expectedMatrix.insert(expectedMatrix.end(), expectedMatrixPart2.begin(), - expectedMatrixPart2.end()); - // expectedMatrix = [1, 0, 1, 0...]...[0, 1, 0, 1...]... - EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); -} - -TEST(DDPackageTest, DDMSetColumnsToZero) { - const auto nqubits = 2U; - auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - - const auto outputMatrix = dd->setColumnsToZero(inputDD, 1); - const auto expectedMatrix = - dd::CMat{{1, 0, 1, 0}, {1, 0, 1, 0}, {1, 0, -1, 0}, {1, 0, -1, 0}}; + const auto outputMatrix = dd->shiftAllRows(inputDD, 1, nqubits - 1); + dd::CMat expectedMatrix(n, row01); + for (std::uint64_t i = 0; i < n; i += 2) { + expectedMatrix[i] = row10; + } + // expectedMatrix = [1, 1, ... 0, 0 ...][0, 0, ... 1, 1 ...]... EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); - - EXPECT_EQ(dd->setColumnsToZero(inputDD, 0), inputDD); } TEST(DDPackageTest, @@ -2083,44 +2075,6 @@ TEST(DDPackageTest, EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); } -TEST(DDPackageTest, DDMSetRowsToZero) { - const auto nqubits = 2U; - auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - - const auto outputMatrix = dd->setRowsToZero(inputDD, 1); - const auto expectedMatrix = - dd::CMat{{1, 1, 1, 1}, {0, 0, 0, 0}, {1, 1, -1, -1}, {0, 0, 0, 0}}; - EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); - - EXPECT_EQ(dd->setRowsToZero(inputDD, 0), inputDD); -} - -TEST(DDPackageTest, DDMPartialEquivalenceCheckingFunctionsNotNormalized) { - const auto nqubits = 2U; - auto dd = std::make_unique>(nqubits); - const auto inputMatrix = dd::CMat{ - {7, 9, 4, 1}, {3, -51, 0, -10000}, {7, 1, -7, -7}, {7, -1, -7, 1}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - - const auto outputMatrix = dd->setRowsToZero(inputDD, 1); - const auto expectedMatrix = - dd::CMat{{7, 9, 4, 1}, {0, 0, 0, 0}, {7, 1, -7, -7}, {0, 0, 0, 0}}; - EXPECT_EQ(outputMatrix, dd->makeDDFromMatrix(expectedMatrix)); - - const auto outputMatrix2 = dd->setColumnsToZero(inputDD, 1); - const auto expectedMatrix2 = - dd::CMat{{7, 0, 4, 0}, {3, 0, 0, 0}, {7, 0, -7, 0}, {7, 0, -7, 0}}; - EXPECT_EQ(outputMatrix2, dd->makeDDFromMatrix(expectedMatrix2)); - - const auto outputMatrix3 = dd->shiftAllRows(outputMatrix2, 1); - const auto expectedMatrix3 = - dd::CMat{{7, 0, 4, 0}, {3, 0, 0, 0}, {0, 7, 0, -7}, {0, 7, 0, -7}}; - EXPECT_EQ(outputMatrix3, dd->makeDDFromMatrix(expectedMatrix3)); -} - TEST(DDPackageTest, DDMPartialEquivalenceCheckingTrivialEquivalence) { const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); @@ -2143,7 +2097,7 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingTest) { const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); // only the second qubit has differing gates in the two circuits, - // therefore they should be equivalent if we only measure the third qubit + // therefore they should be equivalent if we only measure the first qubit auto hGate = dd->makeGateDD(dd::H_MAT, 3, 1); auto xGate = dd->makeGateDD(dd::X_MAT, 3, 1); auto circuit1 = dd->multiply(xGate, hGate); @@ -2155,10 +2109,10 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingTest) { TEST(DDPackageTest, DDMPartialEquivalenceCheckingTestNotEquivalent) { const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); - // the second qubit has differing gates in the two circuits, - // therefore they should not be equivalent if we only measure the second qubit - auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 1); - auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + // the first qubit has differing gates in the two circuits, + // therefore they should not be equivalent if we only measure the first qubit + auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 0); auto circuit1 = dd->multiply(xGate, hGate); auto circuit2 = dd->makeIdent(2); EXPECT_FALSE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); @@ -2168,10 +2122,10 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 0, 2); - auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 2); - auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 0); + auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); - auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 2); + auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); auto c1 = dd->multiply( controlledSwapGate, @@ -2181,35 +2135,36 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); } -TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncilla) { - const auto nqubits = 3U; - auto dd = std::make_unique>(nqubits); - auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 0, 2); - auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 2); - auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 0); - auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); - auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 2); +// TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncilla) { +// const auto nqubits = 3U; +// auto dd = std::make_unique>(nqubits); +// auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 0, 2); +// auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); +// auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); +// auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); +// auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, +// 0); - auto c1 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - auto c2 = dd->multiply(controlledHGate, xGate); +// auto c1 = dd->multiply( +// controlledSwapGate, +// dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); +// auto c2 = dd->multiply(controlledHGate, xGate); - EXPECT_TRUE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 1)); - EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 2)); +// EXPECT_TRUE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 1)); +// EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 2)); - auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 0); - auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 2); - auto controlledHGate2 = - dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 2); +// auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 2); +// auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 0); +// auto controlledHGate2 = +// dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - auto c3 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate2, dd->multiply(zGate2, controlledSwapGate))); - auto c4 = dd->multiply(controlledHGate2, xGate); +// auto c3 = dd->multiply( +// controlledSwapGate, +// dd->multiply(hGate2, dd->multiply(zGate2, controlledSwapGate))); +// auto c4 = dd->multiply(controlledHGate2, xGate); - EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c3, c4, 1)); -} +// EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c3, c4, 1)); +// } TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperDifferentQubitOrder) { @@ -2217,37 +2172,37 @@ TEST(DDPackageTest, auto dd = std::make_unique>(nqubits); qc::QuantumComputation c1{3, 1}; - c1.cswap(1, 0, 2); - c1.h(0); - c1.z(2); - c1.cswap(1, 0, 2); + c1.cswap(1, 2, 0); + c1.h(2); + c1.z(0); + c1.cswap(1, 2, 0); qc::QuantumComputation c2{3, 1}; c2.x(1); - c2.ch(1, 0); + c2.ch(1, 2); c1.setLogicalQubitGarbage(1); - c1.setLogicalQubitGarbage(2); + c1.setLogicalQubitGarbage(0); c2.setLogicalQubitGarbage(1); - c2.setLogicalQubitGarbage(2); + c2.setLogicalQubitGarbage(0); EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); } TEST(DDPackageTest, DDMPartialEquivalenceWithDifferentNumberOfQubits) { auto dd = std::make_unique>(3); auto controlledSwapGate = dd->makeSWAPDD(3, qc::Controls{1}, 0, 2); - auto hGate = dd->makeGateDD(dd::H_MAT, 3, 2); - auto zGate = dd->makeGateDD(dd::Z_MAT, 3, 0); - auto xGate = dd->makeGateDD(dd::X_MAT, 2, 0); - auto controlledHGate = dd->makeGateDD(dd::H_MAT, 2, qc::Controls{0}, 1); + auto hGate = dd->makeGateDD(dd::H_MAT, 3, 0); + auto zGate = dd->makeGateDD(dd::Z_MAT, 3, 2); + auto xGate = dd->makeGateDD(dd::X_MAT, 2, 1); + auto controlledHGate = dd->makeGateDD(dd::H_MAT, 2, qc::Controls{1}, 0); auto c1 = dd->multiply( controlledSwapGate, dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); auto c2 = dd->multiply(controlledHGate, xGate); - EXPECT_TRUE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 1)); + // EXPECT_TRUE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 1)); EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); EXPECT_FALSE(dd->partialEquivalenceCheck(c2, c1, 3, 3)); EXPECT_FALSE(dd->partialEquivalenceCheck(c2, dd::mEdge::zero(), 2, 1)); @@ -2262,11 +2217,11 @@ TEST(DDPackageTest, DDMPartialEquivalenceWithDifferentNumberOfQubits) { TEST(DDPackageTest, DDMPartialEquivalenceCheckingComputeTable) { const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); - auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 0, 2); - auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 2); - auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 0); + auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 2, 0); + auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); - auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 2); + auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); auto c1 = dd->multiply( controlledSwapGate, @@ -2376,12 +2331,10 @@ TEST(DDPackageTest, DDMPECSliQECGrover) { "./circuits/Grover_2.qasm"}; // 12 qubits, 11 data qubits // 11 measured qubits and 11 data qubits - // auto c1Dd = buildFunctionality(&c1, dd, false, false); - // auto c2Dd = buildFunctionality(&c2, dd, false, false); + auto c1Dd = buildFunctionality(&c1, dd, false, false); + auto c2Dd = buildFunctionality(&c2, dd, false, false); // adds 10 ancillary qubits -> total number of qubits is 22 - // doesn't terminate - // EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 11, 11)); - EXPECT_TRUE(true); + EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 11, 11)); } TEST(DDPackageTest, DDMPECSliQECAdd) { @@ -2410,26 +2363,115 @@ TEST(DDPackageTest, DDMPECSliQECPeriodFinding) { // 3 measured qubits and 3 data qubits - c2.setLogicalQubitAncillary(0); - c2.setLogicalQubitGarbage(0); - c2.setLogicalQubitAncillary(1); - c2.setLogicalQubitGarbage(1); - c2.setLogicalQubitAncillary(2); - c2.setLogicalQubitGarbage(2); + c2.setLogicalQubitAncillary(7); + c2.setLogicalQubitGarbage(7); + c2.setLogicalQubitAncillary(6); + c2.setLogicalQubitGarbage(6); + c2.setLogicalQubitAncillary(5); + c2.setLogicalQubitGarbage(5); c2.setLogicalQubitAncillary(3); c2.setLogicalQubitGarbage(3); c2.setLogicalQubitAncillary(4); c2.setLogicalQubitGarbage(4); - c1.setLogicalQubitAncillary(0); - c1.setLogicalQubitGarbage(0); - c1.setLogicalQubitAncillary(1); - c1.setLogicalQubitGarbage(1); - c1.setLogicalQubitAncillary(2); - c1.setLogicalQubitGarbage(2); + c1.setLogicalQubitAncillary(7); + c1.setLogicalQubitGarbage(7); + c1.setLogicalQubitAncillary(6); + c1.setLogicalQubitGarbage(6); + c1.setLogicalQubitAncillary(5); + c1.setLogicalQubitGarbage(5); c1.setLogicalQubitAncillary(3); c1.setLogicalQubitGarbage(3); c1.setLogicalQubitAncillary(4); c1.setLogicalQubitGarbage(4); EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); } + +TEST(DDPackageTest, DDMShiftAllRows3Qubits1) { + const size_t nqubits = 3U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + std::cout << "inputMatrix:" << std::endl; + inputDD.printMatrix(); + std::cout << std::endl; + dd::Qubit m = 2; + dd::Qubit d = 1; + std::cout << "m = " << m << std::endl; + std::cout << "d = " << d << std::endl; + const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); + const auto expectedOutputMatrix = + dd->makeDDFromMatrix(dd::CMat{{1, 2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 2, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 2}, + {1, 2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 2, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 2}}); + EXPECT_EQ(outputMatrix, expectedOutputMatrix); +} + +TEST(DDPackageTest, DDMShiftAllRows3Qubits2) { + const size_t nqubits = 3U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + std::cout << "inputMatrix:" << std::endl; + inputDD.printMatrix(); + std::cout << std::endl; + dd::Qubit m = 1; + dd::Qubit d = 2; + std::cout << "m = " << m << std::endl; + std::cout << "d = " << d << std::endl; + const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); + const auto expectedOutputMatrix = + dd->makeDDFromMatrix(dd::CMat{{1, 2, 3, 4, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 2, 3, 4}, + {1, 2, 3, 4, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 2, 3, 4}, + {1, 2, 3, 4, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 2, 3, 4}, + {1, 2, 3, 4, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 2, 3, 4}}); + + EXPECT_EQ(outputMatrix, expectedOutputMatrix); +} + +TEST(DDPackageTest, DDMShiftAllRows3Qubits3) { + const size_t nqubits = 3U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + std::cout << "inputMatrix:" << std::endl; + inputDD.printMatrix(); + std::cout << std::endl; + dd::Qubit m = 1; + dd::Qubit d = 1; + std::cout << "m = " << m << std::endl; + std::cout << "d = " << d << std::endl; + const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); + auto outputMatrixMatrix = outputMatrix.getMatrix(); + const auto expectedOutputMatrix = + dd->makeDDFromMatrix(dd::CMat{{1, 2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0}, + {1, 2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0}, + {1, 2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0}, + {1, 2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0}}); + EXPECT_EQ(outputMatrix, expectedOutputMatrix); +} From 884bd4eb85917543f30bb140ea7489e0fd327cbc Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Thu, 4 Jan 2024 10:56:00 +0100 Subject: [PATCH 20/51] changes requested in pull request --- include/QuantumComputation.hpp | 5 +++++ include/dd/Package.hpp | 9 ++++----- include/dd/Verification.hpp | 8 ++------ test/dd/test_package.cpp | 13 +++++++------ 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/QuantumComputation.hpp b/include/QuantumComputation.hpp index 1fd6fd9bb..de0d07246 100644 --- a/include/QuantumComputation.hpp +++ b/include/QuantumComputation.hpp @@ -289,6 +289,11 @@ class QuantumComputation { [[nodiscard]] std::size_t getNqubitsWithoutAncillae() const { return nqubits; } + [[nodiscard]] std::size_t getNgarbageQubits() const { + return getNqubits() - static_cast(std::count( + getGarbage().begin(), getGarbage().end(), true)); + ; + } [[nodiscard]] std::size_t getNcbits() const { return nclassics; } [[nodiscard]] std::string getName() const { return name; } [[nodiscard]] const QuantumRegisterMap& getQregs() const { return qregs; } diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index f22d541f0..2338e77d6 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -3039,8 +3039,7 @@ template class Package { if (u.p->v + 1U + extra > nqubits) { resize(u.p->v + 1U + extra); } - auto idExtra = makeIdent(extra); - u = kronecker(idExtra, u); + u = kronecker(makeIdent(extra), u); } const auto n = static_cast(u.p->v + 1); Qubit d = n - k; @@ -3059,7 +3058,7 @@ template class Package { if (m == 0) { return true; } - mEdge eCopy{e.p, Complex::one()}; + const mEdge eCopy{e.p, Complex::one()}; // check if it's in the compute table with an edge weight of one if (const auto* r = zeroAncillaPartialEquivalenceCheckSubroutineComputeTable.lookup( @@ -3114,8 +3113,8 @@ template class Package { u2 = kronecker(makeIdent(u1.p->v - u2.p->v), u2); } - const Qubit h = u1.p->v + 1; - Qubit k = h - d; + const Qubit n = u1.p->v + 1; + Qubit k = n - d; Qubit extra{0}; if (m > k) { extra = m - k; diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index c86300124..abf980cbc 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -26,12 +26,8 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, auto d1 = c1.getNqubitsWithoutAncillae(); auto d2 = c2.getNqubitsWithoutAncillae(); - auto m1 = c1.getNqubits() - - static_cast(std::count(c1.getGarbage().begin(), - c1.getGarbage().end(), true)); - auto m2 = c2.getNqubits() - - static_cast(std::count(c2.getGarbage().begin(), - c2.getGarbage().end(), true)); + auto m1 = c1.getNgarbageQubits(); + auto m2 = c2.getNgarbageQubits(); if (m1 != m2 || d1 != d2) { return false; } diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 4ae646cb1..a92c0be86 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2238,9 +2238,10 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingComputeTable) { TEST(DDPackageTest, DDMPECMQTBenchGrover3Qubits) { auto dd = std::make_unique>(7); - qc::QuantumComputation c1{ + const qc::QuantumComputation c1{ "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm"}; - qc::QuantumComputation c2{"./circuits/grover-noancilla_indep_qiskit_3.qasm"}; + const qc::QuantumComputation c2{ + "./circuits/grover-noancilla_indep_qiskit_3.qasm"}; // 3 measured qubits and 3 data qubits, full equivalence EXPECT_TRUE(dd->partialEquivalenceCheck( @@ -2251,9 +2252,9 @@ TEST(DDPackageTest, DDMPECMQTBenchGrover3Qubits) { TEST(DDPackageTest, DDMPECMQTBenchGrover7Qubits) { auto dd = std::make_unique>(7); - qc::QuantumComputation c1{ + const qc::QuantumComputation c1{ "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm"}; - qc::QuantumComputation c2{ + const qc::QuantumComputation c2{ "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm"}; // 7 measured qubits and 7 data qubits, full equivalence @@ -2267,9 +2268,9 @@ TEST(DDPackageTest, DDMZAPECMQTBenchQPE30Qubits) { auto dd = std::make_unique>(31); // 30 qubits - qc::QuantumComputation c1{ + const qc::QuantumComputation c1{ "./circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm"}; - qc::QuantumComputation c2{"./circuits/qpeexact_indep_qiskit_30.qasm"}; + const qc::QuantumComputation c2{"./circuits/qpeexact_indep_qiskit_30.qasm"}; // buildFunctionality is already very very slow... // auto f1 = buildFunctionality(&c1, dd, false, false); From 244872c97b4f8978c9e4176c5e549f32f027e3a6 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Thu, 4 Jan 2024 13:11:07 +0100 Subject: [PATCH 21/51] implemented zeroAncilla PEC for new qubit order --- include/QuantumComputation.hpp | 9 ++++++--- include/dd/Package.hpp | 24 +++++++++++++++--------- include/dd/Verification.hpp | 16 ++++++++-------- test/dd/test_package.cpp | 21 ++++++++++++++++++--- 4 files changed, 47 insertions(+), 23 deletions(-) diff --git a/include/QuantumComputation.hpp b/include/QuantumComputation.hpp index de0d07246..551e60cfd 100644 --- a/include/QuantumComputation.hpp +++ b/include/QuantumComputation.hpp @@ -289,10 +289,13 @@ class QuantumComputation { [[nodiscard]] std::size_t getNqubitsWithoutAncillae() const { return nqubits; } + [[nodiscard]] std::size_t getNmeasuredQubits() const { + return static_cast( + std::count(getGarbage().begin(), getGarbage().end(), false)); + } [[nodiscard]] std::size_t getNgarbageQubits() const { - return getNqubits() - static_cast(std::count( - getGarbage().begin(), getGarbage().end(), true)); - ; + return static_cast( + std::count(getGarbage().begin(), getGarbage().end(), true)); } [[nodiscard]] std::size_t getNcbits() const { return nclassics; } [[nodiscard]] std::string getName() const { return name; } diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 2338e77d6..14ba1241a 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -3051,13 +3051,13 @@ template class Package { ComputeTable zeroAncillaPartialEquivalenceCheckSubroutineComputeTable{}; +public: bool zeroAncillaPartialEquivalenceCheckSubroutine(mEdge e, Qubit m) { if (e.isTerminal()) { - return m < 1; - } - if (m == 0) { return true; } + const auto n = e.p->v + 1; + const mEdge eCopy{e.p, Complex::one()}; // check if it's in the compute table with an edge weight of one if (const auto* r = @@ -3067,17 +3067,24 @@ template class Package { auto f = *r; return f; } - bool result = - e.p->e[1].isZeroTerminal() && e.p->e[2].isZeroTerminal() && - zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[0], m - 1) && - zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[3], m - 1); + bool result = false; + if (m >= n) { + result = e.p->e[1].isZeroTerminal() && e.p->e[2].isZeroTerminal() && + zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[0], m) && + zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[3], m); + } else { + result = zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[0], m) && + zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[1], m) && + zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[2], m) && + zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[3], m); + } + // add to the compute table with a weight of 1 zeroAncillaPartialEquivalenceCheckSubroutineComputeTable.insert(eCopy, m, result); return result; } -public: /** Checks for partial equivalence between the two circuits u1 and u2, where the first d qubits of the circuits are the data qubits and @@ -3137,7 +3144,6 @@ template class Package { @return true if the two circuits u1 and u2 are partially equivalent. **/ bool zeroAncillaPartialEquivalenceCheck(mEdge u1, mEdge u2, Qubit m) { - // TODO adapt to new order of qubits auto u1u2 = multiply(u1, conjugateTranspose(u2)); return zeroAncillaPartialEquivalenceCheckSubroutine(u1u2, m); } diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index abf980cbc..7347956cc 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -12,7 +12,7 @@ inline Qubit getNextGarbage(Qubit n, const std::vector& garbage) { } /** Checks for partial equivalence between the two circuits c1 and c2. - Assumption: the data qubits are all at the end of the input qubits and + Assumption: the data qubits are all at the beginning of the input qubits and the input and output permutations are the same. @param circuit1 First circuit @@ -26,8 +26,8 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, auto d1 = c1.getNqubitsWithoutAncillae(); auto d2 = c2.getNqubitsWithoutAncillae(); - auto m1 = c1.getNgarbageQubits(); - auto m2 = c2.getNgarbageQubits(); + auto m1 = c1.getNmeasuredQubits(); + auto m2 = c2.getNmeasuredQubits(); if (m1 != m2 || d1 != d2) { return false; } @@ -51,11 +51,11 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, auto u1 = buildFunctionality(&c1, dd, false, false); auto u2 = buildFunctionality(&c2, dd, false, false); - // if (d1 == n) { - // // no ancilla qubits - // return dd->zeroAncillaPartialEquivalenceCheck(u1, u2, - // static_cast(m1)); - // } + if (d1 == n) { + // no ancilla qubits + return dd->zeroAncillaPartialEquivalenceCheck(u1, u2, + static_cast(m1)); + } return dd->partialEquivalenceCheck(u1, u2, static_cast(d1), static_cast(m1)); } diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index a92c0be86..f916082b2 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2315,13 +2315,28 @@ TEST(DDPackageTest, DDMZAPECSliQECRandomCircuit) { qc::QuantumComputation c1{"./circuits/random_1.qasm"}; qc::QuantumComputation c2{"./circuits/random_2.qasm"}; - // calls buildFunctionality for c1 and c2 -> this takes already 2 minutes on - // my computer then it calls zeroAncillaPartialEquivalenceCheck, which calls - // multiply, that is very very slow on my computer + // calls buildFunctionality for c1 concatenated with the inverse of c2 + // -> this is already very very slow on my computer // EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); EXPECT_TRUE(true); } +TEST(DDPackageTest, DDMZAPECSliQECRandomCircuitMultiplication) { + // doesn't terminate + auto dd = std::make_unique>(20); + // full equivalence, 10 qubits + qc::QuantumComputation c1{"./circuits/random_1.qasm"}; + qc::QuantumComputation c2{"./circuits/random_2.qasm"}; + // calls buildFunctionality for c1 and c2 -> this takes already 2 minutes on + // my computer + // auto f1 = buildFunctionality(&c1, dd, false, false); + // auto f2 = buildFunctionality(&c2, dd, false, false); + // zeroAncillaPartialEquivalenceCheck calls multiply, + // that is very very slow on my computer + // EXPECT_TRUE(dd->zeroAncillaPartialEquivalenceCheck(f1, f2, 10)); + EXPECT_TRUE(true); +} + TEST(DDPackageTest, DDMPECSliQECGrover) { // doesn't terminate auto dd = std::make_unique>(22); From 2062f5bbfc7c9b21b47fb2eeb8fbc00621671d60 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Sat, 6 Jan 2024 12:58:49 +0100 Subject: [PATCH 22/51] add compute table for shiftAllRows --- include/dd/Package.hpp | 32 +++++++++++++++++++++++++++++--- test/dd/test_package.cpp | 3 +++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 14ba1241a..74b4da673 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2890,6 +2890,7 @@ template class Package { return newedge; } + // only keeps the first 2^d columns mEdge setColumnsToZero(const mEdge& e, Qubit d) { if (e.isTerminal()) { @@ -2912,6 +2913,7 @@ template class Package { f.w = cn.lookup(e.w * f.w); return f; } + mEdge keepOnlyIthRow(const mEdge& e, std::int64_t i) { if (e.isZeroTerminal()) { return e; @@ -2942,6 +2944,11 @@ template class Package { f.w = cn.lookup(e.w * f.w); return f; } + + UnaryComputeTable shiftAllMatrixRows{}; + Qubit shiftAllMatrixRowsM{0}; + Qubit shiftAllMatrixRowsD{0}; + /** Equally divides the rows of the matrix represented by e (of size 2^n x 2^n) into 2^g parts of size 2^m (where g = n - m). @@ -2958,6 +2965,7 @@ template class Package { if (upperOffset == 0 && m == 0) { return e; } + // the matrix of the current DD has dimensions 2^n x 2^n const auto n = e.p->v + 1; if (upperOffset < 0 && m < n) { @@ -2967,11 +2975,23 @@ template class Package { return mEdge::zero(); } + const mEdge eCopy{e.p, Complex::one()}; + // check if it's in the compute table with an edge weight of one + // only store elements in the compute table if the offset is 0 + if (upperOffset == 0) { + if (const auto* r = shiftAllMatrixRows.lookup(eCopy); r != nullptr) { + auto f = *r; + f.w = cn.lookup(e.w * f.w); + return f; + } + } + if (d >= n && m >= n) { return keepOnlyIthRow(e, upperOffset); } std::array edges{}; + auto originalUpperOffset = upperOffset; // if the current submatrix size is less than 2^m, // then the offset of the lower half needs to be adapted @@ -3013,6 +3033,10 @@ template class Package { } auto f = makeDDNode(e.p->v, edges); + // add to the compute table with a weight of 1 + if (originalUpperOffset == 0) { + shiftAllMatrixRows.insert(eCopy, f); + } f.w = cn.lookup(e.w * f.w); return f; } @@ -3025,13 +3049,15 @@ template class Package { and the i-th row of each part is shifted by i*2^d columns. **/ mEdge shiftAllRows(const mEdge& e, Qubit m, Qubit d) { + if (shiftAllMatrixRowsM != m || shiftAllMatrixRowsD != d) { + shiftAllMatrixRows.clear(); + shiftAllMatrixRowsM = m; + shiftAllMatrixRowsD = d; + } return shiftAllRowsRecursive(e, m, d, 0); } private: - // TODO: use compute tables - ComputeTable shiftAllMatrixRows{}; - mEdge partialEquivalenceCheckSubroutine(mEdge u, Qubit m, Qubit k, Qubit extra) { // add extra ancillary qubits diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index f916082b2..4bb973570 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2420,6 +2420,9 @@ TEST(DDPackageTest, DDMShiftAllRows3Qubits1) { std::cout << "m = " << m << std::endl; std::cout << "d = " << d << std::endl; const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); + std::cout << "outputMatrix:" << std::endl; + outputMatrix.printMatrix(); + std::cout << std::endl; const auto expectedOutputMatrix = dd->makeDDFromMatrix(dd::CMat{{1, 2, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 2, 0, 0, 0, 0}, From ab22a2def23ce35750c71c120723eed73650c401 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Sat, 6 Jan 2024 13:01:49 +0100 Subject: [PATCH 23/51] :mute: remove debug cout --- test/dd/test_package.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 4bb973570..85ee2edfd 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2412,17 +2412,9 @@ TEST(DDPackageTest, DDMShiftAllRows3Qubits1) { {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - std::cout << "inputMatrix:" << std::endl; - inputDD.printMatrix(); - std::cout << std::endl; dd::Qubit m = 2; dd::Qubit d = 1; - std::cout << "m = " << m << std::endl; - std::cout << "d = " << d << std::endl; const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); - std::cout << "outputMatrix:" << std::endl; - outputMatrix.printMatrix(); - std::cout << std::endl; const auto expectedOutputMatrix = dd->makeDDFromMatrix(dd::CMat{{1, 2, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 2, 0, 0, 0, 0}, @@ -2444,13 +2436,8 @@ TEST(DDPackageTest, DDMShiftAllRows3Qubits2) { {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - std::cout << "inputMatrix:" << std::endl; - inputDD.printMatrix(); - std::cout << std::endl; dd::Qubit m = 1; dd::Qubit d = 2; - std::cout << "m = " << m << std::endl; - std::cout << "d = " << d << std::endl; const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); const auto expectedOutputMatrix = dd->makeDDFromMatrix(dd::CMat{{1, 2, 3, 4, 0, 0, 0, 0}, @@ -2474,13 +2461,8 @@ TEST(DDPackageTest, DDMShiftAllRows3Qubits3) { {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - std::cout << "inputMatrix:" << std::endl; - inputDD.printMatrix(); - std::cout << std::endl; dd::Qubit m = 1; dd::Qubit d = 1; - std::cout << "m = " << m << std::endl; - std::cout << "d = " << d << std::endl; const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); auto outputMatrixMatrix = outputMatrix.getMatrix(); const auto expectedOutputMatrix = From 34bd8500d3e0f018c9d578e7f85caf8f32afc785 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Sat, 6 Jan 2024 13:27:09 +0100 Subject: [PATCH 24/51] :recycle: rename some tests and a compute table --- include/dd/Package.hpp | 14 +-- test/dd/test_package.cpp | 242 +++++++++++++++++---------------------- 2 files changed, 111 insertions(+), 145 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 74b4da673..595c23a0d 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -3074,10 +3074,8 @@ template class Package { return multiply(conjugateTranspose(u), u2); } - ComputeTable - zeroAncillaPartialEquivalenceCheckSubroutineComputeTable{}; + ComputeTable zeroAncillaPECComputeTable{}; -public: bool zeroAncillaPartialEquivalenceCheckSubroutine(mEdge e, Qubit m) { if (e.isTerminal()) { return true; @@ -3086,9 +3084,7 @@ template class Package { const mEdge eCopy{e.p, Complex::one()}; // check if it's in the compute table with an edge weight of one - if (const auto* r = - zeroAncillaPartialEquivalenceCheckSubroutineComputeTable.lookup( - eCopy, m); + if (const auto* r = zeroAncillaPECComputeTable.lookup(eCopy, m); r != nullptr) { auto f = *r; return f; @@ -3106,11 +3102,11 @@ template class Package { } // add to the compute table with a weight of 1 - zeroAncillaPartialEquivalenceCheckSubroutineComputeTable.insert(eCopy, m, - result); + zeroAncillaPECComputeTable.insert(eCopy, m, result); return result; } +public: /** Checks for partial equivalence between the two circuits u1 and u2, where the first d qubits of the circuits are the data qubits and @@ -3163,7 +3159,7 @@ template class Package { /** Checks for partial equivalence between the two circuits u1 and u2, where all qubits of the circuits are the data qubits and - the last m qubits are the measured qubits. + the first m qubits are the measured qubits. @param u1 DD representation of first circuit @param u2 DD representation of second circuit @param m Number of measured qubits diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 85ee2edfd..44c6e70ac 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -1989,7 +1989,7 @@ TEST(DDPackageTest, DDMShiftAllRows) { EXPECT_EQ(outputMatrix2.getMatrix(), expectedMatrix2); } -TEST(DDPackageTest, DDMShiftAllRows3Qubits0) { +TEST(DDPackageTest, DDMShiftAllRows3QubitsPart0) { const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); const auto inputMatrix = @@ -2038,6 +2038,80 @@ TEST(DDPackageTest, DDMShiftAllRows3Qubits0) { EXPECT_EQ(outputMatrix3.getMatrix(), expectedMatrix3); } +TEST(DDPackageTest, DDMShiftAllRows3QubitsPart1) { + const size_t nqubits = 3U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + dd::Qubit m = 2; + dd::Qubit d = 1; + const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); + const auto expectedOutputMatrix = + dd->makeDDFromMatrix(dd::CMat{{1, 2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 2, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 2}, + {1, 2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 2, 0, 0}, + {0, 0, 0, 0, 0, 0, 1, 2}}); + EXPECT_EQ(outputMatrix, expectedOutputMatrix); +} + +TEST(DDPackageTest, DDMShiftAllRows3QubitsPart2) { + const size_t nqubits = 3U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + dd::Qubit m = 1; + dd::Qubit d = 2; + const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); + const auto expectedOutputMatrix = + dd->makeDDFromMatrix(dd::CMat{{1, 2, 3, 4, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 2, 3, 4}, + {1, 2, 3, 4, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 2, 3, 4}, + {1, 2, 3, 4, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 2, 3, 4}, + {1, 2, 3, 4, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 2, 3, 4}}); + + EXPECT_EQ(outputMatrix, expectedOutputMatrix); +} + +TEST(DDPackageTest, DDMShiftAllRows3QubitsPart3) { + const size_t nqubits = 3U; + auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, + {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + dd::Qubit m = 1; + dd::Qubit d = 1; + const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); + auto outputMatrixMatrix = outputMatrix.getMatrix(); + const auto expectedOutputMatrix = + dd->makeDDFromMatrix(dd::CMat{{1, 2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0}, + {1, 2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0}, + {1, 2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0}, + {1, 2, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 2, 0, 0, 0, 0}}); + EXPECT_EQ(outputMatrix, expectedOutputMatrix); +} + TEST(DDPackageTest, DDMShiftAllRows5Qubits) { const auto nqubits = 5U; auto dd = std::make_unique>(nqubits); @@ -2061,20 +2135,6 @@ TEST(DDPackageTest, DDMShiftAllRows5Qubits) { EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); } -TEST(DDPackageTest, - DDMSetColumnsToZeroWithReduceAncillae) { // the test passes but it's wrong - const auto nqubits = 3U; - auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - dd->incRef(inputDD); - const auto outputMatrix = dd->reduceAncillae(inputDD, {true, false}); - const auto expectedMatrix = - dd::CMat{{1, 0, 1, 0}, {1, 0, 1, 0}, {1, 0, 1, 0}, {1, 0, 1, 0}}; - EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); -} - TEST(DDPackageTest, DDMPartialEquivalenceCheckingTrivialEquivalence) { const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); @@ -2093,7 +2153,7 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingTrivialEquivalence) { EXPECT_FALSE(dd->partialEquivalenceCheck(inputDD, bellMatrix, 1, 1)); } -TEST(DDPackageTest, DDMPartialEquivalenceCheckingTest) { +TEST(DDPackageTest, DDMPartialEquivalenceChecking) { const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); // only the second qubit has differing gates in the two circuits, @@ -2116,6 +2176,7 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingTestNotEquivalent) { auto circuit1 = dd->multiply(xGate, hGate); auto circuit2 = dd->makeIdent(2); EXPECT_FALSE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); + EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(circuit1, circuit2, 1)); } TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { @@ -2135,36 +2196,35 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); } -// TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncilla) { -// const auto nqubits = 3U; -// auto dd = std::make_unique>(nqubits); -// auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 0, 2); -// auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); -// auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); -// auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); -// auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, -// 0); +TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncilla) { + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 0, 2); + auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); + auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); -// auto c1 = dd->multiply( -// controlledSwapGate, -// dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); -// auto c2 = dd->multiply(controlledHGate, xGate); + auto c1 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); + auto c2 = dd->multiply(controlledHGate, xGate); -// EXPECT_TRUE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 1)); -// EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 2)); + EXPECT_TRUE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 1)); + EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 2)); -// auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 2); -// auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 0); -// auto controlledHGate2 = -// dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); + auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 2); + auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 0); + auto controlledHGate2 = + dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); -// auto c3 = dd->multiply( -// controlledSwapGate, -// dd->multiply(hGate2, dd->multiply(zGate2, controlledSwapGate))); -// auto c4 = dd->multiply(controlledHGate2, xGate); + auto c3 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate2, dd->multiply(zGate2, controlledSwapGate))); + auto c4 = dd->multiply(controlledHGate2, xGate); -// EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c3, c4, 1)); -// } + EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c3, c4, 1)); +} TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperDifferentQubitOrder) { @@ -2283,7 +2343,7 @@ TEST(DDPackageTest, DDMZAPECMQTBenchQPE30Qubits) { EXPECT_TRUE(true); } -TEST(DDPackageTest, DDMZAPECSliQEC) { +TEST(DDPackageTest, DDMZAPECSliQEC19Qubits) { auto dd = std::make_unique>(20); // full equivalence, 10 qubits @@ -2315,29 +2375,13 @@ TEST(DDPackageTest, DDMZAPECSliQECRandomCircuit) { qc::QuantumComputation c1{"./circuits/random_1.qasm"}; qc::QuantumComputation c2{"./circuits/random_2.qasm"}; - // calls buildFunctionality for c1 concatenated with the inverse of c2 + // calls buildFunctionality for c1 and c2 // -> this is already very very slow on my computer // EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); EXPECT_TRUE(true); } -TEST(DDPackageTest, DDMZAPECSliQECRandomCircuitMultiplication) { - // doesn't terminate - auto dd = std::make_unique>(20); - // full equivalence, 10 qubits - qc::QuantumComputation c1{"./circuits/random_1.qasm"}; - qc::QuantumComputation c2{"./circuits/random_2.qasm"}; - // calls buildFunctionality for c1 and c2 -> this takes already 2 minutes on - // my computer - // auto f1 = buildFunctionality(&c1, dd, false, false); - // auto f2 = buildFunctionality(&c2, dd, false, false); - // zeroAncillaPartialEquivalenceCheck calls multiply, - // that is very very slow on my computer - // EXPECT_TRUE(dd->zeroAncillaPartialEquivalenceCheck(f1, f2, 10)); - EXPECT_TRUE(true); -} - -TEST(DDPackageTest, DDMPECSliQECGrover) { +TEST(DDPackageTest, DDMPECSliQECGrover22Qubits) { // doesn't terminate auto dd = std::make_unique>(22); @@ -2353,7 +2397,7 @@ TEST(DDPackageTest, DDMPECSliQECGrover) { EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 11, 11)); } -TEST(DDPackageTest, DDMPECSliQECAdd) { +TEST(DDPackageTest, DDMPECSliQECAdd19Qubits) { // doesn't terminate auto dd = std::make_unique>(20); @@ -2370,7 +2414,7 @@ TEST(DDPackageTest, DDMPECSliQECAdd) { EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 8, 8)); } -TEST(DDPackageTest, DDMPECSliQECPeriodFinding) { +TEST(DDPackageTest, DDMPECSliQECPeriodFinding8Qubits) { auto dd = std::make_unique>(20); // 8 qubits, 3 data qubits qc::QuantumComputation c1{"./circuits/period_finding_1.qasm"}; @@ -2402,77 +2446,3 @@ TEST(DDPackageTest, DDMPECSliQECPeriodFinding) { c1.setLogicalQubitGarbage(4); EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); } - -TEST(DDPackageTest, DDMShiftAllRows3Qubits1) { - const size_t nqubits = 3U; - auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - dd::Qubit m = 2; - dd::Qubit d = 1; - const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); - const auto expectedOutputMatrix = - dd->makeDDFromMatrix(dd::CMat{{1, 2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 2, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 2}, - {1, 2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 2, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 2}}); - EXPECT_EQ(outputMatrix, expectedOutputMatrix); -} - -TEST(DDPackageTest, DDMShiftAllRows3Qubits2) { - const size_t nqubits = 3U; - auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - dd::Qubit m = 1; - dd::Qubit d = 2; - const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); - const auto expectedOutputMatrix = - dd->makeDDFromMatrix(dd::CMat{{1, 2, 3, 4, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 2, 3, 4}, - {1, 2, 3, 4, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 2, 3, 4}, - {1, 2, 3, 4, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 2, 3, 4}, - {1, 2, 3, 4, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 2, 3, 4}}); - - EXPECT_EQ(outputMatrix, expectedOutputMatrix); -} - -TEST(DDPackageTest, DDMShiftAllRows3Qubits3) { - const size_t nqubits = 3U; - auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - dd::Qubit m = 1; - dd::Qubit d = 1; - const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); - auto outputMatrixMatrix = outputMatrix.getMatrix(); - const auto expectedOutputMatrix = - dd->makeDDFromMatrix(dd::CMat{{1, 2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0}, - {1, 2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0}, - {1, 2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0}, - {1, 2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0}}); - EXPECT_EQ(outputMatrix, expectedOutputMatrix); -} From 4d6bc7ef7ce6c07f4b2108faf74b1f4f6a96bb6a Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Sat, 6 Jan 2024 13:28:51 +0100 Subject: [PATCH 25/51] :test_tube: add failing test --- test/dd/test_package.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 44c6e70ac..23e27c0fe 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2274,6 +2274,29 @@ TEST(DDPackageTest, DDMPartialEquivalenceWithDifferentNumberOfQubits) { dd->partialEquivalenceCheck(dd::mEdge::one(), dd::mEdge::one(), 0, 0)); } +TEST(DDPackageTest, + DDMPartialEquivalenceCheckingExamplePaperDifferentQubitOrderAndNumber) { + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + + qc::QuantumComputation c1{4, 1}; + c1.cswap(1, 2, 0); + c1.h(2); + c1.z(0); + c1.cswap(1, 2, 0); + + qc::QuantumComputation c2{3, 1}; + c2.x(1); + c2.ch(1, 2); + + c1.setLogicalQubitGarbage(1); + c1.setLogicalQubitGarbage(0); + + c2.setLogicalQubitGarbage(1); + c2.setLogicalQubitGarbage(0); + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); +} + TEST(DDPackageTest, DDMPartialEquivalenceCheckingComputeTable) { const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); From cf9d721437038637d32aecfd6b6d9ec1485ee41b Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Sat, 6 Jan 2024 13:58:58 +0100 Subject: [PATCH 26/51] :bug: fixed swaps in PEC --- include/dd/Verification.hpp | 15 ++++++++------- test/dd/test_package.cpp | 5 ++++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index 7347956cc..1edc271b5 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -33,17 +33,18 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, } // add swaps in order to put the measured (= not garbage) qubits in the end - auto garbage = c1.getGarbage(); - auto n = static_cast(garbage.size()); - auto nextGarbage = getNextGarbage(0, garbage); + auto garbage1 = c1.getGarbage(); + auto n1 = static_cast(garbage1.size()); + auto n2 = static_cast(c2.getNqubits()); + auto nextGarbage = getNextGarbage(0, garbage1); // find the first garbage qubit at the end - for (Qubit i = n - 1; i >= static_cast(m1); i--) { - if (!garbage.at(i)) { + for (Qubit i = std::min(n1, n2) - 1; i >= static_cast(m1); i--) { + if (!garbage1.at(i)) { // swap it to the beginning c1.swap(i, nextGarbage); c2.swap(i, nextGarbage); ++nextGarbage; - nextGarbage = getNextGarbage(nextGarbage, garbage); + nextGarbage = getNextGarbage(nextGarbage, garbage1); } } @@ -51,7 +52,7 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, auto u1 = buildFunctionality(&c1, dd, false, false); auto u2 = buildFunctionality(&c2, dd, false, false); - if (d1 == n) { + if (d1 == n1 && d2 == n2) { // no ancilla qubits return dd->zeroAncillaPartialEquivalenceCheck(u1, u2, static_cast(m1)); diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 23e27c0fe..f7989da6a 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2276,7 +2276,7 @@ TEST(DDPackageTest, DDMPartialEquivalenceWithDifferentNumberOfQubits) { TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperDifferentQubitOrderAndNumber) { - const auto nqubits = 3U; + const auto nqubits = 4U; auto dd = std::make_unique>(nqubits); qc::QuantumComputation c1{4, 1}; @@ -2291,10 +2291,13 @@ TEST(DDPackageTest, c1.setLogicalQubitGarbage(1); c1.setLogicalQubitGarbage(0); + c1.setLogicalQubitGarbage(3); + c1.setLogicalQubitAncillary(3); c2.setLogicalQubitGarbage(1); c2.setLogicalQubitGarbage(0); EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); + EXPECT_TRUE(dd::partialEquivalenceCheck(c2, c1, dd)); } TEST(DDPackageTest, DDMPartialEquivalenceCheckingComputeTable) { From 9b6f20615f4aea981f2b1e6b5e0b45ff8dcd6c50 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 8 Jan 2024 11:51:22 +0100 Subject: [PATCH 27/51] :construction: first draft of random benchmark generation --- include/dd/Verification.hpp | 2 +- src/dd/Verification.cpp | 193 +++++++++++++++++++++++++++++++----- test/dd/test_package.cpp | 21 ++++ 3 files changed, 191 insertions(+), 25 deletions(-) diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index 77d26454b..98169a121 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -65,5 +65,5 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, } std::pair -generateRandomBenchmark(Qubit n, Qubit d, Qubit m); +generateRandomBenchmark(size_t n, Qubit d, Qubit m); } // namespace dd diff --git a/src/dd/Verification.cpp b/src/dd/Verification.cpp index 7bcdf86ae..d047e7b9e 100644 --- a/src/dd/Verification.cpp +++ b/src/dd/Verification.cpp @@ -9,6 +9,14 @@ namespace dd { +const std::vector> PRE_GENERATED_CIRCUITS_SIZE_1_1{{}}; + +const std::vector> PRE_GENERATED_CIRCUITS_SIZE_1_2{{Z}}; + +const std::vector> PRE_GENERATED_CIRCUITS_SIZE_2_1{{}}; + +const std::vector> PRE_GENERATED_CIRCUITS_SIZE_2_2{{Z}}; + void addDecomposedCxxGate(QuantumComputation& circuit, Qubit control1, Qubit control2, Qubit target) { circuit.h(target); @@ -28,8 +36,93 @@ void addDecomposedCxxGate(QuantumComputation& circuit, Qubit control1, circuit.cx(control2, control1); } +void addRandomGate(QuantumComputation& circuit, size_t n, Qubit d, + Qubit randomControl1, Qubit randomControl2, + Qubit randomTarget, OpType randomStandardOperation, + bool decomposeMcx) { + if (randomStandardOperation == opTypeFromString("mcx")) { + if (d >= 3) { + if (decomposeMcx) { + addDecomposedCxxGate(circuit, randomControl1, randomControl2, + randomTarget); + } else { + const Controls controls{randomControl1, randomControl2}; + StandardOperation op{n, controls, randomTarget, + randomStandardOperation}; + circuit.emplace_back(); + } + } + + } else if (isTwoQubitGate(randomStandardOperation)) { + if (d >= 2) { + circuit.emplace_back(n, randomControl1, randomTarget, + randomStandardOperation); + } + } else { + if (d >= 1) { + circuit.emplace_back(n, randomTarget, + randomStandardOperation); + } + } +} + +void addPreGeneratedCircuits(QuantumComputation& circuit1, + QuantumComputation& circuit2, size_t n, + Qubit groupBeginIndex, Qubit groupSize) { + + const auto& circuits1 = groupSize == 1 ? PRE_GENERATED_CIRCUITS_SIZE_1_1 + : PRE_GENERATED_CIRCUITS_SIZE_2_1; + const auto& circuits2 = groupSize == 1 ? PRE_GENERATED_CIRCUITS_SIZE_1_2 + : PRE_GENERATED_CIRCUITS_SIZE_2_2; + auto nrCircuits = circuits1.size(); + auto randomIndex = static_cast(rand()) % nrCircuits; + auto x1 = circuits1[randomIndex]; + auto x2 = circuits2[randomIndex]; + for (auto gateType : x1) { + if (isTwoQubitGate(gateType)) { + circuit1.emplace_back(n, groupBeginIndex, + groupBeginIndex + 1, gateType); + } + circuit1.emplace_back(n, groupBeginIndex, gateType); + } + for (auto gateType : x2) { + if (isTwoQubitGate(gateType)) { + circuit2.emplace_back(n, groupBeginIndex, + groupBeginIndex + 1, gateType); + } + circuit2.emplace_back(n, groupBeginIndex, gateType); + } +} + +std::tuple threeDiffferentRandomNumbers(Qubit min, + Qubit max) { + auto range = max - min; + auto randomTarget = static_cast(rand() % range) + min; + Qubit randomControl1{0}; + Qubit randomControl2{0}; + if (range > 1) { + randomControl1 = static_cast(rand() % (range - 1)) + min; + if (randomControl1 == randomTarget) { + randomControl1 = static_cast(max + min - 1); + } + if (range > 2) { + randomControl2 = static_cast(rand() % (range - 2)) + min; + if (randomControl2 == randomTarget) { + randomControl2 = static_cast(max + min - 1); + } + if (randomControl2 == randomControl1) { + randomControl2 = static_cast(max + min - 2); + if (randomControl2 == randomTarget) { + randomControl2 = static_cast(max + min - 1); + } + } + } + } + return std::make_tuple(randomTarget, randomControl1, randomControl2); +} + std::pair -generateRandomBenchmark(Qubit n, Qubit d, Qubit m) { +generateRandomBenchmark(size_t n, Qubit d, Qubit m) { if (d > n) { throw std::runtime_error("The number of data or measured qubits can't be " "bigger than the total number of qubits. n = " + @@ -38,39 +131,91 @@ generateRandomBenchmark(Qubit n, Qubit d, Qubit m) { } qc::QuantumComputation circuit1{n}; qc::QuantumComputation circuit2{n}; - // H gates + // 1) H gates for (Qubit i = 0U; i < d; i++) { circuit1.h(i); circuit2.h(i); } - // Totally equivalent subcircuits - // generate a random subcircuit with d qubits and 3d gates to apply on both - // circuits, but all the Toffoli gates in C2 are decomposed + + circuit1.barrier(0); + circuit1.barrier(1); + circuit1.barrier(2); + circuit2.barrier(0); + circuit2.barrier(1); + circuit2.barrier(2); + + // 2) Totally equivalent subcircuits + // generate a random subcircuit with d qubits and 3d gates to apply on both + // circuits, but all the Toffoli gates in C2 are decomposed for (Qubit i = 0U; i < 3 * d; i++) { - auto randomTarget = static_cast(rand() % d); - auto randomControl1 = static_cast(rand() % (d - 1)); - if (randomControl1 == randomTarget) { - randomControl1 = d - 1; - } - auto randomControl2 = static_cast(rand() % (d - 2)); - if (randomControl2 == randomTarget) { - randomControl2 = d - 1; + auto [randomTarget, randomControl1, randomControl2] = + threeDiffferentRandomNumbers(0, d); + auto randomStandardOperation = static_cast(rand() % Compound); + addRandomGate(circuit1, n, d, randomControl1, randomControl2, randomTarget, + randomStandardOperation, false); + addRandomGate(circuit2, n, d, randomControl1, randomControl2, randomTarget, + randomStandardOperation, true); + } + circuit1.barrier(0); + circuit1.barrier(1); + circuit1.barrier(2); + circuit2.barrier(0); + circuit2.barrier(1); + circuit2.barrier(2); + // 3) Partially equivalent subcircuits + + // divide data qubits into groups of size 1 or 2 + Qubit groupBeginIndex = 0; + while (groupBeginIndex < d) { + Qubit groupSize = 1; + if (groupBeginIndex < d - 1) { + groupSize = static_cast(rand() % 2) + 1; } - if (randomControl2 == randomControl1) { - randomControl2 = d - 2; + + addPreGeneratedCircuits(circuit1, circuit2, n, groupBeginIndex, groupSize); + + groupBeginIndex += groupSize; + } + circuit1.barrier(0); + circuit1.barrier(1); + circuit1.barrier(2); + circuit2.barrier(0); + circuit2.barrier(1); + circuit2.barrier(2); + // 4) Arbitrary gates + // arbitrary gates are added to not measured qubits + if (d > m) { + for (Qubit i = 0U; i < d - m; i++) { + auto [randomTarget, randomControl1, randomControl2] = + threeDiffferentRandomNumbers(m, d); + auto randomStandardOperation = static_cast(rand() % Compound); + addRandomGate(circuit1, n, d - m, randomControl1, randomControl2, + randomTarget, randomStandardOperation, false); } - auto randomStandardOperation = static_cast(rand() % Compound); - circuit1.emplace_back(n, randomTarget, - randomStandardOperation); - if (randomStandardOperation == opTypeFromString("mcx")) { - addDecomposedCxxGate(circuit2, randomControl1, randomControl2, - randomTarget); - } else { - circuit2.emplace_back(n, randomTarget, - randomStandardOperation); + for (Qubit i = 0U; i < d - m; i++) { + auto [randomTarget, randomControl1, randomControl2] = + threeDiffferentRandomNumbers(m, d); + auto randomStandardOperation = static_cast(rand() % Compound); + addRandomGate(circuit2, n, d - m, randomControl1, randomControl2, + randomTarget, randomStandardOperation, false); } } + circuit1.barrier(0); + circuit1.barrier(1); + circuit1.barrier(2); + circuit2.barrier(0); + circuit2.barrier(1); + circuit2.barrier(2); + // 5) CNOT gates (if there are ancilla qubits) + Qubit currentDataQubit = 0; + for (Qubit currentAncillaQubit = d; + currentAncillaQubit < static_cast(n); currentAncillaQubit++) { + auto nextDataQubit = static_cast((currentDataQubit + 1) % d); + circuit1.cx(currentAncillaQubit, currentDataQubit); + circuit2.cx(currentAncillaQubit, nextDataQubit); + currentDataQubit = nextDataQubit; + } return std::make_pair(circuit1, circuit2); } diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 76ac2a168..574504580 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2433,3 +2433,24 @@ TEST(DDPackageTest, DDMPECSliQECPeriodFinding) { c1.setLogicalQubitGarbage(4); EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); } + +TEST(DDPackageTest, DDMPECBenchmark) { + auto dd = std::make_unique>(7); + + auto [c1, c2] = dd::generateRandomBenchmark(5, 3, 1); + + std::cout << "circuit 1: \n"; + c1.print(std::cout); + std::cout << "circuit 2: \n"; + c2.print(std::cout); + + c1.setLogicalQubitAncillary(3); + c1.setLogicalQubitAncillary(4); + + c2.setLogicalQubitGarbage(1); + c2.setLogicalQubitGarbage(2); + c2.setLogicalQubitGarbage(3); + c2.setLogicalQubitGarbage(4); + + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); +} From 90881926c42d2c00ff16f8a0eb975fd9e1c0deea Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 8 Jan 2024 12:23:52 +0100 Subject: [PATCH 28/51] :art: more consistency with naming of ancilla/ancillae/ancillary qubits --- include/dd/FunctionalityConstruction.hpp | 4 ++-- include/dd/Package.hpp | 24 ++++++++++++------------ include/dd/Verification.hpp | 4 ++-- src/dd/FunctionalityConstruction.cpp | 12 ++++++------ test/dd/test_package.cpp | 24 ++++++++++++------------ 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/include/dd/FunctionalityConstruction.hpp b/include/dd/FunctionalityConstruction.hpp index f7929fe0e..e88d235f4 100644 --- a/include/dd/FunctionalityConstruction.hpp +++ b/include/dd/FunctionalityConstruction.hpp @@ -9,13 +9,13 @@ using namespace qc; template MatrixDD buildFunctionality(const QuantumComputation* qc, Package& dd, - bool reduceAncillaeQubits = true, + bool reduceAncillaryQubits = true, bool reduceGarbageQubits = true); template MatrixDD buildFunctionalityRecursive(const QuantumComputation* qc, Package& dd, - bool reduceAncillaeQubits = true, + bool reduceAncillaryQubits = true, bool reduceGarbageQubits = true); template diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index ca4503bdc..1874edf91 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2706,9 +2706,9 @@ template class Package { return multiply(conjugateTranspose(u), u2); } - ComputeTable zeroAncillaPECComputeTable{}; + ComputeTable zeroAncillaePECComputeTable{}; - bool zeroAncillaPartialEquivalenceCheckSubroutine(mEdge e, Qubit m) { + bool zeroAncillaePartialEquivalenceCheckSubroutine(mEdge e, Qubit m) { if (e.isTerminal()) { return true; } @@ -2716,7 +2716,7 @@ template class Package { const mEdge eCopy{e.p, Complex::one()}; // check if it's in the compute table with an edge weight of one - if (const auto* r = zeroAncillaPECComputeTable.lookup(eCopy, m); + if (const auto* r = zeroAncillaePECComputeTable.lookup(eCopy, m); r != nullptr) { auto f = *r; return f; @@ -2724,17 +2724,17 @@ template class Package { bool result = false; if (m >= n) { result = e.p->e[1].isZeroTerminal() && e.p->e[2].isZeroTerminal() && - zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[0], m) && - zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[3], m); + zeroAncillaePartialEquivalenceCheckSubroutine(e.p->e[0], m) && + zeroAncillaePartialEquivalenceCheckSubroutine(e.p->e[3], m); } else { - result = zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[0], m) && - zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[1], m) && - zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[2], m) && - zeroAncillaPartialEquivalenceCheckSubroutine(e.p->e[3], m); + result = zeroAncillaePartialEquivalenceCheckSubroutine(e.p->e[0], m) && + zeroAncillaePartialEquivalenceCheckSubroutine(e.p->e[1], m) && + zeroAncillaePartialEquivalenceCheckSubroutine(e.p->e[2], m) && + zeroAncillaePartialEquivalenceCheckSubroutine(e.p->e[3], m); } // add to the compute table with a weight of 1 - zeroAncillaPECComputeTable.insert(eCopy, m, result); + zeroAncillaePECComputeTable.insert(eCopy, m, result); return result; } @@ -2797,9 +2797,9 @@ template class Package { @param m Number of measured qubits @return true if the two circuits u1 and u2 are partially equivalent. **/ - bool zeroAncillaPartialEquivalenceCheck(mEdge u1, mEdge u2, Qubit m) { + bool zeroAncillaePartialEquivalenceCheck(mEdge u1, mEdge u2, Qubit m) { auto u1u2 = multiply(u1, conjugateTranspose(u2)); - return zeroAncillaPartialEquivalenceCheckSubroutine(u1u2, m); + return zeroAncillaePartialEquivalenceCheckSubroutine(u1u2, m); } }; diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index 2de47b68f..70a8ce622 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -54,8 +54,8 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, auto u2 = buildFunctionality(&c2, *dd, false, false); if (d1 == n1 && d2 == n2) { // no ancilla qubits - return dd->zeroAncillaPartialEquivalenceCheck(u1, u2, - static_cast(m1)); + return dd->zeroAncillaePartialEquivalenceCheck(u1, u2, + static_cast(m1)); } return dd->partialEquivalenceCheck(u1, u2, static_cast(d1), static_cast(m1)); diff --git a/src/dd/FunctionalityConstruction.cpp b/src/dd/FunctionalityConstruction.cpp index 37065776d..4eb9d3c89 100644 --- a/src/dd/FunctionalityConstruction.cpp +++ b/src/dd/FunctionalityConstruction.cpp @@ -3,7 +3,7 @@ namespace dd { template MatrixDD buildFunctionality(const QuantumComputation* qc, Package& dd, - bool reduceAncillaeQubits, + bool reduceAncillaryQubits, bool reduceGarbageQubits) { const auto nq = qc->getNqubits(); if (nq == 0U) { @@ -28,7 +28,7 @@ MatrixDD buildFunctionality(const QuantumComputation* qc, Package& dd, } // correct permutation if necessary changePermutation(e, permutation, qc->outputPermutation, dd); - if (reduceAncillaeQubits) { + if (reduceAncillaryQubits) { e = dd.reduceAncillae(e, qc->ancillary); } if (reduceGarbageQubits) { @@ -41,7 +41,7 @@ MatrixDD buildFunctionality(const QuantumComputation* qc, Package& dd, template MatrixDD buildFunctionalityRecursive(const QuantumComputation* qc, Package& dd, - bool reduceAncillaeQubits, + bool reduceAncillaryQubits, bool reduceGarbageQubits) { if (qc->getNqubits() == 0U) { return MatrixDD::one(); @@ -68,7 +68,7 @@ MatrixDD buildFunctionalityRecursive(const QuantumComputation* qc, // correct permutation if necessary changePermutation(e, permutation, qc->outputPermutation, dd); - if (reduceAncillaeQubits) { + if (reduceAncillaryQubits) { e = dd.reduceAncillae(e, qc->ancillary); } if (reduceGarbageQubits) { @@ -212,11 +212,11 @@ MatrixDD buildFunctionalityRecursive(const qc::Grover* qc, template MatrixDD buildFunctionality(const qc::QuantumComputation* qc, Package& dd, - bool reduceAncillaeQubits, + bool reduceAncillaryQubits, bool reduceGarbageQubits); template MatrixDD buildFunctionalityRecursive(const qc::QuantumComputation* qc, Package& dd, - bool reduceAncillaeQubits, + bool reduceAncillaryQubits, bool reduceGarbageQubits); template bool buildFunctionalityRecursive(const qc::QuantumComputation* qc, const std::size_t depth, diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index a78ce8d85..c552eb31b 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2187,7 +2187,7 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingTestNotEquivalent) { auto circuit1 = dd->multiply(xGate, hGate); auto circuit2 = dd->makeIdent(2); EXPECT_FALSE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); - EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(circuit1, circuit2, 1)); + EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(circuit1, circuit2, 1)); } TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { @@ -2207,7 +2207,7 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); } -TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncilla) { +TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncillae) { const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); auto controlledSwapGate = dd->makeSWAPDD(nqubits, qc::Controls{1}, 0, 2); @@ -2221,8 +2221,8 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncilla) { dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); auto c2 = dd->multiply(controlledHGate, xGate); - EXPECT_TRUE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 1)); - EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 2)); + EXPECT_TRUE(dd->zeroAncillaePartialEquivalenceCheck(c1, c2, 1)); + EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(c1, c2, 2)); auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 2); auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 0); @@ -2234,7 +2234,7 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncilla) { dd->multiply(hGate2, dd->multiply(zGate2, controlledSwapGate))); auto c4 = dd->multiply(controlledHGate2, xGate); - EXPECT_FALSE(dd->zeroAncillaPartialEquivalenceCheck(c3, c4, 1)); + EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(c3, c4, 1)); } TEST(DDPackageTest, @@ -2273,7 +2273,7 @@ TEST(DDPackageTest, DDMPartialEquivalenceWithDifferentNumberOfQubits) { dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); auto c2 = dd->multiply(controlledHGate, xGate); - // EXPECT_TRUE(dd->zeroAncillaPartialEquivalenceCheck(c1, c2, 1)); + // EXPECT_TRUE(dd->zeroAncillaePartialEquivalenceCheck(c1, c2, 1)); EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); EXPECT_FALSE(dd->partialEquivalenceCheck(c2, c1, 3, 3)); EXPECT_FALSE(dd->partialEquivalenceCheck(c2, dd::mEdge::zero(), 2, 1)); @@ -2374,7 +2374,7 @@ TEST(DDPackageTest, DDMZAPECMQTBenchQPE30Qubits) { // auto f2 = buildFunctionality(&c2, *dd, false, false); // 29 measured qubits and 30 data qubits - // calls zeroAncillaPartialEquivalenceCheck + // calls zeroAncillaePartialEquivalenceCheck // EXPECT_TRUE(dd->partialEquivalenceCheck(f1, f2, 30, 29)); EXPECT_TRUE(true); @@ -2387,21 +2387,21 @@ TEST(DDPackageTest, DDMZAPECSliQEC19Qubits) { qc::QuantumComputation c1{"./circuits/entanglement_1.qasm"}; qc::QuantumComputation c2{"./circuits/entanglement_2.qasm"}; - // calls zeroAncillaPartialEquivalenceCheck + // calls zeroAncillaePartialEquivalenceCheck EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); // full equivalence, 19 qubits qc::QuantumComputation c3{"./circuits/add6_196_1.qasm"}; qc::QuantumComputation c4{"./circuits/add6_196_2.qasm"}; - // calls zeroAncillaPartialEquivalenceCheck + // calls zeroAncillaePartialEquivalenceCheck EXPECT_TRUE(dd::partialEquivalenceCheck(c3, c4, dd)); // full equivalence, 10 qubits qc::QuantumComputation c5{"./circuits/bv_1.qasm"}; qc::QuantumComputation c6{"./circuits/bv_2.qasm"}; - // calls zeroAncillaPartialEquivalenceCheck + // calls zeroAncillaePartialEquivalenceCheck EXPECT_TRUE(dd::partialEquivalenceCheck(c5, c6, dd)); } @@ -2440,7 +2440,7 @@ TEST(DDPackageTest, DDMPECSliQECAdd19Qubits) { // full equivalence, 19 qubits // but this test uses algorithm for partial equivalence, not the "zero - // ancilla" version + // ancillae" version qc::QuantumComputation c1{"./circuits/add6_196_1.qasm"}; qc::QuantumComputation c2{"./circuits/add6_196_2.qasm"}; @@ -2484,7 +2484,7 @@ TEST(DDPackageTest, DDMPECSliQECPeriodFinding8Qubits) { EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); } -TEST(DDPackageTest, ReduceAncillaRegression) { +TEST(DDPackageTest, ReduceAncillaeRegression) { auto dd = std::make_unique>(2); const auto inputMatrix = dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; From b1b70f3dec72738032b53da5b3e4e779d53d177d Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 8 Jan 2024 12:27:34 +0100 Subject: [PATCH 29/51] :rotating_light: fix linter warnings --- include/dd/Package.hpp | 4 ++-- include/dd/Verification.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 1874edf91..32f41c8b4 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2627,7 +2627,7 @@ template class Package { // if the current submatrix size is less than 2^m, // then the offset of the lower half needs to be adapted - bool adaptOffsetOfLowerMatrixHalf = n <= m; + const bool adaptOffsetOfLowerMatrixHalf = n <= m; edges[0] = shiftAllRowsRecursive(e.p->e[0], m, d, upperOffset); if (n <= d) { // CASE 1: this (sub)matrix has size < 2^d @@ -2639,7 +2639,7 @@ template class Package { edges[2] = shiftAllRowsRecursive(e.p->e[2], m, d, upperOffset); edges[3] = shiftAllRowsRecursive(e.p->e[3], m, d, upperOffset); } else { - std::int64_t addedOffset{1 << (n - 1 - d)}; + const std::int64_t addedOffset{1 << (n - 1 - d)}; if (upperOffset + addedOffset < (1 << m)) { // CASE 2: this submatrix doesn't contain ancilla qubits // -> we don't need to set any columns to zero diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index 70a8ce622..cca12c149 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -5,7 +5,7 @@ namespace dd { // get next garbage qubit after n inline Qubit getNextGarbage(Qubit n, const std::vector& garbage) { - while (n < garbage.size() && !garbage.at(n)) { + while (n < static_cast(garbage.size()) && !garbage.at(n)) { n++; } return n; From 29e2bf6a6863d2eb601751f5c2c2b293ed866481 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 8 Jan 2024 12:37:08 +0100 Subject: [PATCH 30/51] :fire: remove exception that was only there for debugging purposes --- include/dd/Package.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 32f41c8b4..891665e9e 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2600,9 +2600,6 @@ template class Package { // the matrix of the current DD has dimensions 2^n x 2^n const auto n = e.p->v + 1; - if (upperOffset < 0 && m < n) { - throw std::runtime_error("offset less than 0."); - } if (upperOffset >= (1 << n) || upperOffset < 0) { return mEdge::zero(); } From ca5ca9dc8f63cc263bde775349cb8a2d90cdcdaf Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 8 Jan 2024 12:52:54 +0100 Subject: [PATCH 31/51] :rotating_light: make some variables const --- test/dd/test_package.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index c552eb31b..3125c6371 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2058,8 +2058,8 @@ TEST(DDPackageTest, DDMShiftAllRows3QubitsPart1) { {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - dd::Qubit m = 2; - dd::Qubit d = 1; + const dd::Qubit m = 2; + const dd::Qubit d = 1; const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); const auto expectedOutputMatrix = dd->makeDDFromMatrix(dd::CMat{{1, 2, 0, 0, 0, 0, 0, 0}, @@ -2082,8 +2082,8 @@ TEST(DDPackageTest, DDMShiftAllRows3QubitsPart2) { {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - dd::Qubit m = 1; - dd::Qubit d = 2; + const dd::Qubit m = 1; + const dd::Qubit d = 2; const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); const auto expectedOutputMatrix = dd->makeDDFromMatrix(dd::CMat{{1, 2, 3, 4, 0, 0, 0, 0}, @@ -2107,8 +2107,8 @@ TEST(DDPackageTest, DDMShiftAllRows3QubitsPart3) { {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); - dd::Qubit m = 1; - dd::Qubit d = 1; + const dd::Qubit m = 1; + const dd::Qubit d = 1; const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); auto outputMatrixMatrix = outputMatrix.getMatrix(); const auto expectedOutputMatrix = @@ -2384,22 +2384,22 @@ TEST(DDPackageTest, DDMZAPECSliQEC19Qubits) { auto dd = std::make_unique>(20); // full equivalence, 10 qubits - qc::QuantumComputation c1{"./circuits/entanglement_1.qasm"}; - qc::QuantumComputation c2{"./circuits/entanglement_2.qasm"}; + const qc::QuantumComputation c1{"./circuits/entanglement_1.qasm"}; + const qc::QuantumComputation c2{"./circuits/entanglement_2.qasm"}; // calls zeroAncillaePartialEquivalenceCheck EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); // full equivalence, 19 qubits - qc::QuantumComputation c3{"./circuits/add6_196_1.qasm"}; - qc::QuantumComputation c4{"./circuits/add6_196_2.qasm"}; + const qc::QuantumComputation c3{"./circuits/add6_196_1.qasm"}; + const qc::QuantumComputation c4{"./circuits/add6_196_2.qasm"}; // calls zeroAncillaePartialEquivalenceCheck EXPECT_TRUE(dd::partialEquivalenceCheck(c3, c4, dd)); // full equivalence, 10 qubits - qc::QuantumComputation c5{"./circuits/bv_1.qasm"}; - qc::QuantumComputation c6{"./circuits/bv_2.qasm"}; + const qc::QuantumComputation c5{"./circuits/bv_1.qasm"}; + const qc::QuantumComputation c6{"./circuits/bv_2.qasm"}; // calls zeroAncillaePartialEquivalenceCheck EXPECT_TRUE(dd::partialEquivalenceCheck(c5, c6, dd)); @@ -2409,8 +2409,8 @@ TEST(DDPackageTest, DDMZAPECSliQECRandomCircuit) { // doesn't terminate auto dd = std::make_unique>(20); // full equivalence, 10 qubits - qc::QuantumComputation c1{"./circuits/random_1.qasm"}; - qc::QuantumComputation c2{"./circuits/random_2.qasm"}; + const qc::QuantumComputation c1{"./circuits/random_1.qasm"}; + const qc::QuantumComputation c2{"./circuits/random_2.qasm"}; // calls buildFunctionality for c1 and c2 // -> this is already very very slow on my computer @@ -2422,9 +2422,9 @@ TEST(DDPackageTest, DDMPECSliQECGrover22Qubits) { // doesn't terminate auto dd = std::make_unique>(22); - qc::QuantumComputation c1{ + const qc::QuantumComputation c1{ "./circuits/Grover_1.qasm"}; // 11 qubits, 11 data qubits - qc::QuantumComputation c2{ + const qc::QuantumComputation c2{ "./circuits/Grover_2.qasm"}; // 12 qubits, 11 data qubits // 11 measured qubits and 11 data qubits @@ -2441,8 +2441,8 @@ TEST(DDPackageTest, DDMPECSliQECAdd19Qubits) { // full equivalence, 19 qubits // but this test uses algorithm for partial equivalence, not the "zero // ancillae" version - qc::QuantumComputation c1{"./circuits/add6_196_1.qasm"}; - qc::QuantumComputation c2{"./circuits/add6_196_2.qasm"}; + const qc::QuantumComputation c1{"./circuits/add6_196_1.qasm"}; + const qc::QuantumComputation c2{"./circuits/add6_196_2.qasm"}; // just for benchmarking reasons, we only measure 8 qubits auto c1Dd = buildFunctionality(&c1, *dd, false, false); From 24fa752f81d4fdfb62c5eff4730458de44b7d12d Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Sat, 13 Jan 2024 12:57:59 +0100 Subject: [PATCH 32/51] :bug: fixed bug in partialEquivalenceCheck for m=0 --- include/dd/Verification.hpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index 4bd139aa2..043ca9c67 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -38,11 +38,12 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, auto n2 = static_cast(c2.getNqubits()); auto nextGarbage = getNextGarbage(0, garbage1); // find the first garbage qubit at the end - for (Qubit i = std::min(n1, n2) - 1; i >= static_cast(m1); i--) { - if (!garbage1.at(i)) { + for (std::int64_t i = std::min(n1, n2) - 1; + i >= static_cast(m1); i--) { + if (!garbage1.at(static_cast(i))) { // swap it to the beginning - c1.swap(i, nextGarbage); - c2.swap(i, nextGarbage); + c1.swap(static_cast(i), nextGarbage); + c2.swap(static_cast(i), nextGarbage); ++nextGarbage; nextGarbage = getNextGarbage(nextGarbage, garbage1); } @@ -52,6 +53,15 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, auto u1 = buildFunctionality(&c1, *dd, false, false); auto u2 = buildFunctionality(&c2, *dd, false, false); + + // std::cout << "u1: \n"; + // u1.printMatrix(); + // std::cout << std::endl; + + // std::cout << "u2: \n"; + // u2.printMatrix(); + // std::cout << std::endl; + if (d1 == n1 && d2 == n2) { // no ancilla qubits return dd->zeroAncillaePartialEquivalenceCheck(u1, u2, From 8ce1564237ee1786279dbbbd846b2ccbfcafcf63 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Sat, 13 Jan 2024 12:59:32 +0100 Subject: [PATCH 33/51] :construction: almost finished implementation of random circuit generation for PEC --- src/dd/Verification.cpp | 276 ++++++++++++++++++++++++--------------- test/dd/test_package.cpp | 102 +++++++++++---- 2 files changed, 250 insertions(+), 128 deletions(-) diff --git a/src/dd/Verification.cpp b/src/dd/Verification.cpp index d047e7b9e..20c359c35 100644 --- a/src/dd/Verification.cpp +++ b/src/dd/Verification.cpp @@ -4,9 +4,6 @@ #include "operations/OpType.hpp" #include "operations/StandardOperation.hpp" -#include -#include - namespace dd { const std::vector> PRE_GENERATED_CIRCUITS_SIZE_1_1{{}}; @@ -25,45 +22,155 @@ void addDecomposedCxxGate(QuantumComputation& circuit, Qubit control1, circuit.cx(control2, target); circuit.t(target); circuit.cx(control1, target); - circuit.t(control1); circuit.tdg(target); circuit.cx(control2, target); - circuit.cx(control2, control1); circuit.t(target); + circuit.t(control1); + circuit.h(target); + circuit.cx(control2, control1); circuit.t(control2); circuit.tdg(control1); - circuit.h(target); circuit.cx(control2, control1); } -void addRandomGate(QuantumComputation& circuit, size_t n, Qubit d, - Qubit randomControl1, Qubit randomControl2, - Qubit randomTarget, OpType randomStandardOperation, - bool decomposeMcx) { - if (randomStandardOperation == opTypeFromString("mcx")) { - if (d >= 3) { - if (decomposeMcx) { - addDecomposedCxxGate(circuit, randomControl1, randomControl2, - randomTarget); - } else { - const Controls controls{randomControl1, randomControl2}; - StandardOperation op{n, controls, randomTarget, - randomStandardOperation}; - circuit.emplace_back(); - } +void addRandomStandardOperation(QuantumComputation& circuit, + StandardOperation op, bool decomposeMcx) { + std::vector controls{}; + for (auto c : op.getControls()) { // they are at most 2 + controls.push_back(static_cast(c.qubit)); + } + std::vector targets{}; + for (auto t : op.getTargets()) { // they are at most 2 + targets.push_back(static_cast(t)); + } + + if (op.getType() == qc::X && controls.size() == 2) { + + if (decomposeMcx) { + addDecomposedCxxGate(circuit, controls[0], controls[1], targets[0]); + return; } + } + + circuit.emplace_back(op); +} + +std::vector fiveDiffferentRandomNumbers(Qubit min, Qubit max) { + std::vector numbers; + + for (Qubit i = min; i < max; i++) { + numbers.push_back(i); + } + unsigned seed = static_cast( + std::chrono::system_clock::now().time_since_epoch().count()); + std::shuffle(numbers.begin(), numbers.end(), + std::default_random_engine(seed)); + + auto lengthOutputVector = std::min(5UL, numbers.size()); + std::vector outputVector(numbers.begin(), + numbers.begin() + + static_cast(lengthOutputVector)); + return outputVector; +} - } else if (isTwoQubitGate(randomStandardOperation)) { - if (d >= 2) { - circuit.emplace_back(n, randomControl1, randomTarget, - randomStandardOperation); +StandardOperation makeRandomStandardOperation(size_t n, Qubit nrQubits, + Qubit min) { + auto randomNumbers = fiveDiffferentRandomNumbers(min, min + nrQubits); + auto randomOpType = static_cast(rand() % Compound); + Qubit randomTarget1 = randomNumbers[0]; + Qubit randomTarget2{min}; + if (randomNumbers.size() > 1) { + randomTarget2 = randomNumbers[1]; + }; + size_t nrControls = + std::min(randomNumbers.size() - 3, static_cast(rand() % 3)); + if (randomNumbers.size() < 3) { + nrControls = 0; + } + if (nrControls == 2) { + // otherwise Cnots are almost never generated + randomOpType = qc::X; + } + Controls randomControls{}; + for (size_t i = 0; i < nrControls; i++) { + randomControls.emplace(randomNumbers[i + 2]); + } + const fp randomParameter1 = + static_cast(rand()) / static_cast(RAND_MAX); + const fp randomParameter2 = + static_cast(rand()) / static_cast(RAND_MAX); + const fp randomParameter3 = + static_cast(rand()) / static_cast(RAND_MAX); + switch (randomOpType) { + // two targets and zero parameters + case qc::SWAP: + case qc::iSWAP: + case qc::iSWAPdg: + case qc::Peres: + case qc::Peresdg: + case qc::DCX: + case qc::ECR: + if (randomNumbers.size() > 1) { + return {n, randomControls, Targets{randomTarget1, randomTarget2}, + randomOpType}; + } + break; + // two targets and one parameter + case qc::RXX: + case qc::RYY: + case qc::RZZ: + case qc::RZX: + if (randomNumbers.size() > 1) { + return {n, randomControls, Targets{randomTarget1, randomTarget2}, + randomOpType, std::vector{randomParameter1}}; } - } else { - if (d >= 1) { - circuit.emplace_back(n, randomTarget, - randomStandardOperation); + break; + + // two targets and two parameters + case qc::XXminusYY: + case qc::XXplusYY: + if (randomNumbers.size() > 1) { + return {n, randomControls, Targets{randomTarget1, randomTarget2}, + randomOpType, + std::vector{randomParameter1, randomParameter2}}; } + break; + + // one target and zero parameters + case qc::I: + case qc::H: + case qc::X: + case qc::Y: + case qc::Z: + case qc::S: + case qc::Sdg: + case qc::T: + case qc::Tdg: + case qc::V: + case qc::Vdg: + case qc::SX: + case qc::SXdg: + return {n, randomControls, randomTarget1, randomOpType}; + // one target and three parameters + case qc::U: + return { + n, randomControls, randomTarget1, randomOpType, + std::vector{randomParameter1, randomParameter2, randomParameter3}}; + // one target and two parameters + case qc::U2: + return {n, randomControls, randomTarget1, randomOpType, + std::vector{randomParameter1, randomParameter2}}; + // one target and one parameter + case qc::P: + case qc::RX: + case qc::RY: + case qc::RZ: + return {n, randomControls, randomTarget1, randomOpType, + std::vector{randomParameter1}}; + default: + return {n, randomTarget1, qc::I}; } + return {n, randomTarget1, qc::I}; } void addPreGeneratedCircuits(QuantumComputation& circuit1, @@ -94,33 +201,6 @@ void addPreGeneratedCircuits(QuantumComputation& circuit1, } } -std::tuple threeDiffferentRandomNumbers(Qubit min, - Qubit max) { - auto range = max - min; - auto randomTarget = static_cast(rand() % range) + min; - Qubit randomControl1{0}; - Qubit randomControl2{0}; - if (range > 1) { - randomControl1 = static_cast(rand() % (range - 1)) + min; - if (randomControl1 == randomTarget) { - randomControl1 = static_cast(max + min - 1); - } - if (range > 2) { - randomControl2 = static_cast(rand() % (range - 2)) + min; - if (randomControl2 == randomTarget) { - randomControl2 = static_cast(max + min - 1); - } - if (randomControl2 == randomControl1) { - randomControl2 = static_cast(max + min - 2); - if (randomControl2 == randomTarget) { - randomControl2 = static_cast(max + min - 1); - } - } - } - } - return std::make_tuple(randomTarget, randomControl1, randomControl2); -} - std::pair generateRandomBenchmark(size_t n, Qubit d, Qubit m) { if (d > n) { @@ -136,33 +216,23 @@ generateRandomBenchmark(size_t n, Qubit d, Qubit m) { circuit1.h(i); circuit2.h(i); } - - circuit1.barrier(0); - circuit1.barrier(1); - circuit1.barrier(2); - circuit2.barrier(0); - circuit2.barrier(1); - circuit2.barrier(2); - + for (Qubit i = 0U; i < static_cast(n); i++) { + circuit1.barrier(i); + circuit2.barrier(i); + } // 2) Totally equivalent subcircuits - // generate a random subcircuit with d qubits and 3d gates to apply on both - // circuits, but all the Toffoli gates in C2 are decomposed + // generate a random subcircuit with d qubits and 3d gates to apply + // on both circuits, but all the Toffoli gates in C2 are decomposed for (Qubit i = 0U; i < 3 * d; i++) { - auto [randomTarget, randomControl1, randomControl2] = - threeDiffferentRandomNumbers(0, d); - auto randomStandardOperation = static_cast(rand() % Compound); - addRandomGate(circuit1, n, d, randomControl1, randomControl2, randomTarget, - randomStandardOperation, false); - addRandomGate(circuit2, n, d, randomControl1, randomControl2, randomTarget, - randomStandardOperation, true); - } - circuit1.barrier(0); - circuit1.barrier(1); - circuit1.barrier(2); - circuit2.barrier(0); - circuit2.barrier(1); - circuit2.barrier(2); + auto op = makeRandomStandardOperation(n, d, 0); + addRandomStandardOperation(circuit1, op, false); + addRandomStandardOperation(circuit2, op, true); + } + for (Qubit i = 0U; i < static_cast(n); i++) { + circuit1.barrier(i); + circuit2.barrier(i); + } // 3) Partially equivalent subcircuits // divide data qubits into groups of size 1 or 2 @@ -177,36 +247,27 @@ generateRandomBenchmark(size_t n, Qubit d, Qubit m) { groupBeginIndex += groupSize; } - circuit1.barrier(0); - circuit1.barrier(1); - circuit1.barrier(2); - circuit2.barrier(0); - circuit2.barrier(1); - circuit2.barrier(2); + for (Qubit i = 0U; i < static_cast(n); i++) { + circuit1.barrier(i); + circuit2.barrier(i); + } // 4) Arbitrary gates // arbitrary gates are added to not measured qubits if (d > m) { - for (Qubit i = 0U; i < d - m; i++) { - auto [randomTarget, randomControl1, randomControl2] = - threeDiffferentRandomNumbers(m, d); - auto randomStandardOperation = static_cast(rand() % Compound); - addRandomGate(circuit1, n, d - m, randomControl1, randomControl2, - randomTarget, randomStandardOperation, false); + Qubit notMQubits = d - m; + for (Qubit i = 0U; i < notMQubits; i++) { + auto op = makeRandomStandardOperation(n, notMQubits, m); + addRandomStandardOperation(circuit1, op, false); } for (Qubit i = 0U; i < d - m; i++) { - auto [randomTarget, randomControl1, randomControl2] = - threeDiffferentRandomNumbers(m, d); - auto randomStandardOperation = static_cast(rand() % Compound); - addRandomGate(circuit2, n, d - m, randomControl1, randomControl2, - randomTarget, randomStandardOperation, false); + auto op = makeRandomStandardOperation(n, notMQubits, m); + addRandomStandardOperation(circuit2, op, false); } } - circuit1.barrier(0); - circuit1.barrier(1); - circuit1.barrier(2); - circuit2.barrier(0); - circuit2.barrier(1); - circuit2.barrier(2); + for (Qubit i = 0U; i < static_cast(n); i++) { + circuit1.barrier(i); + circuit2.barrier(i); + } // 5) CNOT gates (if there are ancilla qubits) Qubit currentDataQubit = 0; for (Qubit currentAncillaQubit = d; @@ -217,6 +278,15 @@ generateRandomBenchmark(size_t n, Qubit d, Qubit m) { currentDataQubit = nextDataQubit; } + for (Qubit i = d; i < static_cast(n); i++) { + circuit1.setLogicalQubitAncillary(i); + circuit2.setLogicalQubitAncillary(i); + } + for (Qubit i = m; i < static_cast(n); i++) { + circuit1.setLogicalQubitGarbage(i); + circuit2.setLogicalQubitGarbage(i); + } + return std::make_pair(circuit1, circuit2); } } // namespace dd diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 4d64a8931..d524030f7 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -1984,6 +1984,21 @@ TEST(DDPackageTest, DDStatistics) { EXPECT_GT(uniqueTableStats["total"]["num_buckets"], 0); } +TEST(DDPackageTest, ReduceAncillaeRegression) { + auto dd = std::make_unique>(2); + const auto inputMatrix = + dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; + auto inputDD = dd->makeDDFromMatrix(inputMatrix); + dd->incRef(inputDD); + const auto outputDD = dd->reduceAncillae(inputDD, {true, false}); + + const auto outputMatrix = outputDD.getMatrix(); + const auto expected = + dd::CMat{{1, 0, 1, 0}, {1, 0, 1, 0}, {1, 0, -1, 0}, {1, 0, -1, 0}}; + + EXPECT_EQ(outputMatrix, expected); +} + TEST(DDPackageTest, DDMShiftAllRows) { const auto nqubits = 2U; auto dd = std::make_unique>(nqubits); @@ -2485,37 +2500,74 @@ TEST(DDPackageTest, DDMPECSliQECPeriodFinding8Qubits) { } TEST(DDPackageTest, DDMPECBenchmark) { - auto dd = std::make_unique>(7); + auto dd = std::make_unique>(20); + size_t minN = 3; + size_t maxN = 9; + std::cout << "Partial equivalence check\n"; + for (size_t n = minN; n < maxN; n++) { + dd::Qubit d = + static_cast(static_cast(rand()) % (n - 1)) + 1; + dd::Qubit m = static_cast(rand()) % d; + auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); + + std::cout << "circuit 1: \n"; + c1.print(std::cout); + std::cout << "circuit 2: \n"; + c2.print(std::cout); + auto start = std::chrono::high_resolution_clock::now(); + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); + // Get ending timepoint + auto stop = std::chrono::high_resolution_clock::now(); + auto duration = + std::chrono::duration_cast(stop - start); + + std::cout << "\nnumber of qubits = " << n << "; data qubits = " << d + << "; measured qubits = " << m + << "; number of gates = " << c2.size() << "\n"; + std::cout << "time: " << static_cast(duration.count()) / 1000000. + << " seconds\n"; + } +} + +TEST(DDPackageTest, DDMZAPECBenchmark) { + auto dd = std::make_unique>(20); + size_t minN = 3; + size_t maxN = 8; + std::cout << "Zero-ancilla partial equivalence check\n"; + for (size_t n = minN; n < maxN; n++) { + auto d = static_cast(n); + dd::Qubit m = static_cast(rand()) % d; + auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); + + std::cout << "circuit 1: \n"; + c1.print(std::cout); + std::cout << "circuit 2: \n"; + c2.print(std::cout); + auto start = std::chrono::high_resolution_clock::now(); + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); + // Get ending timepoint + auto stop = std::chrono::high_resolution_clock::now(); + auto duration = + std::chrono::duration_cast(stop - start); + + std::cout << "\nnumber of qubits = " << n << "; data qubits = " << d + << "; measured qubits = " << m + << "; number of gates = " << c2.size() << "\n"; + std::cout << "time: " << static_cast(duration.count()) / 1000000. + << " seconds\n"; + } +} - auto [c1, c2] = dd::generateRandomBenchmark(5, 3, 1); +TEST(DDPackageTest, DDMPECZ) { + auto dd = std::make_unique>(1); + dd::QuantumComputation c1{1}; + dd::QuantumComputation c2{1}; + c2.z(0); std::cout << "circuit 1: \n"; c1.print(std::cout); std::cout << "circuit 2: \n"; c2.print(std::cout); - c1.setLogicalQubitAncillary(3); - c1.setLogicalQubitAncillary(4); - - c2.setLogicalQubitGarbage(1); - c2.setLogicalQubitGarbage(2); - c2.setLogicalQubitGarbage(3); - c2.setLogicalQubitGarbage(4); - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); } - -TEST(DDPackageTest, ReduceAncillaeRegression) { - auto dd = std::make_unique>(2); - const auto inputMatrix = - dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); - dd->incRef(inputDD); - const auto outputDD = dd->reduceAncillae(inputDD, {true, false}); - - const auto outputMatrix = outputDD.getMatrix(); - const auto expected = - dd::CMat{{1, 0, 1, 0}, {1, 0, 1, 0}, {1, 0, -1, 0}, {1, 0, -1, 0}}; - - EXPECT_EQ(outputMatrix, expected); -} From 098ee90c117b610d3dbd90099b814c913cd0a05f Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Tue, 16 Jan 2024 17:35:48 +0100 Subject: [PATCH 34/51] :recycle: adapt code to use the new isCloseToIdentity function for zero ancilla eq. check --- include/dd/Package.hpp | 39 ++++++--------------------------- include/dd/Verification.hpp | 43 ++++++++++++++++++++++++++++++------- test/dd/test_package.cpp | 16 ++++---------- 3 files changed, 45 insertions(+), 53 deletions(-) diff --git a/include/dd/Package.hpp b/include/dd/Package.hpp index 39fd4b92d..0968e487f 100644 --- a/include/dd/Package.hpp +++ b/include/dd/Package.hpp @@ -2733,38 +2733,6 @@ template class Package { return multiply(conjugateTranspose(u), u2); } - ComputeTable zeroAncillaePECComputeTable{}; - - bool zeroAncillaePartialEquivalenceCheckSubroutine(mEdge e, Qubit m) { - if (e.isTerminal()) { - return true; - } - const auto n = e.p->v + 1; - - const mEdge eCopy{e.p, Complex::one()}; - // check if it's in the compute table with an edge weight of one - if (const auto* r = zeroAncillaePECComputeTable.lookup(eCopy, m); - r != nullptr) { - auto f = *r; - return f; - } - bool result = false; - if (m >= n) { - result = e.p->e[1].isZeroTerminal() && e.p->e[2].isZeroTerminal() && - zeroAncillaePartialEquivalenceCheckSubroutine(e.p->e[0], m) && - zeroAncillaePartialEquivalenceCheckSubroutine(e.p->e[3], m); - } else { - result = zeroAncillaePartialEquivalenceCheckSubroutine(e.p->e[0], m) && - zeroAncillaePartialEquivalenceCheckSubroutine(e.p->e[1], m) && - zeroAncillaePartialEquivalenceCheckSubroutine(e.p->e[2], m) && - zeroAncillaePartialEquivalenceCheckSubroutine(e.p->e[3], m); - } - - // add to the compute table with a weight of 1 - zeroAncillaePECComputeTable.insert(eCopy, m, result); - return result; - } - public: /** Checks for partial equivalence between the two circuits u1 and u2, @@ -2826,7 +2794,12 @@ template class Package { **/ bool zeroAncillaePartialEquivalenceCheck(mEdge u1, mEdge u2, Qubit m) { auto u1u2 = multiply(u1, conjugateTranspose(u2)); - return zeroAncillaePartialEquivalenceCheckSubroutine(u1u2, m); + const Qubit n = u1.p->v + 1; + std::vector garbage(n, false); + for (size_t i = m; i < n; i++) { + garbage[i] = true; + } + return isCloseToIdentity(u1u2, 1.0E-10, garbage, false); } }; diff --git a/include/dd/Verification.hpp b/include/dd/Verification.hpp index cca12c149..48648131c 100644 --- a/include/dd/Verification.hpp +++ b/include/dd/Verification.hpp @@ -2,7 +2,34 @@ #include "dd/Package.hpp" namespace dd { +/** + Checks for partial equivalence between the two circuits c1 and c2 + that have no ancilla qubits. + Assumption: the input and output permutations are the same. + @param circuit1 First circuit + @param circuit2 Second circuit + @return true if the two circuits c1 and c2 are partially equivalent. + **/ +template +bool zeroAncillaePartialEquivalenceCheck( + qc::QuantumComputation c1, qc::QuantumComputation c2, + std::unique_ptr>& dd) { + if (c1.getNqubits() != c2.getNqubits() || + c1.getGarbage() != c2.getGarbage()) { + throw std::runtime_error( + "The circuits need to have the same number of qubits and the same " + "permutation of input and output qubits."); + } + c2.invert(); + for (auto& gate : c1) { + c2.emplace_back(gate); + } + + auto u = buildFunctionality(&c2, *dd, false, false); + + return dd->isCloseToIdentity(u, 1.0E-10, c1.getGarbage(), false); +} // get next garbage qubit after n inline Qubit getNextGarbage(Qubit n, const std::vector& garbage) { while (n < static_cast(garbage.size()) && !garbage.at(n)) { @@ -31,11 +58,15 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, if (m1 != m2 || d1 != d2) { return false; } - + auto n1 = static_cast(c1.getNqubits()); + auto n2 = static_cast(c2.getNqubits()); + if (d1 == n1 && d2 == n2) { + // no ancilla qubits + return zeroAncillaePartialEquivalenceCheck(c1, c2, dd); + } // add swaps in order to put the measured (= not garbage) qubits in the end auto garbage1 = c1.getGarbage(); - auto n1 = static_cast(garbage1.size()); - auto n2 = static_cast(c2.getNqubits()); + auto nextGarbage = getNextGarbage(0, garbage1); // find the first garbage qubit at the end for (Qubit i = std::min(n1, n2) - 1; i >= static_cast(m1); i--) { @@ -52,11 +83,7 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, auto u1 = buildFunctionality(&c1, *dd, false, false); auto u2 = buildFunctionality(&c2, *dd, false, false); - if (d1 == n1 && d2 == n2) { - // no ancilla qubits - return dd->zeroAncillaePartialEquivalenceCheck(u1, u2, - static_cast(m1)); - } + return dd->partialEquivalenceCheck(u1, u2, static_cast(d1), static_cast(m1)); } diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 561397b42..76824028e 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2447,15 +2447,9 @@ TEST(DDPackageTest, DDMZAPECMQTBenchQPE30Qubits) { const qc::QuantumComputation c1{ "./circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm"}; const qc::QuantumComputation c2{"./circuits/qpeexact_indep_qiskit_30.qasm"}; - - // buildFunctionality is already very very slow... - // auto f1 = buildFunctionality(&c1, *dd, false, false); - // auto f2 = buildFunctionality(&c2, *dd, false, false); - - // 29 measured qubits and 30 data qubits // calls zeroAncillaePartialEquivalenceCheck - - // EXPECT_TRUE(dd->partialEquivalenceCheck(f1, f2, 30, 29)); + // buildFunctionality is already very very slow... + // EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); EXPECT_TRUE(true); } @@ -2491,10 +2485,8 @@ TEST(DDPackageTest, DDMZAPECSliQECRandomCircuit) { const qc::QuantumComputation c1{"./circuits/random_1.qasm"}; const qc::QuantumComputation c2{"./circuits/random_2.qasm"}; - // calls buildFunctionality for c1 and c2 - // -> this is already very very slow on my computer - // EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, *dd)); - EXPECT_TRUE(true); + // calls buildFunctionality for c2^-1 concatenated with c1 + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); } TEST(DDPackageTest, DDMPECSliQECGrover22Qubits) { From c9ce87aa62e228da4d473ea940ea7b1fc26f0088 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 22 Jan 2024 10:56:08 +0100 Subject: [PATCH 35/51] :bug: bug fix in circuit generation --- src/dd/Verification.cpp | 8 +-- test/dd/test_package.cpp | 108 +++++++++++++++++---------------------- 2 files changed, 52 insertions(+), 64 deletions(-) diff --git a/src/dd/Verification.cpp b/src/dd/Verification.cpp index 20c359c35..07b5314cc 100644 --- a/src/dd/Verification.cpp +++ b/src/dd/Verification.cpp @@ -61,8 +61,7 @@ std::vector fiveDiffferentRandomNumbers(Qubit min, Qubit max) { for (Qubit i = min; i < max; i++) { numbers.push_back(i); } - unsigned seed = static_cast( - std::chrono::system_clock::now().time_since_epoch().count()); + unsigned seed = 42; std::shuffle(numbers.begin(), numbers.end(), std::default_random_engine(seed)); @@ -76,7 +75,8 @@ std::vector fiveDiffferentRandomNumbers(Qubit min, Qubit max) { StandardOperation makeRandomStandardOperation(size_t n, Qubit nrQubits, Qubit min) { auto randomNumbers = fiveDiffferentRandomNumbers(min, min + nrQubits); - auto randomOpType = static_cast(rand() % Compound); + // choose one of the non-compound operations, but not "None" + auto randomOpType = static_cast(rand() % (Compound - 1) + 1); Qubit randomTarget1 = randomNumbers[0]; Qubit randomTarget2{min}; if (randomNumbers.size() > 1) { @@ -259,7 +259,7 @@ generateRandomBenchmark(size_t n, Qubit d, Qubit m) { auto op = makeRandomStandardOperation(n, notMQubits, m); addRandomStandardOperation(circuit1, op, false); } - for (Qubit i = 0U; i < d - m; i++) { + for (Qubit i = 0U; i < notMQubits; i++) { auto op = makeRandomStandardOperation(n, notMQubits, m); addRandomStandardOperation(circuit2, op, false); } diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index caead1f2b..b80bae9ca 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2572,73 +2572,61 @@ TEST(DDPackageTest, DDMPECSliQECPeriodFinding8Qubits) { TEST(DDPackageTest, DDMPECBenchmark) { auto dd = std::make_unique>(20); - size_t minN = 3; - size_t maxN = 9; + srand(55); + size_t minN = 2; + size_t maxN = 8; + size_t reps = 15; std::cout << "Partial equivalence check\n"; - for (size_t n = minN; n < maxN; n++) { - dd::Qubit d = - static_cast(static_cast(rand()) % (n - 1)) + 1; - dd::Qubit m = static_cast(rand()) % d; - auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); - - std::cout << "circuit 1: \n"; - c1.print(std::cout); - std::cout << "circuit 2: \n"; - c2.print(std::cout); - auto start = std::chrono::high_resolution_clock::now(); - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); - // Get ending timepoint - auto stop = std::chrono::high_resolution_clock::now(); - auto duration = - std::chrono::duration_cast(stop - start); - - std::cout << "\nnumber of qubits = " << n << "; data qubits = " << d - << "; measured qubits = " << m - << "; number of gates = " << c2.size() << "\n"; - std::cout << "time: " << static_cast(duration.count()) / 1000000. - << " seconds\n"; + for (size_t k = 0; k < reps; k++) { + for (size_t n = minN; n < maxN; n++) { + dd::Qubit d = + static_cast(static_cast(rand()) % (n - 1)) + 1; + dd::Qubit m = static_cast(rand()) % d; + auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); + + auto start = std::chrono::high_resolution_clock::now(); + bool result = dd::partialEquivalenceCheck(c1, c2, dd); + // Get ending timepoint + auto stop = std::chrono::high_resolution_clock::now(); + auto duration = + std::chrono::duration_cast(stop - start); + + EXPECT_TRUE(result); + + std::cout << "\nnumber of qubits = " << n << "; data qubits = " << d + << "; measured qubits = " << m + << "; number of gates = " << c2.size() << "\n"; + std::cout << "time: " << static_cast(duration.count()) / 1000000. + << " seconds\n"; + } } } TEST(DDPackageTest, DDMZAPECBenchmark) { auto dd = std::make_unique>(20); size_t minN = 3; - size_t maxN = 8; + size_t maxN = 12; + size_t reps = 1; std::cout << "Zero-ancilla partial equivalence check\n"; - for (size_t n = minN; n < maxN; n++) { - auto d = static_cast(n); - dd::Qubit m = static_cast(rand()) % d; - auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); - - std::cout << "circuit 1: \n"; - c1.print(std::cout); - std::cout << "circuit 2: \n"; - c2.print(std::cout); - auto start = std::chrono::high_resolution_clock::now(); - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); - // Get ending timepoint - auto stop = std::chrono::high_resolution_clock::now(); - auto duration = - std::chrono::duration_cast(stop - start); - - std::cout << "\nnumber of qubits = " << n << "; data qubits = " << d - << "; measured qubits = " << m - << "; number of gates = " << c2.size() << "\n"; - std::cout << "time: " << static_cast(duration.count()) / 1000000. - << " seconds\n"; + for (size_t k = 0; k < reps; k++) { + for (size_t n = minN; n < maxN; n++) { + auto d = static_cast(n); + dd::Qubit m = static_cast(rand()) % d; + auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); + auto start = std::chrono::high_resolution_clock::now(); + bool result = dd::partialEquivalenceCheck(c1, c2, dd); + // Get ending timepoint + auto stop = std::chrono::high_resolution_clock::now(); + auto duration = + std::chrono::duration_cast(stop - start); + + EXPECT_TRUE(result); + + std::cout << "\nnumber of qubits = " << n << "; data qubits = " << d + << "; measured qubits = " << m + << "; number of gates = " << c2.size() << "\n"; + std::cout << "time: " << static_cast(duration.count()) / 1000000. + << " seconds\n"; + } } } - -TEST(DDPackageTest, DDMPECZ) { - auto dd = std::make_unique>(1); - - dd::QuantumComputation c1{1}; - dd::QuantumComputation c2{1}; - c2.z(0); - std::cout << "circuit 1: \n"; - c1.print(std::cout); - std::cout << "circuit 2: \n"; - c2.print(std::cout); - - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); -} From dc81bd6ecc7b56e6763e2ea0d94f471992142a6c Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Wed, 24 Jan 2024 11:39:04 +0100 Subject: [PATCH 36/51] add some pre-generated circuits --- src/dd/Verification.cpp | 87 ++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 36 deletions(-) diff --git a/src/dd/Verification.cpp b/src/dd/Verification.cpp index 07b5314cc..3ee4fb009 100644 --- a/src/dd/Verification.cpp +++ b/src/dd/Verification.cpp @@ -6,13 +6,17 @@ namespace dd { -const std::vector> PRE_GENERATED_CIRCUITS_SIZE_1_1{{}}; +const std::vector> PRE_GENERATED_CIRCUITS_SIZE_1_1{ + {}, {}, {}, {}}; -const std::vector> PRE_GENERATED_CIRCUITS_SIZE_1_2{{Z}}; +const std::vector> PRE_GENERATED_CIRCUITS_SIZE_1_2{ + {Z}, {Tdg}, {S}, {Sdg}}; -const std::vector> PRE_GENERATED_CIRCUITS_SIZE_2_1{{}}; +const std::vector> PRE_GENERATED_CIRCUITS_SIZE_2_1{ + {}, {}, {}, {}}; -const std::vector> PRE_GENERATED_CIRCUITS_SIZE_2_2{{Z}}; +const std::vector> PRE_GENERATED_CIRCUITS_SIZE_2_2{ + {Z}, {Tdg}, {S}, {Sdg}}; void addDecomposedCxxGate(QuantumComputation& circuit, Qubit control1, Qubit control2, Qubit target) { @@ -72,35 +76,11 @@ std::vector fiveDiffferentRandomNumbers(Qubit min, Qubit max) { return outputVector; } -StandardOperation makeRandomStandardOperation(size_t n, Qubit nrQubits, - Qubit min) { - auto randomNumbers = fiveDiffferentRandomNumbers(min, min + nrQubits); - // choose one of the non-compound operations, but not "None" - auto randomOpType = static_cast(rand() % (Compound - 1) + 1); - Qubit randomTarget1 = randomNumbers[0]; - Qubit randomTarget2{min}; - if (randomNumbers.size() > 1) { - randomTarget2 = randomNumbers[1]; - }; - size_t nrControls = - std::min(randomNumbers.size() - 3, static_cast(rand() % 3)); - if (randomNumbers.size() < 3) { - nrControls = 0; - } - if (nrControls == 2) { - // otherwise Cnots are almost never generated - randomOpType = qc::X; - } - Controls randomControls{}; - for (size_t i = 0; i < nrControls; i++) { - randomControls.emplace(randomNumbers[i + 2]); - } - const fp randomParameter1 = - static_cast(rand()) / static_cast(RAND_MAX); - const fp randomParameter2 = - static_cast(rand()) / static_cast(RAND_MAX); - const fp randomParameter3 = - static_cast(rand()) / static_cast(RAND_MAX); +StandardOperation convertToStandardOperation( + size_t n, size_t nrQubits, OpType randomOpType, Qubit randomTarget1, + Qubit randomTarget2, fp randomParameter1, fp randomParameter2, + fp randomParameter3, const Controls& randomControls) { + switch (randomOpType) { // two targets and zero parameters case qc::SWAP: @@ -110,7 +90,7 @@ StandardOperation makeRandomStandardOperation(size_t n, Qubit nrQubits, case qc::Peresdg: case qc::DCX: case qc::ECR: - if (randomNumbers.size() > 1) { + if (nrQubits > 1) { return {n, randomControls, Targets{randomTarget1, randomTarget2}, randomOpType}; } @@ -120,7 +100,7 @@ StandardOperation makeRandomStandardOperation(size_t n, Qubit nrQubits, case qc::RYY: case qc::RZZ: case qc::RZX: - if (randomNumbers.size() > 1) { + if (nrQubits > 1) { return {n, randomControls, Targets{randomTarget1, randomTarget2}, randomOpType, std::vector{randomParameter1}}; } @@ -129,7 +109,7 @@ StandardOperation makeRandomStandardOperation(size_t n, Qubit nrQubits, // two targets and two parameters case qc::XXminusYY: case qc::XXplusYY: - if (randomNumbers.size() > 1) { + if (nrQubits > 1) { return {n, randomControls, Targets{randomTarget1, randomTarget2}, randomOpType, std::vector{randomParameter1, randomParameter2}}; @@ -173,6 +153,41 @@ StandardOperation makeRandomStandardOperation(size_t n, Qubit nrQubits, return {n, randomTarget1, qc::I}; } +StandardOperation makeRandomStandardOperation(size_t n, Qubit nrQubits, + Qubit min) { + auto randomNumbers = fiveDiffferentRandomNumbers(min, min + nrQubits); + // choose one of the non-compound operations, but not "None" + auto randomOpType = static_cast(rand() % (Vdg - H) + H); + Qubit randomTarget1 = randomNumbers[0]; + Qubit randomTarget2{min}; + if (randomNumbers.size() > 1) { + randomTarget2 = randomNumbers[1]; + }; + size_t nrControls = + std::min(randomNumbers.size() - 3, static_cast(rand() % 3)); + if (randomNumbers.size() < 3) { + nrControls = 0; + } + if (nrControls == 2) { + // otherwise Cnots are almost never generated + randomOpType = qc::X; + } + Controls randomControls{}; + for (size_t i = 0; i < nrControls; i++) { + randomControls.emplace(randomNumbers[i + 2]); + } + const std::vector randomParameters{PI, PI_2, PI_4}; + const fp randomParameter1 = + randomParameters[static_cast(rand()) % randomParameters.size()]; + const fp randomParameter2 = + randomParameters[static_cast(rand()) % randomParameters.size()]; + const fp randomParameter3 = + randomParameters[static_cast(rand()) % randomParameters.size()]; + return convertToStandardOperation( + n, nrQubits, randomOpType, randomTarget1, randomTarget2, randomParameter1, + randomParameter2, randomParameter3, randomControls); +} + void addPreGeneratedCircuits(QuantumComputation& circuit1, QuantumComputation& circuit2, size_t n, Qubit groupBeginIndex, Qubit groupSize) { From 90cbadd6fb695f8d7a89a0e8e6f9b9940441e517 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 29 Jan 2024 14:36:50 +0100 Subject: [PATCH 37/51] :art: clean up code --- src/dd/Verification.cpp | 116 +++++++++++++++++++++------------------ test/dd/test_package.cpp | 108 +++++++++++++++++++++++------------- 2 files changed, 132 insertions(+), 92 deletions(-) diff --git a/src/dd/Verification.cpp b/src/dd/Verification.cpp index 3ee4fb009..401f77ed7 100644 --- a/src/dd/Verification.cpp +++ b/src/dd/Verification.cpp @@ -13,12 +13,42 @@ const std::vector> PRE_GENERATED_CIRCUITS_SIZE_1_2{ {Z}, {Tdg}, {S}, {Sdg}}; const std::vector> PRE_GENERATED_CIRCUITS_SIZE_2_1{ - {}, {}, {}, {}}; + {}, {}, {}, {}, {X}, {X}}; const std::vector> PRE_GENERATED_CIRCUITS_SIZE_2_2{ - {Z}, {Tdg}, {S}, {Sdg}}; + {Z}, {Tdg}, {S}, {Sdg}, {X, Z}, {Z, X}}; + +void addPreGeneratedCircuits(QuantumComputation& circuit1, + QuantumComputation& circuit2, size_t n, + Qubit groupBeginIndex, Qubit groupSize) { -void addDecomposedCxxGate(QuantumComputation& circuit, Qubit control1, + const auto& circuits1 = groupSize == 1 ? PRE_GENERATED_CIRCUITS_SIZE_1_1 + : PRE_GENERATED_CIRCUITS_SIZE_2_1; + const auto& circuits2 = groupSize == 1 ? PRE_GENERATED_CIRCUITS_SIZE_1_2 + : PRE_GENERATED_CIRCUITS_SIZE_2_2; + auto nrCircuits = circuits1.size(); + auto randomIndex = static_cast(rand()) % nrCircuits; + auto x1 = circuits1[randomIndex]; + auto x2 = circuits2[randomIndex]; + for (auto gateType : x1) { + if (gateType == X) { // add CNOT + circuit1.emplace_back(n, groupBeginIndex, + groupBeginIndex + 1, gateType); + } else { + circuit1.emplace_back(n, groupBeginIndex, gateType); + } + } + for (auto gateType : x2) { + if (gateType == X) { // add CNOT + circuit2.emplace_back(n, groupBeginIndex, + groupBeginIndex + 1, gateType); + } else { + circuit2.emplace_back(n, groupBeginIndex, gateType); + } + } +} + +void addDecomposedCcxGate(QuantumComputation& circuit, Qubit control1, Qubit control2, Qubit target) { circuit.h(target); circuit.cx(control1, target); @@ -37,26 +67,23 @@ void addDecomposedCxxGate(QuantumComputation& circuit, Qubit control1, circuit.cx(control2, control1); } -void addRandomStandardOperation(QuantumComputation& circuit, - StandardOperation op, bool decomposeMcx) { +void addStandardOperationToCircuit(QuantumComputation& circuit, + StandardOperation op, bool decomposeCcx) { std::vector controls{}; - for (auto c : op.getControls()) { // they are at most 2 + for (auto c : op.getControls()) { // the controls are at most 2 controls.push_back(static_cast(c.qubit)); } std::vector targets{}; - for (auto t : op.getTargets()) { // they are at most 2 + for (auto t : op.getTargets()) { // the targets are at most 2 targets.push_back(static_cast(t)); } - if (op.getType() == qc::X && controls.size() == 2) { - - if (decomposeMcx) { - addDecomposedCxxGate(circuit, controls[0], controls[1], targets[0]); - return; - } + if (op.getType() == X && controls.size() == 2 && decomposeCcx) { + // decompose toffoli gate + addDecomposedCcxGate(circuit, controls[0], controls[1], targets[0]); + } else { + circuit.emplace_back(op); } - - circuit.emplace_back(op); } std::vector fiveDiffferentRandomNumbers(Qubit min, Qubit max) { @@ -95,6 +122,7 @@ StandardOperation convertToStandardOperation( randomOpType}; } break; + // two targets and one parameter case qc::RXX: case qc::RYY: @@ -156,20 +184,22 @@ StandardOperation convertToStandardOperation( StandardOperation makeRandomStandardOperation(size_t n, Qubit nrQubits, Qubit min) { auto randomNumbers = fiveDiffferentRandomNumbers(min, min + nrQubits); - // choose one of the non-compound operations, but not "None" - auto randomOpType = static_cast(rand() % (Vdg - H) + H); + // choose one of the non-compound operations, but not "None", and also + // not GPhase or I or Barrier + auto randomOpType = static_cast(rand() % (XXplusYY - H) + H); Qubit randomTarget1 = randomNumbers[0]; Qubit randomTarget2{min}; if (randomNumbers.size() > 1) { randomTarget2 = randomNumbers[1]; }; + // choose random controls, but not more than available qubits size_t nrControls = std::min(randomNumbers.size() - 3, static_cast(rand() % 3)); if (randomNumbers.size() < 3) { nrControls = 0; } if (nrControls == 2) { - // otherwise Cnots are almost never generated + // otherwise toffoli gates are almost never generated randomOpType = qc::X; } Controls randomControls{}; @@ -188,40 +218,12 @@ StandardOperation makeRandomStandardOperation(size_t n, Qubit nrQubits, randomParameter2, randomParameter3, randomControls); } -void addPreGeneratedCircuits(QuantumComputation& circuit1, - QuantumComputation& circuit2, size_t n, - Qubit groupBeginIndex, Qubit groupSize) { - - const auto& circuits1 = groupSize == 1 ? PRE_GENERATED_CIRCUITS_SIZE_1_1 - : PRE_GENERATED_CIRCUITS_SIZE_2_1; - const auto& circuits2 = groupSize == 1 ? PRE_GENERATED_CIRCUITS_SIZE_1_2 - : PRE_GENERATED_CIRCUITS_SIZE_2_2; - auto nrCircuits = circuits1.size(); - auto randomIndex = static_cast(rand()) % nrCircuits; - auto x1 = circuits1[randomIndex]; - auto x2 = circuits2[randomIndex]; - for (auto gateType : x1) { - if (isTwoQubitGate(gateType)) { - circuit1.emplace_back(n, groupBeginIndex, - groupBeginIndex + 1, gateType); - } - circuit1.emplace_back(n, groupBeginIndex, gateType); - } - for (auto gateType : x2) { - if (isTwoQubitGate(gateType)) { - circuit2.emplace_back(n, groupBeginIndex, - groupBeginIndex + 1, gateType); - } - circuit2.emplace_back(n, groupBeginIndex, gateType); - } -} - std::pair generateRandomBenchmark(size_t n, Qubit d, Qubit m) { if (d > n) { throw std::runtime_error("The number of data or measured qubits can't be " "bigger than the total number of qubits. n = " + - std::to_string(n) + ";d = " + std::to_string(d) + + std::to_string(n) + "; d = " + std::to_string(d) + "; m = " + std::to_string(m)); } qc::QuantumComputation circuit1{n}; @@ -231,23 +233,26 @@ generateRandomBenchmark(size_t n, Qubit d, Qubit m) { circuit1.h(i); circuit2.h(i); } + for (Qubit i = 0U; i < static_cast(n); i++) { circuit1.barrier(i); circuit2.barrier(i); } // 2) Totally equivalent subcircuits - // generate a random subcircuit with d qubits and 3d gates to apply - // on both circuits, but all the Toffoli gates in C2 are decomposed + // generate a random subcircuit with d qubits and 3*d gates to apply + // on both circuits, but all the Toffoli gates in circuit2 are decomposed for (Qubit i = 0U; i < 3 * d; i++) { auto op = makeRandomStandardOperation(n, d, 0); - addRandomStandardOperation(circuit1, op, false); - addRandomStandardOperation(circuit2, op, true); + addStandardOperationToCircuit(circuit1, op, false); + addStandardOperationToCircuit(circuit2, op, true); } + for (Qubit i = 0U; i < static_cast(n); i++) { circuit1.barrier(i); circuit2.barrier(i); } + // 3) Partially equivalent subcircuits // divide data qubits into groups of size 1 or 2 @@ -262,6 +267,7 @@ generateRandomBenchmark(size_t n, Qubit d, Qubit m) { groupBeginIndex += groupSize; } + for (Qubit i = 0U; i < static_cast(n); i++) { circuit1.barrier(i); circuit2.barrier(i); @@ -272,17 +278,19 @@ generateRandomBenchmark(size_t n, Qubit d, Qubit m) { Qubit notMQubits = d - m; for (Qubit i = 0U; i < notMQubits; i++) { auto op = makeRandomStandardOperation(n, notMQubits, m); - addRandomStandardOperation(circuit1, op, false); + addStandardOperationToCircuit(circuit1, op, false); } for (Qubit i = 0U; i < notMQubits; i++) { auto op = makeRandomStandardOperation(n, notMQubits, m); - addRandomStandardOperation(circuit2, op, false); + addStandardOperationToCircuit(circuit2, op, false); } } + for (Qubit i = 0U; i < static_cast(n); i++) { circuit1.barrier(i); circuit2.barrier(i); } + // 5) CNOT gates (if there are ancilla qubits) Qubit currentDataQubit = 0; for (Qubit currentAncillaQubit = d; @@ -297,6 +305,7 @@ generateRandomBenchmark(size_t n, Qubit d, Qubit m) { circuit1.setLogicalQubitAncillary(i); circuit2.setLogicalQubitAncillary(i); } + for (Qubit i = m; i < static_cast(n); i++) { circuit1.setLogicalQubitGarbage(i); circuit2.setLogicalQubitGarbage(i); @@ -304,4 +313,5 @@ generateRandomBenchmark(size_t n, Qubit d, Qubit m) { return std::make_pair(circuit1, circuit2); } + } // namespace dd diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index b80bae9ca..da56ef1c1 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2570,18 +2570,25 @@ TEST(DDPackageTest, DDMPECSliQECPeriodFinding8Qubits) { EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); } -TEST(DDPackageTest, DDMPECBenchmark) { - auto dd = std::make_unique>(20); - srand(55); - size_t minN = 2; - size_t maxN = 8; - size_t reps = 15; - std::cout << "Partial equivalence check\n"; - for (size_t k = 0; k < reps; k++) { - for (size_t n = minN; n < maxN; n++) { - dd::Qubit d = - static_cast(static_cast(rand()) % (n - 1)) + 1; - dd::Qubit m = static_cast(rand()) % d; +void partialEquivalencCheckingBenchmarks( + std::unique_ptr>& dd, size_t minN, + size_t maxN, size_t reps, bool addAncilla) { + for (size_t n = minN; n < maxN; n++) { + std::chrono::microseconds totalTime{0}; + std::uint16_t totalGates{0}; + for (size_t k = 0; k < reps; k++) { + dd::Qubit d{0}; + if (addAncilla) { + d = static_cast(rand()) % static_cast(n - 1) + 1; + } else { + d = static_cast(n); + } + dd::Qubit m{0}; + if (d == 1) { + m = 1; + } else { + m = static_cast(rand()) % static_cast(d - 1) + 1; + } auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); auto start = std::chrono::high_resolution_clock::now(); @@ -2593,40 +2600,63 @@ TEST(DDPackageTest, DDMPECBenchmark) { EXPECT_TRUE(result); - std::cout << "\nnumber of qubits = " << n << "; data qubits = " << d - << "; measured qubits = " << m - << "; number of gates = " << c2.size() << "\n"; - std::cout << "time: " << static_cast(duration.count()) / 1000000. - << " seconds\n"; + // std::cout << "\nnumber of qubits = " << n << "; data qubits = " << d + // << "; measured qubits = " << m + // << "; number of gates = " << c2.size() << "\n"; + // std::cout << "time: " << static_cast(duration.count()) / + // 1000000. + // << " seconds\n"; + totalTime += duration; + totalGates += static_cast(c2.size()); } + std::cout << "\nnumber of qubits = " << n << "; number of reps = " << reps + << "; average time = " + << (static_cast(totalTime.count()) / + static_cast(reps) / 1000000.) + << " seconds; average time = " + << (static_cast(totalGates) / static_cast(reps)) + << " seconds\n"; } } -TEST(DDPackageTest, DDMZAPECBenchmark) { +TEST(DDPackageTest, DDMPECBenchmark) { auto dd = std::make_unique>(20); + srand(55); + size_t minN = 2; + size_t maxN = 15; + size_t reps = 10; + std::cout << "Partial equivalence check\n"; + partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, true); +} + +TEST(DDPackageTest, DDMZAPECBenchmark) { + auto dd = std::make_unique>(30); size_t minN = 3; - size_t maxN = 12; - size_t reps = 1; + size_t maxN = 30; + size_t reps = 10; std::cout << "Zero-ancilla partial equivalence check\n"; - for (size_t k = 0; k < reps; k++) { - for (size_t n = minN; n < maxN; n++) { - auto d = static_cast(n); - dd::Qubit m = static_cast(rand()) % d; - auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); - auto start = std::chrono::high_resolution_clock::now(); - bool result = dd::partialEquivalenceCheck(c1, c2, dd); - // Get ending timepoint - auto stop = std::chrono::high_resolution_clock::now(); - auto duration = - std::chrono::duration_cast(stop - start); + partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, false); +} - EXPECT_TRUE(result); +TEST(DDPackageTest, DDMPartialEquivalenceCheckingFindEqCircuits) { + const auto nqubits = 4U; + auto dd = std::make_unique>(nqubits); - std::cout << "\nnumber of qubits = " << n << "; data qubits = " << d - << "; measured qubits = " << m - << "; number of gates = " << c2.size() << "\n"; - std::cout << "time: " << static_cast(duration.count()) / 1000000. - << " seconds\n"; - } - } + qc::QuantumComputation c1{2, 1}; + c1.cx(0, 1); + + qc::QuantumComputation c2{2, 1}; + c2.z(1); + c2.cx(0, 1); + + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); + + qc::QuantumComputation c3{2, 1}; + c3.cx(0, 1); + + qc::QuantumComputation c4{2, 1}; + c4.cx(0, 1); + c4.z(1); + + EXPECT_TRUE(dd::partialEquivalenceCheck(c3, c4, dd)); } From 37b5f69c556184003ca1d0e4a7c6abc2e0ec96ae Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 29 Jan 2024 14:46:41 +0100 Subject: [PATCH 38/51] :bug: fix printed message --- test/dd/test_package.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index da56ef1c1..9bf79199a 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2613,9 +2613,9 @@ void partialEquivalencCheckingBenchmarks( << "; average time = " << (static_cast(totalTime.count()) / static_cast(reps) / 1000000.) - << " seconds; average time = " + << " seconds; average number of gates = " << (static_cast(totalGates) / static_cast(reps)) - << " seconds\n"; + << "\n"; } } @@ -2623,7 +2623,7 @@ TEST(DDPackageTest, DDMPECBenchmark) { auto dd = std::make_unique>(20); srand(55); size_t minN = 2; - size_t maxN = 15; + size_t maxN = 8; size_t reps = 10; std::cout << "Partial equivalence check\n"; partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, true); @@ -2632,7 +2632,7 @@ TEST(DDPackageTest, DDMPECBenchmark) { TEST(DDPackageTest, DDMZAPECBenchmark) { auto dd = std::make_unique>(30); size_t minN = 3; - size_t maxN = 30; + size_t maxN = 15; size_t reps = 10; std::cout << "Zero-ancilla partial equivalence check\n"; partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, false); From 72b9b2b060fed98e1e64a5176ddc0e0eb8daf296 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 29 Jan 2024 15:09:54 +0100 Subject: [PATCH 39/51] =?UTF-8?q?=F0=9F=9A=9A=20move=20verification=20file?= =?UTF-8?q?=20to=20algorithms/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/{dd => algorithms}/Verification.hpp | 0 src/CMakeLists.txt | 1 + src/{dd => algorithms}/Verification.cpp | 2 +- src/dd/CMakeLists.txt | 1 - test/CMakeLists.txt | 1 + test/algorithms/test_partial_equivalence.cpp | 209 +++++++++++++++++ test/dd/test_package.cpp | 224 ------------------- 7 files changed, 212 insertions(+), 226 deletions(-) rename include/{dd => algorithms}/Verification.hpp (100%) rename src/{dd => algorithms}/Verification.cpp (99%) create mode 100644 test/algorithms/test_partial_equivalence.cpp diff --git a/include/dd/Verification.hpp b/include/algorithms/Verification.hpp similarity index 100% rename from include/dd/Verification.hpp rename to include/algorithms/Verification.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 96e892143..91a9af3ee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -91,6 +91,7 @@ if(NOT TARGET ${MQT_CORE_TARGET_NAME}) algorithms/QFT.cpp algorithms/QPE.cpp algorithms/RandomCliffordCircuit.cpp + algorithms/Verification.cpp algorithms/WState.cpp CircuitOptimizer.cpp operations/ClassicControlledOperation.cpp diff --git a/src/dd/Verification.cpp b/src/algorithms/Verification.cpp similarity index 99% rename from src/dd/Verification.cpp rename to src/algorithms/Verification.cpp index 401f77ed7..9e2a85517 100644 --- a/src/dd/Verification.cpp +++ b/src/algorithms/Verification.cpp @@ -1,4 +1,4 @@ -#include "dd/Verification.hpp" +#include "algorithms/Verification.hpp" #include "QuantumComputation.hpp" #include "operations/OpType.hpp" diff --git a/src/dd/CMakeLists.txt b/src/dd/CMakeLists.txt index 62809b93e..618fb124d 100644 --- a/src/dd/CMakeLists.txt +++ b/src/dd/CMakeLists.txt @@ -19,7 +19,6 @@ if(NOT TARGET ${MQT_CORE_TARGET_NAME}-dd) RealNumber.cpp RealNumberUniqueTable.cpp Simulation.cpp - Verification.cpp statistics/MemoryManagerStatistics.cpp statistics/Statistics.cpp statistics/TableStatistics.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8e358d581..2aeb5328b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,6 +16,7 @@ package_add_test( algorithms/eval_dynamic_circuits.cpp algorithms/test_qft.cpp algorithms/test_grover.cpp + algorithms/test_partial_equivalence.cpp algorithms/test_bernsteinvazirani.cpp algorithms/test_entanglement.cpp algorithms/test_grcs.cpp diff --git a/test/algorithms/test_partial_equivalence.cpp b/test/algorithms/test_partial_equivalence.cpp new file mode 100644 index 000000000..a01567a66 --- /dev/null +++ b/test/algorithms/test_partial_equivalence.cpp @@ -0,0 +1,209 @@ +#include "algorithms/Verification.hpp" +#include "dd/Benchmark.hpp" +#include "dd/Package.hpp" + +#include "gtest/gtest.h" +#include +#include + +using namespace qc::literals; + +TEST(PartialEquivalence, + DDMPartialEquivalenceCheckingExamplePaperDifferentQubitOrder) { + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + + qc::QuantumComputation c1{3, 1}; + c1.cswap(1, 2, 0); + c1.h(2); + c1.z(0); + c1.cswap(1, 2, 0); + + qc::QuantumComputation c2{3, 1}; + c2.x(1); + c2.ch(1, 2); + + c1.setLogicalQubitGarbage(1); + c1.setLogicalQubitGarbage(0); + + c2.setLogicalQubitGarbage(1); + c2.setLogicalQubitGarbage(0); + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); +} + +TEST(PartialEquivalence, + DDMPartialEquivalenceCheckingExamplePaperDifferentQubitOrderAndNumber) { + const auto nqubits = 4U; + auto dd = std::make_unique>(nqubits); + + qc::QuantumComputation c1{4, 1}; + c1.cswap(1, 2, 0); + c1.h(2); + c1.z(0); + c1.cswap(1, 2, 0); + + qc::QuantumComputation c2{3, 1}; + c2.x(1); + c2.ch(1, 2); + + c1.setLogicalQubitGarbage(1); + c1.setLogicalQubitGarbage(0); + c1.setLogicalQubitGarbage(3); + c1.setLogicalQubitAncillary(3); + + c2.setLogicalQubitGarbage(1); + c2.setLogicalQubitGarbage(0); + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); + EXPECT_TRUE(dd::partialEquivalenceCheck(c2, c1, dd)); +} + +TEST(PartialEquivalence, DDMZAPECMQTBenchQPE30Qubits) { + // zero ancilla partial equivalence test + auto dd = std::make_unique>(31); + + // 30 qubits + const qc::QuantumComputation c1{ + "./circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm"}; + const qc::QuantumComputation c2{"./circuits/qpeexact_indep_qiskit_30.qasm"}; + // calls zeroAncillaePartialEquivalenceCheck + // buildFunctionality is already very very slow... + // EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); + EXPECT_TRUE(true); +} + +TEST(PartialEquivalence, DDMZAPECSliQEC19Qubits) { + auto dd = std::make_unique>(20); + + // full equivalence, 10 qubits + const qc::QuantumComputation c1{"./circuits/entanglement_1.qasm"}; + const qc::QuantumComputation c2{"./circuits/entanglement_2.qasm"}; + + // calls zeroAncillaePartialEquivalenceCheck + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); + + // full equivalence, 19 qubits + const qc::QuantumComputation c3{"./circuits/add6_196_1.qasm"}; + const qc::QuantumComputation c4{"./circuits/add6_196_2.qasm"}; + + // calls zeroAncillaePartialEquivalenceCheck + EXPECT_TRUE(dd::partialEquivalenceCheck(c3, c4, dd)); + + // full equivalence, 10 qubits + const qc::QuantumComputation c5{"./circuits/bv_1.qasm"}; + const qc::QuantumComputation c6{"./circuits/bv_2.qasm"}; + + // calls zeroAncillaePartialEquivalenceCheck + EXPECT_TRUE(dd::partialEquivalenceCheck(c5, c6, dd)); +} + +TEST(PartialEquivalence, DDMZAPECSliQECRandomCircuit) { + // doesn't terminate + auto dd = std::make_unique>(20); + // full equivalence, 10 qubits + const qc::QuantumComputation c1{"./circuits/random_1.qasm"}; + const qc::QuantumComputation c2{"./circuits/random_2.qasm"}; + + // calls buildFunctionality for c2^-1 concatenated with c1 + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); +} + +TEST(PartialEquivalence, DDMPECSliQECPeriodFinding8Qubits) { + auto dd = std::make_unique>(20); + // 8 qubits, 3 data qubits + qc::QuantumComputation c1{"./circuits/period_finding_1.qasm"}; + // 8 qubits, 3 data qubits + qc::QuantumComputation c2{"./circuits/period_finding_2.qasm"}; + + // 3 measured qubits and 3 data qubits + + c2.setLogicalQubitAncillary(7); + c2.setLogicalQubitGarbage(7); + c2.setLogicalQubitAncillary(6); + c2.setLogicalQubitGarbage(6); + c2.setLogicalQubitAncillary(5); + c2.setLogicalQubitGarbage(5); + c2.setLogicalQubitAncillary(3); + c2.setLogicalQubitGarbage(3); + c2.setLogicalQubitAncillary(4); + c2.setLogicalQubitGarbage(4); + + c1.setLogicalQubitAncillary(7); + c1.setLogicalQubitGarbage(7); + c1.setLogicalQubitAncillary(6); + c1.setLogicalQubitGarbage(6); + c1.setLogicalQubitAncillary(5); + c1.setLogicalQubitGarbage(5); + c1.setLogicalQubitAncillary(3); + c1.setLogicalQubitGarbage(3); + c1.setLogicalQubitAncillary(4); + c1.setLogicalQubitGarbage(4); + EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); +} + +void partialEquivalencCheckingBenchmarks( + std::unique_ptr>& dd, size_t minN, + size_t maxN, size_t reps, bool addAncilla) { + for (size_t n = minN; n < maxN; n++) { + std::chrono::microseconds totalTime{0}; + std::uint16_t totalGates{0}; + for (size_t k = 0; k < reps; k++) { + dd::Qubit d{0}; + if (addAncilla) { + d = static_cast(rand()) % static_cast(n - 1) + 1; + } else { + d = static_cast(n); + } + dd::Qubit m{0}; + if (d == 1) { + m = 1; + } else { + m = static_cast(rand()) % static_cast(d - 1) + 1; + } + auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); + + auto start = std::chrono::high_resolution_clock::now(); + bool result = dd::partialEquivalenceCheck(c1, c2, dd); + // Get ending timepoint + auto stop = std::chrono::high_resolution_clock::now(); + auto duration = + std::chrono::duration_cast(stop - start); + + EXPECT_TRUE(result); + + // std::cout << "\nnumber of qubits = " << n << "; data qubits = " << d + // << "; measured qubits = " << m + // << "; number of gates = " << c2.size() << "\n"; + // std::cout << "time: " << static_cast(duration.count()) / + // 1000000. + // << " seconds\n"; + totalTime += duration; + totalGates += static_cast(c2.size()); + } + std::cout << "\nnumber of qubits = " << n << "; number of reps = " << reps + << "; average time = " + << (static_cast(totalTime.count()) / + static_cast(reps) / 1000000.) + << " seconds; average number of gates = " + << (static_cast(totalGates) / static_cast(reps)) + << "\n"; + } +} + +TEST(PartialEquivalence, DDMPECBenchmark) { + auto dd = std::make_unique>(20); + srand(55); + size_t minN = 2; + size_t maxN = 8; + size_t reps = 10; + std::cout << "Partial equivalence check\n"; + partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, true); +} + +TEST(PartialEquivalence, DDMZAPECBenchmark) { + auto dd = std::make_unique>(30); + size_t minN = 3; + size_t maxN = 15; + size_t reps = 10; + std::cout << "Zero-ancilla partial equivalence check\n"; + partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, false); +} diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 9bf79199a..8bc244f67 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -5,7 +5,6 @@ #include "dd/FunctionalityConstruction.hpp" #include "dd/GateMatrixDefinitions.hpp" #include "dd/Package.hpp" -#include "dd/Verification.hpp" #include "dd/statistics/PackageStatistics.hpp" #include "operations/Control.hpp" #include "operations/OpType.hpp" @@ -2331,29 +2330,6 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncillae) { EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(c3, c4, 1)); } -TEST(DDPackageTest, - DDMPartialEquivalenceCheckingExamplePaperDifferentQubitOrder) { - const auto nqubits = 3U; - auto dd = std::make_unique>(nqubits); - - qc::QuantumComputation c1{3, 1}; - c1.cswap(1, 2, 0); - c1.h(2); - c1.z(0); - c1.cswap(1, 2, 0); - - qc::QuantumComputation c2{3, 1}; - c2.x(1); - c2.ch(1, 2); - - c1.setLogicalQubitGarbage(1); - c1.setLogicalQubitGarbage(0); - - c2.setLogicalQubitGarbage(1); - c2.setLogicalQubitGarbage(0); - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); -} - TEST(DDPackageTest, DDMPartialEquivalenceWithDifferentNumberOfQubits) { auto dd = std::make_unique>(3); auto controlledSwapGate = dd->makeSWAPDD(3, qc::Controls{1}, 0, 2); @@ -2379,32 +2355,6 @@ TEST(DDPackageTest, DDMPartialEquivalenceWithDifferentNumberOfQubits) { dd->partialEquivalenceCheck(dd::mEdge::one(), dd::mEdge::one(), 0, 0)); } -TEST(DDPackageTest, - DDMPartialEquivalenceCheckingExamplePaperDifferentQubitOrderAndNumber) { - const auto nqubits = 4U; - auto dd = std::make_unique>(nqubits); - - qc::QuantumComputation c1{4, 1}; - c1.cswap(1, 2, 0); - c1.h(2); - c1.z(0); - c1.cswap(1, 2, 0); - - qc::QuantumComputation c2{3, 1}; - c2.x(1); - c2.ch(1, 2); - - c1.setLogicalQubitGarbage(1); - c1.setLogicalQubitGarbage(0); - c1.setLogicalQubitGarbage(3); - c1.setLogicalQubitAncillary(3); - - c2.setLogicalQubitGarbage(1); - c2.setLogicalQubitGarbage(0); - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); - EXPECT_TRUE(dd::partialEquivalenceCheck(c2, c1, dd)); -} - TEST(DDPackageTest, DDMPartialEquivalenceCheckingComputeTable) { const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); @@ -2454,56 +2404,6 @@ TEST(DDPackageTest, DDMPECMQTBenchGrover7Qubits) { buildFunctionality(&c2, *dd, false, false), 7, 7)); } -TEST(DDPackageTest, DDMZAPECMQTBenchQPE30Qubits) { - // zero ancilla partial equivalence test - auto dd = std::make_unique>(31); - - // 30 qubits - const qc::QuantumComputation c1{ - "./circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm"}; - const qc::QuantumComputation c2{"./circuits/qpeexact_indep_qiskit_30.qasm"}; - // calls zeroAncillaePartialEquivalenceCheck - // buildFunctionality is already very very slow... - // EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); - EXPECT_TRUE(true); -} - -TEST(DDPackageTest, DDMZAPECSliQEC19Qubits) { - auto dd = std::make_unique>(20); - - // full equivalence, 10 qubits - const qc::QuantumComputation c1{"./circuits/entanglement_1.qasm"}; - const qc::QuantumComputation c2{"./circuits/entanglement_2.qasm"}; - - // calls zeroAncillaePartialEquivalenceCheck - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); - - // full equivalence, 19 qubits - const qc::QuantumComputation c3{"./circuits/add6_196_1.qasm"}; - const qc::QuantumComputation c4{"./circuits/add6_196_2.qasm"}; - - // calls zeroAncillaePartialEquivalenceCheck - EXPECT_TRUE(dd::partialEquivalenceCheck(c3, c4, dd)); - - // full equivalence, 10 qubits - const qc::QuantumComputation c5{"./circuits/bv_1.qasm"}; - const qc::QuantumComputation c6{"./circuits/bv_2.qasm"}; - - // calls zeroAncillaePartialEquivalenceCheck - EXPECT_TRUE(dd::partialEquivalenceCheck(c5, c6, dd)); -} - -TEST(DDPackageTest, DDMZAPECSliQECRandomCircuit) { - // doesn't terminate - auto dd = std::make_unique>(20); - // full equivalence, 10 qubits - const qc::QuantumComputation c1{"./circuits/random_1.qasm"}; - const qc::QuantumComputation c2{"./circuits/random_2.qasm"}; - - // calls buildFunctionality for c2^-1 concatenated with c1 - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); -} - TEST(DDPackageTest, DDMPECSliQECGrover22Qubits) { // doesn't terminate auto dd = std::make_unique>(22); @@ -2536,127 +2436,3 @@ TEST(DDPackageTest, DDMPECSliQECAdd19Qubits) { // doesn't add ancillary qubits -> total number of qubits is 19 EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 8, 8)); } - -TEST(DDPackageTest, DDMPECSliQECPeriodFinding8Qubits) { - auto dd = std::make_unique>(20); - // 8 qubits, 3 data qubits - qc::QuantumComputation c1{"./circuits/period_finding_1.qasm"}; - // 8 qubits, 3 data qubits - qc::QuantumComputation c2{"./circuits/period_finding_2.qasm"}; - - // 3 measured qubits and 3 data qubits - - c2.setLogicalQubitAncillary(7); - c2.setLogicalQubitGarbage(7); - c2.setLogicalQubitAncillary(6); - c2.setLogicalQubitGarbage(6); - c2.setLogicalQubitAncillary(5); - c2.setLogicalQubitGarbage(5); - c2.setLogicalQubitAncillary(3); - c2.setLogicalQubitGarbage(3); - c2.setLogicalQubitAncillary(4); - c2.setLogicalQubitGarbage(4); - - c1.setLogicalQubitAncillary(7); - c1.setLogicalQubitGarbage(7); - c1.setLogicalQubitAncillary(6); - c1.setLogicalQubitGarbage(6); - c1.setLogicalQubitAncillary(5); - c1.setLogicalQubitGarbage(5); - c1.setLogicalQubitAncillary(3); - c1.setLogicalQubitGarbage(3); - c1.setLogicalQubitAncillary(4); - c1.setLogicalQubitGarbage(4); - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); -} - -void partialEquivalencCheckingBenchmarks( - std::unique_ptr>& dd, size_t minN, - size_t maxN, size_t reps, bool addAncilla) { - for (size_t n = minN; n < maxN; n++) { - std::chrono::microseconds totalTime{0}; - std::uint16_t totalGates{0}; - for (size_t k = 0; k < reps; k++) { - dd::Qubit d{0}; - if (addAncilla) { - d = static_cast(rand()) % static_cast(n - 1) + 1; - } else { - d = static_cast(n); - } - dd::Qubit m{0}; - if (d == 1) { - m = 1; - } else { - m = static_cast(rand()) % static_cast(d - 1) + 1; - } - auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); - - auto start = std::chrono::high_resolution_clock::now(); - bool result = dd::partialEquivalenceCheck(c1, c2, dd); - // Get ending timepoint - auto stop = std::chrono::high_resolution_clock::now(); - auto duration = - std::chrono::duration_cast(stop - start); - - EXPECT_TRUE(result); - - // std::cout << "\nnumber of qubits = " << n << "; data qubits = " << d - // << "; measured qubits = " << m - // << "; number of gates = " << c2.size() << "\n"; - // std::cout << "time: " << static_cast(duration.count()) / - // 1000000. - // << " seconds\n"; - totalTime += duration; - totalGates += static_cast(c2.size()); - } - std::cout << "\nnumber of qubits = " << n << "; number of reps = " << reps - << "; average time = " - << (static_cast(totalTime.count()) / - static_cast(reps) / 1000000.) - << " seconds; average number of gates = " - << (static_cast(totalGates) / static_cast(reps)) - << "\n"; - } -} - -TEST(DDPackageTest, DDMPECBenchmark) { - auto dd = std::make_unique>(20); - srand(55); - size_t minN = 2; - size_t maxN = 8; - size_t reps = 10; - std::cout << "Partial equivalence check\n"; - partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, true); -} - -TEST(DDPackageTest, DDMZAPECBenchmark) { - auto dd = std::make_unique>(30); - size_t minN = 3; - size_t maxN = 15; - size_t reps = 10; - std::cout << "Zero-ancilla partial equivalence check\n"; - partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, false); -} - -TEST(DDPackageTest, DDMPartialEquivalenceCheckingFindEqCircuits) { - const auto nqubits = 4U; - auto dd = std::make_unique>(nqubits); - - qc::QuantumComputation c1{2, 1}; - c1.cx(0, 1); - - qc::QuantumComputation c2{2, 1}; - c2.z(1); - c2.cx(0, 1); - - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); - - qc::QuantumComputation c3{2, 1}; - c3.cx(0, 1); - - qc::QuantumComputation c4{2, 1}; - c4.cx(0, 1); - c4.z(1); - - EXPECT_TRUE(dd::partialEquivalenceCheck(c3, c4, dd)); -} From ccd0954cc9bebe575a5fa7640bb4d459a2a40736 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Thu, 1 Feb 2024 10:58:21 +0100 Subject: [PATCH 40/51] =?UTF-8?q?=F0=9F=9A=A8=20made=20everything=20const?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/mqt-core/dd/Package.hpp | 31 ++-- include/mqt-core/dd/Verification.hpp | 24 +-- src/dd/Verification.cpp | 80 +++++----- test/algorithms/test_partial_equivalence.cpp | 31 ++-- test/dd/test_package.cpp | 152 ++++++++++--------- 5 files changed, 168 insertions(+), 150 deletions(-) diff --git a/include/mqt-core/dd/Package.hpp b/include/mqt-core/dd/Package.hpp index eda7ed0b8..ca4167731 100644 --- a/include/mqt-core/dd/Package.hpp +++ b/include/mqt-core/dd/Package.hpp @@ -2441,7 +2441,7 @@ template class Package { } // only keeps the first 2^d columns - mEdge setColumnsToZero(const mEdge& e, Qubit d) { + mEdge setColumnsToZero(const mEdge& e, const Qubit d) { if (e.isTerminal()) { return e; } @@ -2463,7 +2463,7 @@ template class Package { return f; } - mEdge keepOnlyIthRow(const mEdge& e, std::int64_t i) { + mEdge keepOnlyIthRow(const mEdge& e, const std::int64_t i) { if (e.isZeroTerminal()) { return e; } @@ -2503,7 +2503,7 @@ template class Package { into 2^g parts of size 2^m (where g = n - m). For each part the (upperOffset + i)-th row is shifted by i*2^d columns. **/ - mEdge shiftAllRowsRecursive(const mEdge& e, Qubit m, Qubit d, + mEdge shiftAllRowsRecursive(const mEdge& e, const Qubit m, const Qubit d, std::int64_t upperOffset) { if (e.isTerminal() && upperOffset == 0) { return e; @@ -2537,7 +2537,7 @@ template class Package { } std::array edges{}; - auto originalUpperOffset = upperOffset; + const auto originalUpperOffset = upperOffset; // if the current submatrix size is less than 2^m, // then the offset of the lower half needs to be adapted @@ -2594,7 +2594,7 @@ template class Package { For each part we keep only the first 2^d columns and the i-th row of each part is shifted by i*2^d columns. **/ - mEdge shiftAllRows(const mEdge& e, Qubit m, Qubit d) { + mEdge shiftAllRows(const mEdge& e, const Qubit m, const Qubit d) { if (shiftAllMatrixRowsM != m || shiftAllMatrixRowsD != d) { shiftAllMatrixRows.clear(); shiftAllMatrixRowsM = m; @@ -2604,8 +2604,8 @@ template class Package { } private: - mEdge partialEquivalenceCheckSubroutine(mEdge u, Qubit m, Qubit k, - Qubit extra) { + mEdge partialEquivalenceCheckSubroutine(mEdge u, const Qubit m, const Qubit k, + const Qubit extra) { // add extra ancillary qubits if (extra > 0) { if (u.p->v + 1U + extra > nqubits) { @@ -2613,10 +2613,13 @@ template class Package { } u = kronecker(makeIdent(extra), u); } + if (u.isTerminal()) { + return u; + } const auto n = static_cast(u.p->v + 1); - Qubit d = n - k; + const Qubit d = n - k; u = setColumnsToZero(u, d); - auto u2 = shiftAllRows(u, m, d); + const auto u2 = shiftAllRows(u, m, d); return multiply(conjugateTranspose(u), u2); } @@ -2631,7 +2634,8 @@ template class Package { @param m Number of measured qubits @return true if the two circuits u1 and u2 are partially equivalent. **/ - bool partialEquivalenceCheck(mEdge u1, mEdge u2, Qubit d, Qubit m) { + bool partialEquivalenceCheck(mEdge u1, mEdge u2, const Qubit d, + const Qubit m) { if (m == 0) { return true; } @@ -2664,8 +2668,8 @@ template class Package { } k = k + extra; - auto u1Prime = partialEquivalenceCheckSubroutine(u1, m, k, extra); - auto u2Prime = partialEquivalenceCheckSubroutine(u2, m, k, extra); + const auto u1Prime = partialEquivalenceCheckSubroutine(u1, m, k, extra); + const auto u2Prime = partialEquivalenceCheckSubroutine(u2, m, k, extra); return u1Prime == u2Prime; } @@ -2679,7 +2683,8 @@ template class Package { @param m Number of measured qubits @return true if the two circuits u1 and u2 are partially equivalent. **/ - bool zeroAncillaePartialEquivalenceCheck(mEdge u1, mEdge u2, Qubit m) { + bool zeroAncillaePartialEquivalenceCheck(const mEdge& u1, const mEdge& u2, + const Qubit m) { auto u1u2 = multiply(u1, conjugateTranspose(u2)); const Qubit n = u1.p->v + 1; std::vector garbage(n, false); diff --git a/include/mqt-core/dd/Verification.hpp b/include/mqt-core/dd/Verification.hpp index b5fc356b3..b894dca0e 100644 --- a/include/mqt-core/dd/Verification.hpp +++ b/include/mqt-core/dd/Verification.hpp @@ -14,7 +14,7 @@ namespace dd { template bool zeroAncillaePartialEquivalenceCheck( qc::QuantumComputation c1, qc::QuantumComputation c2, - std::unique_ptr>& dd) { + const std::unique_ptr>& dd) { if (c1.getNqubits() != c2.getNqubits() || c1.getGarbage() != c2.getGarbage()) { throw std::runtime_error( @@ -26,7 +26,7 @@ bool zeroAncillaePartialEquivalenceCheck( c2.emplace_back(gate); } - auto u = buildFunctionality(&c2, *dd, false, false); + const auto u = buildFunctionality(&c2, *dd, false, false); return dd->isCloseToIdentity(u, 1.0E-10, c1.getGarbage(), false); } @@ -49,23 +49,23 @@ inline Qubit getNextGarbage(Qubit n, const std::vector& garbage) { template bool partialEquivalenceCheck(qc::QuantumComputation c1, qc::QuantumComputation c2, - std::unique_ptr>& dd) { + const std::unique_ptr>& dd) { - auto d1 = c1.getNqubitsWithoutAncillae(); - auto d2 = c2.getNqubitsWithoutAncillae(); - auto m1 = c1.getNmeasuredQubits(); - auto m2 = c2.getNmeasuredQubits(); + const auto d1 = c1.getNqubitsWithoutAncillae(); + const auto d2 = c2.getNqubitsWithoutAncillae(); + const auto m1 = c1.getNmeasuredQubits(); + const auto m2 = c2.getNmeasuredQubits(); if (m1 != m2 || d1 != d2) { return false; } - auto n1 = static_cast(c1.getNqubits()); - auto n2 = static_cast(c2.getNqubits()); + const auto n1 = static_cast(c1.getNqubits()); + const auto n2 = static_cast(c2.getNqubits()); if (d1 == n1 && d2 == n2) { // no ancilla qubits return zeroAncillaePartialEquivalenceCheck(c1, c2, dd); } // add swaps in order to put the measured (= not garbage) qubits in the end - auto garbage1 = c1.getGarbage(); + const auto garbage1 = c1.getGarbage(); auto nextGarbage = getNextGarbage(0, garbage1); // find the first garbage qubit at the end @@ -82,8 +82,8 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, // partialEquivalenceCheck with dd - auto u1 = buildFunctionality(&c1, *dd, false, false); - auto u2 = buildFunctionality(&c2, *dd, false, false); + const auto u1 = buildFunctionality(&c1, *dd, false, false); + const auto u2 = buildFunctionality(&c2, *dd, false, false); return dd->partialEquivalenceCheck(u1, u2, static_cast(d1), static_cast(m1)); diff --git a/src/dd/Verification.cpp b/src/dd/Verification.cpp index 401f77ed7..981ccc736 100644 --- a/src/dd/Verification.cpp +++ b/src/dd/Verification.cpp @@ -19,17 +19,18 @@ const std::vector> PRE_GENERATED_CIRCUITS_SIZE_2_2{ {Z}, {Tdg}, {S}, {Sdg}, {X, Z}, {Z, X}}; void addPreGeneratedCircuits(QuantumComputation& circuit1, - QuantumComputation& circuit2, size_t n, - Qubit groupBeginIndex, Qubit groupSize) { + QuantumComputation& circuit2, const size_t n, + const Qubit groupBeginIndex, + const Qubit groupSize) { const auto& circuits1 = groupSize == 1 ? PRE_GENERATED_CIRCUITS_SIZE_1_1 : PRE_GENERATED_CIRCUITS_SIZE_2_1; const auto& circuits2 = groupSize == 1 ? PRE_GENERATED_CIRCUITS_SIZE_1_2 : PRE_GENERATED_CIRCUITS_SIZE_2_2; - auto nrCircuits = circuits1.size(); - auto randomIndex = static_cast(rand()) % nrCircuits; - auto x1 = circuits1[randomIndex]; - auto x2 = circuits2[randomIndex]; + const auto nrCircuits = circuits1.size(); + const auto randomIndex = static_cast(rand()) % nrCircuits; + const auto x1 = circuits1[randomIndex]; + const auto x2 = circuits2[randomIndex]; for (auto gateType : x1) { if (gateType == X) { // add CNOT circuit1.emplace_back(n, groupBeginIndex, @@ -48,8 +49,8 @@ void addPreGeneratedCircuits(QuantumComputation& circuit1, } } -void addDecomposedCcxGate(QuantumComputation& circuit, Qubit control1, - Qubit control2, Qubit target) { +void addDecomposedCcxGate(QuantumComputation& circuit, const Qubit control1, + const Qubit control2, const Qubit target) { circuit.h(target); circuit.cx(control1, target); circuit.tdg(target); @@ -68,7 +69,8 @@ void addDecomposedCcxGate(QuantumComputation& circuit, Qubit control1, } void addStandardOperationToCircuit(QuantumComputation& circuit, - StandardOperation op, bool decomposeCcx) { + const StandardOperation& op, + const bool decomposeCcx) { std::vector controls{}; for (auto c : op.getControls()) { // the controls are at most 2 controls.push_back(static_cast(c.qubit)); @@ -86,27 +88,31 @@ void addStandardOperationToCircuit(QuantumComputation& circuit, } } -std::vector fiveDiffferentRandomNumbers(Qubit min, Qubit max) { +std::vector fiveDiffferentRandomNumbers(const Qubit min, + const Qubit max) { std::vector numbers; for (Qubit i = min; i < max; i++) { numbers.push_back(i); } - unsigned seed = 42; + const unsigned seed = 42; std::shuffle(numbers.begin(), numbers.end(), std::default_random_engine(seed)); - auto lengthOutputVector = std::min(5UL, numbers.size()); + const int64_t lengthOutputVector{ + static_cast(std::min(5UL, numbers.size()))}; + std::vector outputVector(numbers.begin(), - numbers.begin() + - static_cast(lengthOutputVector)); + numbers.begin() + lengthOutputVector); return outputVector; } -StandardOperation convertToStandardOperation( - size_t n, size_t nrQubits, OpType randomOpType, Qubit randomTarget1, - Qubit randomTarget2, fp randomParameter1, fp randomParameter2, - fp randomParameter3, const Controls& randomControls) { +StandardOperation +convertToStandardOperation(const size_t n, const size_t nrQubits, + const OpType randomOpType, const Qubit randomTarget1, + const Qubit randomTarget2, const fp randomParameter1, + const fp randomParameter2, const fp randomParameter3, + const Controls& randomControls) { switch (randomOpType) { // two targets and zero parameters @@ -181,13 +187,14 @@ StandardOperation convertToStandardOperation( return {n, randomTarget1, qc::I}; } -StandardOperation makeRandomStandardOperation(size_t n, Qubit nrQubits, - Qubit min) { - auto randomNumbers = fiveDiffferentRandomNumbers(min, min + nrQubits); +StandardOperation makeRandomStandardOperation(const size_t n, + const Qubit nrQubits, + const Qubit min) { + const auto randomNumbers = fiveDiffferentRandomNumbers(min, min + nrQubits); // choose one of the non-compound operations, but not "None", and also // not GPhase or I or Barrier auto randomOpType = static_cast(rand() % (XXplusYY - H) + H); - Qubit randomTarget1 = randomNumbers[0]; + const Qubit randomTarget1 = randomNumbers[0]; Qubit randomTarget2{min}; if (randomNumbers.size() > 1) { randomTarget2 = randomNumbers[1]; @@ -219,7 +226,7 @@ StandardOperation makeRandomStandardOperation(size_t n, Qubit nrQubits, } std::pair -generateRandomBenchmark(size_t n, Qubit d, Qubit m) { +generateRandomBenchmark(const size_t n, const Qubit d, const Qubit m) { if (d > n) { throw std::runtime_error("The number of data or measured qubits can't be " "bigger than the total number of qubits. n = " + @@ -242,8 +249,8 @@ generateRandomBenchmark(size_t n, Qubit d, Qubit m) { // generate a random subcircuit with d qubits and 3*d gates to apply // on both circuits, but all the Toffoli gates in circuit2 are decomposed - for (Qubit i = 0U; i < 3 * d; i++) { - auto op = makeRandomStandardOperation(n, d, 0); + for (Qubit i = 0U; static_cast(i) < 3 * d; i++) { + const auto op = makeRandomStandardOperation(n, d, 0); addStandardOperationToCircuit(circuit1, op, false); addStandardOperationToCircuit(circuit2, op, true); } @@ -275,13 +282,13 @@ generateRandomBenchmark(size_t n, Qubit d, Qubit m) { // 4) Arbitrary gates // arbitrary gates are added to not measured qubits if (d > m) { - Qubit notMQubits = d - m; + const Qubit notMQubits = d - m; for (Qubit i = 0U; i < notMQubits; i++) { - auto op = makeRandomStandardOperation(n, notMQubits, m); + const auto op = makeRandomStandardOperation(n, notMQubits, m); addStandardOperationToCircuit(circuit1, op, false); } for (Qubit i = 0U; i < notMQubits; i++) { - auto op = makeRandomStandardOperation(n, notMQubits, m); + const auto op = makeRandomStandardOperation(n, notMQubits, m); addStandardOperationToCircuit(circuit2, op, false); } } @@ -292,13 +299,16 @@ generateRandomBenchmark(size_t n, Qubit d, Qubit m) { } // 5) CNOT gates (if there are ancilla qubits) - Qubit currentDataQubit = 0; - for (Qubit currentAncillaQubit = d; - currentAncillaQubit < static_cast(n); currentAncillaQubit++) { - auto nextDataQubit = static_cast((currentDataQubit + 1) % d); - circuit1.cx(currentAncillaQubit, currentDataQubit); - circuit2.cx(currentAncillaQubit, nextDataQubit); - currentDataQubit = nextDataQubit; + + if (d > 0) { + Qubit currentDataQubit = 0; + for (Qubit currentAncillaQubit = d; + currentAncillaQubit < static_cast(n); currentAncillaQubit++) { + auto nextDataQubit = static_cast((currentDataQubit + 1) % d); + circuit1.cx(currentAncillaQubit, currentDataQubit); + circuit2.cx(currentAncillaQubit, nextDataQubit); + currentDataQubit = nextDataQubit; + } } for (Qubit i = d; i < static_cast(n); i++) { diff --git a/test/algorithms/test_partial_equivalence.cpp b/test/algorithms/test_partial_equivalence.cpp index 5f23d0115..1b6dc96ef 100644 --- a/test/algorithms/test_partial_equivalence.cpp +++ b/test/algorithms/test_partial_equivalence.cpp @@ -141,8 +141,9 @@ TEST(PartialEquivalence, DDMPECSliQECPeriodFinding8Qubits) { } void partialEquivalencCheckingBenchmarks( - std::unique_ptr>& dd, size_t minN, - size_t maxN, size_t reps, bool addAncilla) { + const std::unique_ptr>& dd, + const size_t minN, const size_t maxN, const size_t reps, + const bool addAncilla) { for (size_t n = minN; n < maxN; n++) { std::chrono::microseconds totalTime{0}; std::uint16_t totalGates{0}; @@ -159,13 +160,13 @@ void partialEquivalencCheckingBenchmarks( } else { m = static_cast(rand()) % static_cast(d - 1) + 1; } - auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); + const auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); - auto start = std::chrono::high_resolution_clock::now(); - bool result = dd::partialEquivalenceCheck(c1, c2, dd); + const auto start = std::chrono::high_resolution_clock::now(); + const bool result = dd::partialEquivalenceCheck(c1, c2, dd); // Get ending timepoint - auto stop = std::chrono::high_resolution_clock::now(); - auto duration = + const auto stop = std::chrono::high_resolution_clock::now(); + const auto duration = std::chrono::duration_cast(stop - start); EXPECT_TRUE(result); @@ -190,20 +191,20 @@ void partialEquivalencCheckingBenchmarks( } TEST(PartialEquivalence, DDMPECBenchmark) { - auto dd = std::make_unique>(20); + const auto dd = std::make_unique>(20); srand(55); - size_t minN = 2; - size_t maxN = 8; - size_t reps = 10; + const size_t minN = 2; + const size_t maxN = 8; + const size_t reps = 10; std::cout << "Partial equivalence check\n"; partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, true); } TEST(PartialEquivalence, DDMZAPECBenchmark) { - auto dd = std::make_unique>(30); - size_t minN = 3; - size_t maxN = 15; - size_t reps = 10; + const auto dd = std::make_unique>(30); + const size_t minN = 3; + const size_t maxN = 15; + const size_t reps = 10; std::cout << "Zero-ancilla partial equivalence check\n"; partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, false); } diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 79fd0cdb3..1b881d8fc 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2261,7 +2261,7 @@ TEST(DDPackageTest, DDStatistics) { } TEST(DDPackageTest, ReduceAncillaeRegression) { - auto dd = std::make_unique>(2); + const auto dd = std::make_unique>(2); const auto inputMatrix = dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; auto inputDD = dd->makeDDFromMatrix(inputMatrix); @@ -2277,10 +2277,10 @@ TEST(DDPackageTest, ReduceAncillaeRegression) { TEST(DDPackageTest, DDMShiftAllRows) { const auto nqubits = 2U; - auto dd = std::make_unique>(nqubits); + const auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, 0, 0, 0}, {-1, 0, 0, 0}, {-1, 0, 0, 0}, {1, 0, 0, 0}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); + const auto inputDD = dd->makeDDFromMatrix(inputMatrix); const auto outputMatrix = dd->shiftAllRows(inputDD, 1, 0); const auto expectedMatrix = dd::CMat{{1, 0, 0, 0}, {0, -1, 0, 0}, {-1, 0, 0, 0}, {0, 1, 0, 0}}; @@ -2293,13 +2293,13 @@ TEST(DDPackageTest, DDMShiftAllRows) { TEST(DDPackageTest, DDMShiftAllRows3QubitsPart0) { const auto nqubits = 3U; - auto dd = std::make_unique>(nqubits); + const auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, 3, 3, 3, 3, 3, 3, 3}, {-1, 3, 3, 3, 3, 3, 3, 3}, {-1, 3, 3, 3, 3, 3, 3, 3}, {1, 3, 3, 3, 3, 3, 3, 3}, {1, 3, 3, 3, 3, 3, 3, 3}, {-1, 3, 3, 3, 3, 3, 3, 3}, {-1, 3, 3, 3, 3, 3, 3, 3}, {1, 3, 3, 3, 3, 3, 3, 3}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); + const auto inputDD = dd->makeDDFromMatrix(inputMatrix); const auto outputMatrix = dd->shiftAllRows(inputDD, 2, 0); const auto expectedMatrix = @@ -2330,7 +2330,7 @@ TEST(DDPackageTest, DDMShiftAllRows3QubitsPart0) { {-1, 1, 3, 3, 3, 3, 3, 3}, {1, 1, 3, 3, 3, 3, 3, 3}, {1, 1, 3, 3, 3, 3, 3, 3}, {-1, 1, 3, 3, 3, 3, 3, 3}, {-1, 1, 3, 3, 3, 3, 3, 3}, {1, 1, 3, 3, 3, 3, 3, 3}}; - auto inputDD2 = dd->makeDDFromMatrix(inputMatrix2); + const auto inputDD2 = dd->makeDDFromMatrix(inputMatrix2); const auto outputMatrix3 = dd->shiftAllRows(inputDD2, 1, 1); const auto expectedMatrix3 = dd::CMat{{1, 1, 0, 0, 0, 0, 0, 0}, {0, 0, -1, 1, 0, 0, 0, 0}, @@ -2342,13 +2342,13 @@ TEST(DDPackageTest, DDMShiftAllRows3QubitsPart0) { TEST(DDPackageTest, DDMShiftAllRows3QubitsPart1) { const size_t nqubits = 3U; - auto dd = std::make_unique>(nqubits); + const auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); + const auto inputDD = dd->makeDDFromMatrix(inputMatrix); const dd::Qubit m = 2; const dd::Qubit d = 1; const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); @@ -2366,13 +2366,13 @@ TEST(DDPackageTest, DDMShiftAllRows3QubitsPart1) { TEST(DDPackageTest, DDMShiftAllRows3QubitsPart2) { const size_t nqubits = 3U; - auto dd = std::make_unique>(nqubits); + const auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); + const auto inputDD = dd->makeDDFromMatrix(inputMatrix); const dd::Qubit m = 1; const dd::Qubit d = 2; const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); @@ -2391,17 +2391,17 @@ TEST(DDPackageTest, DDMShiftAllRows3QubitsPart2) { TEST(DDPackageTest, DDMShiftAllRows3QubitsPart3) { const size_t nqubits = 3U; - auto dd = std::make_unique>(nqubits); + const auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); + const auto inputDD = dd->makeDDFromMatrix(inputMatrix); const dd::Qubit m = 1; const dd::Qubit d = 1; const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); - auto outputMatrixMatrix = outputMatrix.getMatrix(); + const auto outputMatrixMatrix = outputMatrix.getMatrix(); const auto expectedOutputMatrix = dd->makeDDFromMatrix(dd::CMat{{1, 2, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 2, 0, 0, 0, 0}, @@ -2416,7 +2416,7 @@ TEST(DDPackageTest, DDMShiftAllRows3QubitsPart3) { TEST(DDPackageTest, DDMShiftAllRows5Qubits) { const auto nqubits = 5U; - auto dd = std::make_unique>(nqubits); + const auto dd = std::make_unique>(nqubits); const std::uint64_t n = 1 << nqubits; std::vector> row10(n, 0); std::vector> row01(n, 1); @@ -2426,7 +2426,7 @@ TEST(DDPackageTest, DDMShiftAllRows5Qubits) { } // inputMatrix = [1, 1, ... 0, 0 ...]...[1, 1, ... 0, 0...]... const dd::CMat inputMatrix(n, row10); - auto inputDD = dd->makeDDFromMatrix(inputMatrix); + const auto inputDD = dd->makeDDFromMatrix(inputMatrix); const auto outputMatrix = dd->shiftAllRows(inputDD, 1, nqubits - 1); dd::CMat expectedMatrix(n, row01); @@ -2439,19 +2439,19 @@ TEST(DDPackageTest, DDMShiftAllRows5Qubits) { TEST(DDPackageTest, DDMPartialEquivalenceCheckingTrivialEquivalence) { const auto nqubits = 2U; - auto dd = std::make_unique>(nqubits); + const auto dd = std::make_unique>(nqubits); const auto inputMatrix = dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; - auto inputDD = dd->makeDDFromMatrix(inputMatrix); + const auto inputDD = dd->makeDDFromMatrix(inputMatrix); EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 1, 1)); EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 2, 1)); EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 1, 2)); EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 2, 2)); - auto hGate = dd->makeGateDD(dd::H_MAT, 2, 1); - auto cxGate = dd->makeGateDD(dd::X_MAT, 2, 1_pc, 0); - auto bellMatrix = dd->multiply(cxGate, hGate); + const auto hGate = dd->makeGateDD(dd::H_MAT, 2, 1); + const auto cxGate = dd->makeGateDD(dd::X_MAT, 2, 1_pc, 0); + const auto bellMatrix = dd->multiply(cxGate, hGate); EXPECT_FALSE(dd->partialEquivalenceCheck(inputDD, bellMatrix, 1, 1)); } @@ -2460,91 +2460,92 @@ TEST(DDPackageTest, DDMPartialEquivalenceChecking) { auto dd = std::make_unique>(nqubits); // only the second qubit has differing gates in the two circuits, // therefore they should be equivalent if we only measure the first qubit - auto hGate = dd->makeGateDD(dd::H_MAT, 3, 1); - auto xGate = dd->makeGateDD(dd::X_MAT, 3, 1); - auto circuit1 = dd->multiply(xGate, hGate); - auto circuit2 = dd->makeIdent(3); + const auto hGate = dd->makeGateDD(dd::H_MAT, 3, 1); + const auto xGate = dd->makeGateDD(dd::X_MAT, 3, 1); + const auto circuit1 = dd->multiply(xGate, hGate); + const auto circuit2 = dd->makeIdent(3); EXPECT_TRUE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); } TEST(DDPackageTest, DDMPartialEquivalenceCheckingTestNotEquivalent) { const auto nqubits = 2U; - auto dd = std::make_unique>(nqubits); + const auto dd = std::make_unique>(nqubits); // the first qubit has differing gates in the two circuits, // therefore they should not be equivalent if we only measure the first qubit - auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 0); - auto circuit1 = dd->multiply(xGate, hGate); - auto circuit2 = dd->makeIdent(2); + const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 0); + const auto circuit1 = dd->multiply(xGate, hGate); + const auto circuit2 = dd->makeIdent(2); EXPECT_FALSE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(circuit1, circuit2, 1)); } TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { const auto nqubits = 3U; - auto dd = std::make_unique>(nqubits); - auto controlledSwapGate = + const auto dd = std::make_unique>(nqubits); + const auto controlledSwapGate = dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 0, 2); - auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); - auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); - auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); + const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); + const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + const auto controlledHGate = + dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - auto c1 = dd->multiply( + const auto c1 = dd->multiply( controlledSwapGate, dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - auto c2 = dd->multiply(controlledHGate, xGate); + const auto c2 = dd->multiply(controlledHGate, xGate); EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); } TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncillae) { const auto nqubits = 3U; - auto dd = std::make_unique>(nqubits); - auto controlledSwapGate = + const auto dd = std::make_unique>(nqubits); + const auto controlledSwapGate = dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 0, 2); - auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); - auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); - auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); + const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); + const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + const auto controlledHGate = + dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - auto c1 = dd->multiply( + const auto c1 = dd->multiply( controlledSwapGate, dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - auto c2 = dd->multiply(controlledHGate, xGate); + const auto c2 = dd->multiply(controlledHGate, xGate); EXPECT_TRUE(dd->zeroAncillaePartialEquivalenceCheck(c1, c2, 1)); EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(c1, c2, 2)); - auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 2); - auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 0); - auto controlledHGate2 = + const auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 2); + const auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 0); + const auto controlledHGate2 = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - auto c3 = dd->multiply( + const auto c3 = dd->multiply( controlledSwapGate, dd->multiply(hGate2, dd->multiply(zGate2, controlledSwapGate))); - auto c4 = dd->multiply(controlledHGate2, xGate); + const auto c4 = dd->multiply(controlledHGate2, xGate); EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(c3, c4, 1)); } TEST(DDPackageTest, DDMPartialEquivalenceWithDifferentNumberOfQubits) { - auto dd = std::make_unique>(3); - auto controlledSwapGate = + const auto dd = std::make_unique>(3); + const auto controlledSwapGate = dd->makeTwoQubitGateDD(dd::SWAP_MAT, 3, qc::Controls{1}, 0, 2); - auto hGate = dd->makeGateDD(dd::H_MAT, 3, 0); - auto zGate = dd->makeGateDD(dd::Z_MAT, 3, 2); - auto xGate = dd->makeGateDD(dd::X_MAT, 2, 1); - auto controlledHGate = dd->makeGateDD(dd::H_MAT, 2, qc::Controls{1}, 0); + const auto hGate = dd->makeGateDD(dd::H_MAT, 3, 0); + const auto zGate = dd->makeGateDD(dd::Z_MAT, 3, 2); + const auto xGate = dd->makeGateDD(dd::X_MAT, 2, 1); + const auto controlledHGate = dd->makeGateDD(dd::H_MAT, 2, qc::Controls{1}, 0); - auto c1 = dd->multiply( + const auto c1 = dd->multiply( controlledSwapGate, dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - auto c2 = dd->multiply(controlledHGate, xGate); + const auto c2 = dd->multiply(controlledHGate, xGate); - // EXPECT_TRUE(dd->zeroAncillaePartialEquivalenceCheck(c1, c2, 1)); EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); EXPECT_FALSE(dd->partialEquivalenceCheck(c2, c1, 3, 3)); EXPECT_FALSE(dd->partialEquivalenceCheck(c2, dd::mEdge::zero(), 2, 1)); @@ -2558,18 +2559,19 @@ TEST(DDPackageTest, DDMPartialEquivalenceWithDifferentNumberOfQubits) { TEST(DDPackageTest, DDMPartialEquivalenceCheckingComputeTable) { const auto nqubits = 3U; - auto dd = std::make_unique>(nqubits); - auto controlledSwapGate = + const auto dd = std::make_unique>(nqubits); + const auto controlledSwapGate = dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 2, 0); - auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); - auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); - auto controlledHGate = dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); + const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); + const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + const auto controlledHGate = + dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - auto c1 = dd->multiply( + const auto c1 = dd->multiply( controlledSwapGate, dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - auto c2 = dd->multiply(controlledHGate, xGate); + const auto c2 = dd->multiply(controlledHGate, xGate); EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); @@ -2579,7 +2581,7 @@ TEST(DDPackageTest, DDMPartialEquivalenceCheckingComputeTable) { } TEST(DDPackageTest, DDMPECMQTBenchGrover3Qubits) { - auto dd = std::make_unique>(7); + const auto dd = std::make_unique>(7); const qc::QuantumComputation c1{ "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm"}; @@ -2593,7 +2595,7 @@ TEST(DDPackageTest, DDMPECMQTBenchGrover3Qubits) { } TEST(DDPackageTest, DDMPECMQTBenchGrover7Qubits) { - auto dd = std::make_unique>(7); + const auto dd = std::make_unique>(7); const qc::QuantumComputation c1{ "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm"}; @@ -2608,7 +2610,7 @@ TEST(DDPackageTest, DDMPECMQTBenchGrover7Qubits) { TEST(DDPackageTest, DDMPECSliQECGrover22Qubits) { // doesn't terminate - auto dd = std::make_unique>(22); + const auto dd = std::make_unique>(22); const qc::QuantumComputation c1{ "./circuits/Grover_1.qasm"}; // 11 qubits, 11 data qubits @@ -2616,15 +2618,15 @@ TEST(DDPackageTest, DDMPECSliQECGrover22Qubits) { "./circuits/Grover_2.qasm"}; // 12 qubits, 11 data qubits // 11 measured qubits and 11 data qubits - auto c1Dd = buildFunctionality(&c1, *dd, false, false); - auto c2Dd = buildFunctionality(&c2, *dd, false, false); + const auto c1Dd = buildFunctionality(&c1, *dd, false, false); + const auto c2Dd = buildFunctionality(&c2, *dd, false, false); // adds 10 ancillary qubits -> total number of qubits is 22 EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 11, 11)); } TEST(DDPackageTest, DDMPECSliQECAdd19Qubits) { // doesn't terminate - auto dd = std::make_unique>(20); + const auto dd = std::make_unique>(20); // full equivalence, 19 qubits // but this test uses algorithm for partial equivalence, not the "zero @@ -2633,8 +2635,8 @@ TEST(DDPackageTest, DDMPECSliQECAdd19Qubits) { const qc::QuantumComputation c2{"./circuits/add6_196_2.qasm"}; // just for benchmarking reasons, we only measure 8 qubits - auto c1Dd = buildFunctionality(&c1, *dd, false, false); - auto c2Dd = buildFunctionality(&c2, *dd, false, false); + const auto c1Dd = buildFunctionality(&c1, *dd, false, false); + const auto c2Dd = buildFunctionality(&c2, *dd, false, false); // doesn't add ancillary qubits -> total number of qubits is 19 EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 8, 8)); } From 7e2e9cc4296ecab827bf9ac8e389a64a4646472b Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Thu, 1 Feb 2024 11:13:37 +0100 Subject: [PATCH 41/51] =?UTF-8?q?=E2=9C=85=20added=20test=20for=20invalid?= =?UTF-8?q?=20argument?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/mqt-core/dd/Verification.hpp | 2 +- test/algorithms/test_partial_equivalence.cpp | 25 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/include/mqt-core/dd/Verification.hpp b/include/mqt-core/dd/Verification.hpp index b894dca0e..a12afaeeb 100644 --- a/include/mqt-core/dd/Verification.hpp +++ b/include/mqt-core/dd/Verification.hpp @@ -17,7 +17,7 @@ bool zeroAncillaePartialEquivalenceCheck( const std::unique_ptr>& dd) { if (c1.getNqubits() != c2.getNqubits() || c1.getGarbage() != c2.getGarbage()) { - throw std::runtime_error( + throw std::invalid_argument( "The circuits need to have the same number of qubits and the same " "permutation of input and output qubits."); } diff --git a/test/algorithms/test_partial_equivalence.cpp b/test/algorithms/test_partial_equivalence.cpp index 1b6dc96ef..ed479cbec 100644 --- a/test/algorithms/test_partial_equivalence.cpp +++ b/test/algorithms/test_partial_equivalence.cpp @@ -208,3 +208,28 @@ TEST(PartialEquivalence, DDMZAPECBenchmark) { std::cout << "Zero-ancilla partial equivalence check\n"; partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, false); } + +TEST(PartialEquivalence, DDMInvalidInput) { + const auto dd = std::make_unique>(30); + + // the circuits don't have the same number of measured qubits + qc::QuantumComputation c1{4, 1}; + c1.x(1); + + qc::QuantumComputation c2{4, 1}; + c2.x(1); + + c1.setLogicalQubitGarbage(1); + c1.setLogicalQubitGarbage(0); + c1.setLogicalQubitGarbage(3); + + c2.setLogicalQubitGarbage(1); + c2.setLogicalQubitGarbage(0); + + EXPECT_FALSE(dd::partialEquivalenceCheck(c1, c2, dd)); + + // now they have the same number of measured qubits but a different + // permutation of garbage qubits + c2.setLogicalQubitGarbage(2); + EXPECT_THROW(dd::partialEquivalenceCheck(c1, c2, dd), std::invalid_argument); +} From d9d99222e02eb72900f996e608e52664520be308 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Thu, 1 Feb 2024 13:25:13 +0100 Subject: [PATCH 42/51] =?UTF-8?q?=F0=9F=8E=A8=20changed=20some=20names=20o?= =?UTF-8?q?f=20the=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/algorithms/test_partial_equivalence.cpp | 237 +- test/circuits/qpeexact_indep_qiskit_30.qasm | 517 ---- ...eexact_nativegates_ibm_qiskit_opt0_30.qasm | 2398 ----------------- test/dd/test_package.cpp | 216 +- 4 files changed, 217 insertions(+), 3151 deletions(-) delete mode 100644 test/circuits/qpeexact_indep_qiskit_30.qasm delete mode 100644 test/circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm diff --git a/test/algorithms/test_partial_equivalence.cpp b/test/algorithms/test_partial_equivalence.cpp index ed479cbec..fc8a4b579 100644 --- a/test/algorithms/test_partial_equivalence.cpp +++ b/test/algorithms/test_partial_equivalence.cpp @@ -8,8 +8,209 @@ using namespace qc::literals; -TEST(PartialEquivalence, - DDMPartialEquivalenceCheckingExamplePaperDifferentQubitOrder) { +TEST(PartialEquivalenceTest, TrivialEquivalence) { + const auto nqubits = 2U; + const auto dd = std::make_unique>(nqubits); + const auto inputMatrix = + dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; + const auto inputDD = dd->makeDDFromMatrix(inputMatrix); + + EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 1, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 2, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 1, 2)); + EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 2, 2)); + + const auto hGate = dd->makeGateDD(dd::H_MAT, 2, 1); + const auto cxGate = dd->makeGateDD(dd::X_MAT, 2, 1_pc, 0); + const auto bellMatrix = dd->multiply(cxGate, hGate); + EXPECT_FALSE(dd->partialEquivalenceCheck(inputDD, bellMatrix, 1, 1)); +} + +TEST(PartialEquivalenceTest, BasicPartialEquivalenceChecking) { + const auto nqubits = 3U; + auto dd = std::make_unique>(nqubits); + // only the second qubit has differing gates in the two circuits, + // therefore they should be equivalent if we only measure the first qubit + const auto hGate = dd->makeGateDD(dd::H_MAT, 3, 1); + const auto xGate = dd->makeGateDD(dd::X_MAT, 3, 1); + const auto circuit1 = dd->multiply(xGate, hGate); + const auto circuit2 = dd->makeIdent(3); + + EXPECT_TRUE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); +} + +TEST(PartialEquivalenceTest, NotEquivalent) { + const auto nqubits = 2U; + const auto dd = std::make_unique>(nqubits); + // the first qubit has differing gates in the two circuits, + // therefore they should not be equivalent if we only measure the first qubit + const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 0); + const auto circuit1 = dd->multiply(xGate, hGate); + const auto circuit2 = dd->makeIdent(2); + EXPECT_FALSE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); + EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(circuit1, circuit2, 1)); +} + +TEST(PartialEquivalenceTest, ExamplePaper) { + const auto nqubits = 3U; + const auto dd = std::make_unique>(nqubits); + const auto controlledSwapGate = + dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 0, 2); + const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); + const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + const auto controlledHGate = + dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); + + const auto c1 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); + const auto c2 = dd->multiply(controlledHGate, xGate); + + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); +} + +TEST(PartialEquivalenceTest, ExamplePaperZeroAncillae) { + const auto nqubits = 3U; + const auto dd = std::make_unique>(nqubits); + const auto controlledSwapGate = + dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 0, 2); + const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); + const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + const auto controlledHGate = + dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); + + const auto c1 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); + const auto c2 = dd->multiply(controlledHGate, xGate); + + EXPECT_TRUE(dd->zeroAncillaePartialEquivalenceCheck(c1, c2, 1)); + EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(c1, c2, 2)); + + const auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 2); + const auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 0); + const auto controlledHGate2 = + dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); + + const auto c3 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate2, dd->multiply(zGate2, controlledSwapGate))); + const auto c4 = dd->multiply(controlledHGate2, xGate); + + EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(c3, c4, 1)); +} + +TEST(PartialEquivalenceTest, DifferentNumberOfQubits) { + const auto dd = std::make_unique>(3); + const auto controlledSwapGate = + dd->makeTwoQubitGateDD(dd::SWAP_MAT, 3, qc::Controls{1}, 0, 2); + const auto hGate = dd->makeGateDD(dd::H_MAT, 3, 0); + const auto zGate = dd->makeGateDD(dd::Z_MAT, 3, 2); + const auto xGate = dd->makeGateDD(dd::X_MAT, 2, 1); + const auto controlledHGate = dd->makeGateDD(dd::H_MAT, 2, qc::Controls{1}, 0); + + const auto c1 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); + const auto c2 = dd->multiply(controlledHGate, xGate); + + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); + EXPECT_FALSE(dd->partialEquivalenceCheck(c2, c1, 3, 3)); + EXPECT_FALSE(dd->partialEquivalenceCheck(c2, dd::mEdge::zero(), 2, 1)); + EXPECT_FALSE(dd->partialEquivalenceCheck(c2, dd::mEdge::one(), 2, 1)); + EXPECT_FALSE(dd->partialEquivalenceCheck(dd::mEdge::one(), c1, 2, 1)); + EXPECT_TRUE( + dd->partialEquivalenceCheck(dd::mEdge::one(), dd::mEdge::one(), 0, 1)); + EXPECT_TRUE( + dd->partialEquivalenceCheck(dd::mEdge::one(), dd::mEdge::one(), 0, 0)); +} + +TEST(PartialEquivalenceTest, ComputeTableTest) { + const auto nqubits = 3U; + const auto dd = std::make_unique>(nqubits); + const auto controlledSwapGate = + dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 2, 0); + const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); + const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + const auto controlledHGate = + dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); + + const auto c1 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); + const auto c2 = dd->multiply(controlledHGate, xGate); + + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); + EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); +} + +TEST(PartialEquivalenceTest, MQTBenchGrover3Qubits) { + const auto dd = std::make_unique>(7); + + const qc::QuantumComputation c1{ + "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm"}; + const qc::QuantumComputation c2{ + "./circuits/grover-noancilla_indep_qiskit_3.qasm"}; + + // 3 measured qubits and 3 data qubits, full equivalence + EXPECT_TRUE(dd->partialEquivalenceCheck( + buildFunctionality(&c1, *dd, false, false), + buildFunctionality(&c2, *dd, false, false), 3, 3)); +} + +TEST(PartialEquivalenceTest, MQTBenchGrover7Qubits) { + const auto dd = std::make_unique>(7); + + const qc::QuantumComputation c1{ + "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm"}; + const qc::QuantumComputation c2{ + "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm"}; + + // 7 measured qubits and 7 data qubits, full equivalence + EXPECT_TRUE(dd->partialEquivalenceCheck( + buildFunctionality(&c1, *dd, false, false), + buildFunctionality(&c2, *dd, false, false), 7, 7)); +} + +TEST(PartialEquivalenceTest, SliQECGrover22Qubits) { + const auto dd = std::make_unique>(22); + + const qc::QuantumComputation c1{ + "./circuits/Grover_1.qasm"}; // 11 qubits, 11 data qubits + const qc::QuantumComputation c2{ + "./circuits/Grover_2.qasm"}; // 12 qubits, 11 data qubits + + // 11 measured qubits and 11 data qubits + const auto c1Dd = buildFunctionality(&c1, *dd, false, false); + const auto c2Dd = buildFunctionality(&c2, *dd, false, false); + // adds 10 ancillary qubits -> total number of qubits is 22 + EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 11, 11)); +} + +TEST(PartialEquivalenceTest, SliQECAdd19Qubits) { + const auto dd = std::make_unique>(20); + + // full equivalence, 19 qubits + // but this test uses algorithm for partial equivalence, not the "zero + // ancillae" version + const qc::QuantumComputation c1{"./circuits/add6_196_1.qasm"}; + const qc::QuantumComputation c2{"./circuits/add6_196_2.qasm"}; + + // just for benchmarking reasons, we only measure 8 qubits + const auto c1Dd = buildFunctionality(&c1, *dd, false, false); + const auto c2Dd = buildFunctionality(&c2, *dd, false, false); + // doesn't add ancillary qubits -> total number of qubits is 19 + EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 8, 8)); +} + +TEST(PartialEquivalenceTest, ExamplePaperDifferentQubitOrder) { const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); @@ -31,8 +232,7 @@ TEST(PartialEquivalence, EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); } -TEST(PartialEquivalence, - DDMPartialEquivalenceCheckingExamplePaperDifferentQubitOrderAndNumber) { +TEST(PartialEquivalenceTest, ExamplePaperDifferentQubitOrderAndNumber) { const auto nqubits = 4U; auto dd = std::make_unique>(nqubits); @@ -57,21 +257,7 @@ TEST(PartialEquivalence, EXPECT_TRUE(dd::partialEquivalenceCheck(c2, c1, dd)); } -TEST(PartialEquivalence, DDMZAPECMQTBenchQPE30Qubits) { - // zero ancilla partial equivalence test - auto dd = std::make_unique>(31); - - // 30 qubits - const qc::QuantumComputation c1{ - "./circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm"}; - const qc::QuantumComputation c2{"./circuits/qpeexact_indep_qiskit_30.qasm"}; - // calls zeroAncillaePartialEquivalenceCheck - // buildFunctionality is already very very slow... - // EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); - EXPECT_TRUE(true); -} - -TEST(PartialEquivalence, DDMZAPECSliQEC19Qubits) { +TEST(PartialEquivalenceTest, ZeroAncillaSliQEC19Qubits) { auto dd = std::make_unique>(20); // full equivalence, 10 qubits @@ -96,18 +282,17 @@ TEST(PartialEquivalence, DDMZAPECSliQEC19Qubits) { EXPECT_TRUE(dd::partialEquivalenceCheck(c5, c6, dd)); } -TEST(PartialEquivalence, DDMZAPECSliQECRandomCircuit) { - // doesn't terminate +TEST(PartialEquivalenceTest, ZeroAncillaSliQECRandomCircuit) { auto dd = std::make_unique>(20); // full equivalence, 10 qubits const qc::QuantumComputation c1{"./circuits/random_1.qasm"}; const qc::QuantumComputation c2{"./circuits/random_2.qasm"}; - // calls buildFunctionality for c2^-1 concatenated with c1 + // calls buildFunctionality for c2^(-1) concatenated with c1 EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); } -TEST(PartialEquivalence, DDMPECSliQECPeriodFinding8Qubits) { +TEST(PartialEquivalenceTest, SliQECPeriodFinding8Qubits) { auto dd = std::make_unique>(20); // 8 qubits, 3 data qubits qc::QuantumComputation c1{"./circuits/period_finding_1.qasm"}; @@ -190,7 +375,7 @@ void partialEquivalencCheckingBenchmarks( } } -TEST(PartialEquivalence, DDMPECBenchmark) { +TEST(PartialEquivalenceTest, Benchmark) { const auto dd = std::make_unique>(20); srand(55); const size_t minN = 2; @@ -200,7 +385,7 @@ TEST(PartialEquivalence, DDMPECBenchmark) { partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, true); } -TEST(PartialEquivalence, DDMZAPECBenchmark) { +TEST(PartialEquivalenceTest, ZeroAncillaBenchmark) { const auto dd = std::make_unique>(30); const size_t minN = 3; const size_t maxN = 15; @@ -209,7 +394,7 @@ TEST(PartialEquivalence, DDMZAPECBenchmark) { partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, false); } -TEST(PartialEquivalence, DDMInvalidInput) { +TEST(PartialEquivalenceTest, InvalidInput) { const auto dd = std::make_unique>(30); // the circuits don't have the same number of measured qubits diff --git a/test/circuits/qpeexact_indep_qiskit_30.qasm b/test/circuits/qpeexact_indep_qiskit_30.qasm deleted file mode 100644 index 615f20855..000000000 --- a/test/circuits/qpeexact_indep_qiskit_30.qasm +++ /dev/null @@ -1,517 +0,0 @@ -// Benchmark was created by MQT Bench on 2023-06-29 -// For more information about MQT Bench, please visit https://www.cda.cit.tum.de/mqtbench/ -// MQT Bench version: v1.0.0 -// Qiskit version: {'qiskit-terra': '0.24.1', 'qiskit-aer': '0.12.0', 'qiskit-ignis': None, 'qiskit-ibmq-provider': '0.20.2', 'qiskit': '0.43.1', 'qiskit-nature': '0.6.2', 'qiskit-finance': '0.3.4', 'qiskit-optimization': '0.5.0', 'qiskit-machine-learning': '0.6.1'} - -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[29]; -qreg psi[1]; -creg c[29]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; -h q[9]; -h q[10]; -h q[11]; -h q[12]; -h q[13]; -h q[14]; -h q[15]; -h q[16]; -h q[17]; -h q[18]; -h q[19]; -h q[20]; -h q[21]; -h q[22]; -h q[23]; -h q[24]; -h q[25]; -h q[26]; -h q[27]; -h q[28]; -x psi[0]; -cp(-2.6929568978583567) psi[0],q[0]; -cp(0.8972715114628729) psi[0],q[1]; -cp(1.7945430229257457) psi[0],q[2]; -cp(-2.6940992613280947) psi[0],q[3]; -cp(0.8949867845233965) psi[0],q[4]; -cp(1.789973569046793) psi[0],q[5]; -cp(-2.703238169086) psi[0],q[6]; -cp(0.8767089690075863) psi[0],q[7]; -cp(1.7534179380151727) psi[0],q[8]; -cp(-2.776349431149241) psi[0],q[9]; -cp(0.7304864448811045) psi[0],q[10]; -cp(1.460972889762209) psi[0],q[11]; -cp(2.921945779524418) psi[0],q[12]; -cp(-0.4392937481307505) psi[0],q[13]; -cp(-0.878587496261501) psi[0],q[14]; -cp(-1.757174992523002) psi[0],q[15]; -cp(2.768835322133582) psi[0],q[16]; -cp(-0.7455146629124216) psi[0],q[17]; -cp(-1.4910293258248433) psi[0],q[18]; -cp(-2.9820586516496865) psi[0],q[19]; -cp(0.3190680038802134) psi[0],q[20]; -cp(0.6381360077604268) psi[0],q[21]; -cp(1.2762720155208536) psi[0],q[22]; -cp(13*pi/16) psi[0],q[23]; -cp(-3*pi/8) psi[0],q[24]; -cp(-3*pi/4) psi[0],q[25]; -cp(pi/2) psi[0],q[26]; -cp(pi) psi[0],q[27]; -swap q[0],q[28]; -h q[0]; -swap q[1],q[27]; -cp(-pi/2) q[1],q[0]; -h q[1]; -swap q[10],q[18]; -swap q[11],q[17]; -swap q[12],q[16]; -swap q[13],q[15]; -swap q[2],q[26]; -cp(-pi/4) q[2],q[0]; -cp(-pi/2) q[2],q[1]; -h q[2]; -swap q[3],q[25]; -cp(-pi/8) q[3],q[0]; -cp(-pi/4) q[3],q[1]; -cp(-pi/2) q[3],q[2]; -h q[3]; -swap q[4],q[24]; -cp(-pi/16) q[4],q[0]; -cp(-pi/8) q[4],q[1]; -cp(-pi/4) q[4],q[2]; -cp(-pi/2) q[4],q[3]; -h q[4]; -swap q[5],q[23]; -cp(-pi/32) q[5],q[0]; -cp(-pi/16) q[5],q[1]; -cp(-pi/8) q[5],q[2]; -cp(-pi/4) q[5],q[3]; -cp(-pi/2) q[5],q[4]; -h q[5]; -swap q[6],q[22]; -cp(-pi/64) q[6],q[0]; -cp(-pi/32) q[6],q[1]; -cp(-pi/16) q[6],q[2]; -cp(-pi/8) q[6],q[3]; -cp(-pi/4) q[6],q[4]; -cp(-pi/2) q[6],q[5]; -h q[6]; -swap q[7],q[21]; -cp(-pi/128) q[7],q[0]; -cp(-pi/64) q[7],q[1]; -cp(-pi/32) q[7],q[2]; -cp(-pi/16) q[7],q[3]; -cp(-pi/8) q[7],q[4]; -cp(-pi/4) q[7],q[5]; -cp(-pi/2) q[7],q[6]; -h q[7]; -swap q[8],q[20]; -cp(-pi/256) q[8],q[0]; -cp(-pi/128) q[8],q[1]; -cp(-pi/64) q[8],q[2]; -cp(-pi/32) q[8],q[3]; -cp(-pi/16) q[8],q[4]; -cp(-pi/8) q[8],q[5]; -cp(-pi/4) q[8],q[6]; -cp(-pi/2) q[8],q[7]; -h q[8]; -swap q[9],q[19]; -cp(-pi/512) q[9],q[0]; -cp(-pi/1024) q[10],q[0]; -cp(-pi/2048) q[11],q[0]; -cp(-pi/4096) q[12],q[0]; -cp(-pi/8192) q[13],q[0]; -cp(-pi/16384) q[14],q[0]; -cp(-pi/32768) q[15],q[0]; -cp(-pi/65536) q[16],q[0]; -cp(-pi/131072) q[17],q[0]; -cp(-pi/262144) q[18],q[0]; -cp(-pi/524288) q[19],q[0]; -cp(-pi/1048576) q[20],q[0]; -cp(-pi/2097152) q[21],q[0]; -cp(-pi/4194304) q[22],q[0]; -cp(-pi/8388608) q[23],q[0]; -cp(-pi/16777216) q[24],q[0]; -cp(-pi/33554432) q[25],q[0]; -cp(-pi/67108864) q[26],q[0]; -cp(-pi/134217728) q[27],q[0]; -cp(-pi/268435456) q[28],q[0]; -cp(-pi/256) q[9],q[1]; -cp(-pi/512) q[10],q[1]; -cp(-pi/1024) q[11],q[1]; -cp(-pi/2048) q[12],q[1]; -cp(-pi/4096) q[13],q[1]; -cp(-pi/8192) q[14],q[1]; -cp(-pi/16384) q[15],q[1]; -cp(-pi/32768) q[16],q[1]; -cp(-pi/65536) q[17],q[1]; -cp(-pi/131072) q[18],q[1]; -cp(-pi/262144) q[19],q[1]; -cp(-pi/524288) q[20],q[1]; -cp(-pi/1048576) q[21],q[1]; -cp(-pi/2097152) q[22],q[1]; -cp(-pi/4194304) q[23],q[1]; -cp(-pi/8388608) q[24],q[1]; -cp(-pi/16777216) q[25],q[1]; -cp(-pi/33554432) q[26],q[1]; -cp(-pi/67108864) q[27],q[1]; -cp(-pi/134217728) q[28],q[1]; -cp(-pi/128) q[9],q[2]; -cp(-pi/256) q[10],q[2]; -cp(-pi/512) q[11],q[2]; -cp(-pi/1024) q[12],q[2]; -cp(-pi/2048) q[13],q[2]; -cp(-pi/4096) q[14],q[2]; -cp(-pi/8192) q[15],q[2]; -cp(-pi/16384) q[16],q[2]; -cp(-pi/32768) q[17],q[2]; -cp(-pi/65536) q[18],q[2]; -cp(-pi/131072) q[19],q[2]; -cp(-pi/262144) q[20],q[2]; -cp(-pi/524288) q[21],q[2]; -cp(-pi/1048576) q[22],q[2]; -cp(-pi/2097152) q[23],q[2]; -cp(-pi/4194304) q[24],q[2]; -cp(-pi/8388608) q[25],q[2]; -cp(-pi/16777216) q[26],q[2]; -cp(-pi/33554432) q[27],q[2]; -cp(-pi/67108864) q[28],q[2]; -cp(-pi/64) q[9],q[3]; -cp(-pi/128) q[10],q[3]; -cp(-pi/256) q[11],q[3]; -cp(-pi/512) q[12],q[3]; -cp(-pi/1024) q[13],q[3]; -cp(-pi/2048) q[14],q[3]; -cp(-pi/4096) q[15],q[3]; -cp(-pi/8192) q[16],q[3]; -cp(-pi/16384) q[17],q[3]; -cp(-pi/32768) q[18],q[3]; -cp(-pi/65536) q[19],q[3]; -cp(-pi/131072) q[20],q[3]; -cp(-pi/262144) q[21],q[3]; -cp(-pi/524288) q[22],q[3]; -cp(-pi/1048576) q[23],q[3]; -cp(-pi/2097152) q[24],q[3]; -cp(-pi/4194304) q[25],q[3]; -cp(-pi/8388608) q[26],q[3]; -cp(-pi/16777216) q[27],q[3]; -cp(-pi/33554432) q[28],q[3]; -cp(-pi/32) q[9],q[4]; -cp(-pi/64) q[10],q[4]; -cp(-pi/128) q[11],q[4]; -cp(-pi/256) q[12],q[4]; -cp(-pi/512) q[13],q[4]; -cp(-pi/1024) q[14],q[4]; -cp(-pi/2048) q[15],q[4]; -cp(-pi/4096) q[16],q[4]; -cp(-pi/8192) q[17],q[4]; -cp(-pi/16384) q[18],q[4]; -cp(-pi/32768) q[19],q[4]; -cp(-pi/65536) q[20],q[4]; -cp(-pi/131072) q[21],q[4]; -cp(-pi/262144) q[22],q[4]; -cp(-pi/524288) q[23],q[4]; -cp(-pi/1048576) q[24],q[4]; -cp(-pi/2097152) q[25],q[4]; -cp(-pi/4194304) q[26],q[4]; -cp(-pi/8388608) q[27],q[4]; -cp(-pi/16777216) q[28],q[4]; -cp(-pi/16) q[9],q[5]; -cp(-pi/32) q[10],q[5]; -cp(-pi/64) q[11],q[5]; -cp(-pi/128) q[12],q[5]; -cp(-pi/256) q[13],q[5]; -cp(-pi/512) q[14],q[5]; -cp(-pi/1024) q[15],q[5]; -cp(-pi/2048) q[16],q[5]; -cp(-pi/4096) q[17],q[5]; -cp(-pi/8192) q[18],q[5]; -cp(-pi/16384) q[19],q[5]; -cp(-pi/32768) q[20],q[5]; -cp(-pi/65536) q[21],q[5]; -cp(-pi/131072) q[22],q[5]; -cp(-pi/262144) q[23],q[5]; -cp(-pi/524288) q[24],q[5]; -cp(-pi/1048576) q[25],q[5]; -cp(-pi/2097152) q[26],q[5]; -cp(-pi/4194304) q[27],q[5]; -cp(-pi/8388608) q[28],q[5]; -cp(-pi/8) q[9],q[6]; -cp(-pi/16) q[10],q[6]; -cp(-pi/32) q[11],q[6]; -cp(-pi/64) q[12],q[6]; -cp(-pi/128) q[13],q[6]; -cp(-pi/256) q[14],q[6]; -cp(-pi/512) q[15],q[6]; -cp(-pi/1024) q[16],q[6]; -cp(-pi/2048) q[17],q[6]; -cp(-pi/4096) q[18],q[6]; -cp(-pi/8192) q[19],q[6]; -cp(-pi/16384) q[20],q[6]; -cp(-pi/32768) q[21],q[6]; -cp(-pi/65536) q[22],q[6]; -cp(-pi/131072) q[23],q[6]; -cp(-pi/262144) q[24],q[6]; -cp(-pi/524288) q[25],q[6]; -cp(-pi/1048576) q[26],q[6]; -cp(-pi/2097152) q[27],q[6]; -cp(-pi/4194304) q[28],q[6]; -cp(-pi/4) q[9],q[7]; -cp(-pi/8) q[10],q[7]; -cp(-pi/16) q[11],q[7]; -cp(-pi/32) q[12],q[7]; -cp(-pi/64) q[13],q[7]; -cp(-pi/128) q[14],q[7]; -cp(-pi/256) q[15],q[7]; -cp(-pi/512) q[16],q[7]; -cp(-pi/1024) q[17],q[7]; -cp(-pi/2048) q[18],q[7]; -cp(-pi/4096) q[19],q[7]; -cp(-pi/8192) q[20],q[7]; -cp(-pi/16384) q[21],q[7]; -cp(-pi/32768) q[22],q[7]; -cp(-pi/65536) q[23],q[7]; -cp(-pi/131072) q[24],q[7]; -cp(-pi/262144) q[25],q[7]; -cp(-pi/524288) q[26],q[7]; -cp(-pi/1048576) q[27],q[7]; -cp(-pi/2097152) q[28],q[7]; -cp(-pi/2) q[9],q[8]; -cp(-pi/4) q[10],q[8]; -cp(-pi/8) q[11],q[8]; -cp(-pi/16) q[12],q[8]; -cp(-pi/32) q[13],q[8]; -cp(-pi/64) q[14],q[8]; -cp(-pi/128) q[15],q[8]; -cp(-pi/256) q[16],q[8]; -cp(-pi/512) q[17],q[8]; -cp(-pi/1024) q[18],q[8]; -cp(-pi/2048) q[19],q[8]; -cp(-pi/4096) q[20],q[8]; -cp(-pi/8192) q[21],q[8]; -cp(-pi/16384) q[22],q[8]; -cp(-pi/32768) q[23],q[8]; -cp(-pi/65536) q[24],q[8]; -cp(-pi/131072) q[25],q[8]; -cp(-pi/262144) q[26],q[8]; -cp(-pi/524288) q[27],q[8]; -cp(-pi/1048576) q[28],q[8]; -h q[9]; -cp(-pi/2) q[10],q[9]; -h q[10]; -cp(-pi/4) q[11],q[9]; -cp(-pi/2) q[11],q[10]; -h q[11]; -cp(-pi/8) q[12],q[9]; -cp(-pi/4) q[12],q[10]; -cp(-pi/2) q[12],q[11]; -h q[12]; -cp(-pi/16) q[13],q[9]; -cp(-pi/8) q[13],q[10]; -cp(-pi/4) q[13],q[11]; -cp(-pi/2) q[13],q[12]; -h q[13]; -cp(-pi/32) q[14],q[9]; -cp(-pi/16) q[14],q[10]; -cp(-pi/8) q[14],q[11]; -cp(-pi/4) q[14],q[12]; -cp(-pi/2) q[14],q[13]; -h q[14]; -cp(-pi/64) q[15],q[9]; -cp(-pi/32) q[15],q[10]; -cp(-pi/16) q[15],q[11]; -cp(-pi/8) q[15],q[12]; -cp(-pi/4) q[15],q[13]; -cp(-pi/2) q[15],q[14]; -h q[15]; -cp(-pi/128) q[16],q[9]; -cp(-pi/64) q[16],q[10]; -cp(-pi/32) q[16],q[11]; -cp(-pi/16) q[16],q[12]; -cp(-pi/8) q[16],q[13]; -cp(-pi/4) q[16],q[14]; -cp(-pi/2) q[16],q[15]; -h q[16]; -cp(-pi/256) q[17],q[9]; -cp(-pi/128) q[17],q[10]; -cp(-pi/64) q[17],q[11]; -cp(-pi/32) q[17],q[12]; -cp(-pi/16) q[17],q[13]; -cp(-pi/8) q[17],q[14]; -cp(-pi/4) q[17],q[15]; -cp(-pi/2) q[17],q[16]; -h q[17]; -cp(-pi/512) q[18],q[9]; -cp(-pi/256) q[18],q[10]; -cp(-pi/128) q[18],q[11]; -cp(-pi/64) q[18],q[12]; -cp(-pi/32) q[18],q[13]; -cp(-pi/16) q[18],q[14]; -cp(-pi/8) q[18],q[15]; -cp(-pi/4) q[18],q[16]; -cp(-pi/2) q[18],q[17]; -h q[18]; -cp(-pi/1024) q[19],q[9]; -cp(-pi/512) q[19],q[10]; -cp(-pi/256) q[19],q[11]; -cp(-pi/128) q[19],q[12]; -cp(-pi/64) q[19],q[13]; -cp(-pi/32) q[19],q[14]; -cp(-pi/16) q[19],q[15]; -cp(-pi/8) q[19],q[16]; -cp(-pi/4) q[19],q[17]; -cp(-pi/2) q[19],q[18]; -h q[19]; -cp(-pi/2048) q[20],q[9]; -cp(-pi/1024) q[20],q[10]; -cp(-pi/512) q[20],q[11]; -cp(-pi/256) q[20],q[12]; -cp(-pi/128) q[20],q[13]; -cp(-pi/64) q[20],q[14]; -cp(-pi/32) q[20],q[15]; -cp(-pi/16) q[20],q[16]; -cp(-pi/8) q[20],q[17]; -cp(-pi/4) q[20],q[18]; -cp(-pi/2) q[20],q[19]; -h q[20]; -cp(-pi/4096) q[21],q[9]; -cp(-pi/2048) q[21],q[10]; -cp(-pi/1024) q[21],q[11]; -cp(-pi/512) q[21],q[12]; -cp(-pi/256) q[21],q[13]; -cp(-pi/128) q[21],q[14]; -cp(-pi/64) q[21],q[15]; -cp(-pi/32) q[21],q[16]; -cp(-pi/16) q[21],q[17]; -cp(-pi/8) q[21],q[18]; -cp(-pi/4) q[21],q[19]; -cp(-pi/2) q[21],q[20]; -h q[21]; -cp(-pi/8192) q[22],q[9]; -cp(-pi/4096) q[22],q[10]; -cp(-pi/2048) q[22],q[11]; -cp(-pi/1024) q[22],q[12]; -cp(-pi/512) q[22],q[13]; -cp(-pi/256) q[22],q[14]; -cp(-pi/128) q[22],q[15]; -cp(-pi/64) q[22],q[16]; -cp(-pi/32) q[22],q[17]; -cp(-pi/16) q[22],q[18]; -cp(-pi/8) q[22],q[19]; -cp(-pi/4) q[22],q[20]; -cp(-pi/2) q[22],q[21]; -h q[22]; -cp(-pi/16384) q[23],q[9]; -cp(-pi/8192) q[23],q[10]; -cp(-pi/4096) q[23],q[11]; -cp(-pi/2048) q[23],q[12]; -cp(-pi/1024) q[23],q[13]; -cp(-pi/512) q[23],q[14]; -cp(-pi/256) q[23],q[15]; -cp(-pi/128) q[23],q[16]; -cp(-pi/64) q[23],q[17]; -cp(-pi/32) q[23],q[18]; -cp(-pi/16) q[23],q[19]; -cp(-pi/8) q[23],q[20]; -cp(-pi/4) q[23],q[21]; -cp(-pi/2) q[23],q[22]; -h q[23]; -cp(-pi/32768) q[24],q[9]; -cp(-pi/16384) q[24],q[10]; -cp(-pi/8192) q[24],q[11]; -cp(-pi/4096) q[24],q[12]; -cp(-pi/2048) q[24],q[13]; -cp(-pi/1024) q[24],q[14]; -cp(-pi/512) q[24],q[15]; -cp(-pi/256) q[24],q[16]; -cp(-pi/128) q[24],q[17]; -cp(-pi/64) q[24],q[18]; -cp(-pi/32) q[24],q[19]; -cp(-pi/16) q[24],q[20]; -cp(-pi/8) q[24],q[21]; -cp(-pi/4) q[24],q[22]; -cp(-pi/2) q[24],q[23]; -h q[24]; -cp(-pi/65536) q[25],q[9]; -cp(-pi/32768) q[25],q[10]; -cp(-pi/16384) q[25],q[11]; -cp(-pi/8192) q[25],q[12]; -cp(-pi/4096) q[25],q[13]; -cp(-pi/2048) q[25],q[14]; -cp(-pi/1024) q[25],q[15]; -cp(-pi/512) q[25],q[16]; -cp(-pi/256) q[25],q[17]; -cp(-pi/128) q[25],q[18]; -cp(-pi/64) q[25],q[19]; -cp(-pi/32) q[25],q[20]; -cp(-pi/16) q[25],q[21]; -cp(-pi/8) q[25],q[22]; -cp(-pi/4) q[25],q[23]; -cp(-pi/2) q[25],q[24]; -h q[25]; -cp(-pi/131072) q[26],q[9]; -cp(-pi/65536) q[26],q[10]; -cp(-pi/32768) q[26],q[11]; -cp(-pi/16384) q[26],q[12]; -cp(-pi/8192) q[26],q[13]; -cp(-pi/4096) q[26],q[14]; -cp(-pi/2048) q[26],q[15]; -cp(-pi/1024) q[26],q[16]; -cp(-pi/512) q[26],q[17]; -cp(-pi/256) q[26],q[18]; -cp(-pi/128) q[26],q[19]; -cp(-pi/64) q[26],q[20]; -cp(-pi/32) q[26],q[21]; -cp(-pi/16) q[26],q[22]; -cp(-pi/8) q[26],q[23]; -cp(-pi/4) q[26],q[24]; -cp(-pi/2) q[26],q[25]; -h q[26]; -cp(-pi/262144) q[27],q[9]; -cp(-pi/131072) q[27],q[10]; -cp(-pi/65536) q[27],q[11]; -cp(-pi/32768) q[27],q[12]; -cp(-pi/16384) q[27],q[13]; -cp(-pi/8192) q[27],q[14]; -cp(-pi/4096) q[27],q[15]; -cp(-pi/2048) q[27],q[16]; -cp(-pi/1024) q[27],q[17]; -cp(-pi/512) q[27],q[18]; -cp(-pi/256) q[27],q[19]; -cp(-pi/128) q[27],q[20]; -cp(-pi/64) q[27],q[21]; -cp(-pi/32) q[27],q[22]; -cp(-pi/16) q[27],q[23]; -cp(-pi/8) q[27],q[24]; -cp(-pi/4) q[27],q[25]; -cp(-pi/2) q[27],q[26]; -h q[27]; -cp(-pi/524288) q[28],q[9]; -cp(-pi/262144) q[28],q[10]; -cp(-pi/131072) q[28],q[11]; -cp(-pi/65536) q[28],q[12]; -cp(-pi/32768) q[28],q[13]; -cp(-pi/16384) q[28],q[14]; -cp(-pi/8192) q[28],q[15]; -cp(-pi/4096) q[28],q[16]; -cp(-pi/2048) q[28],q[17]; -cp(-pi/1024) q[28],q[18]; -cp(-pi/512) q[28],q[19]; -cp(-pi/256) q[28],q[20]; -cp(-pi/128) q[28],q[21]; -cp(-pi/64) q[28],q[22]; -cp(-pi/32) q[28],q[23]; -cp(-pi/16) q[28],q[24]; -cp(-pi/8) q[28],q[25]; -cp(-pi/4) q[28],q[26]; -cp(-pi/2) q[28],q[27]; -h q[28]; diff --git a/test/circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm b/test/circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm deleted file mode 100644 index 6c9b3dc22..000000000 --- a/test/circuits/qpeexact_nativegates_ibm_qiskit_opt0_30.qasm +++ /dev/null @@ -1,2398 +0,0 @@ -// Benchmark was created by MQT Bench on 2023-06-29 -// For more information about MQT Bench, please visit https://www.cda.cit.tum.de/mqtbench/ -// MQT Bench version: v1.0.0 -// Qiskit version: {'qiskit-terra': '0.24.1', 'qiskit-aer': '0.12.0', 'qiskit-ignis': None, 'qiskit-ibmq-provider': '0.20.2', 'qiskit': '0.43.1', 'qiskit-nature': '0.6.2', 'qiskit-finance': '0.3.4', 'qiskit-optimization': '0.5.0', 'qiskit-machine-learning': '0.6.1'} -// Used Gate Set: ['rz', 'sx', 'x', 'cx', 'measure'] - -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[29]; -qreg psi[1]; -creg c[29]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[6]; -sx q[6]; -rz(pi/2) q[6]; -rz(pi/2) q[7]; -sx q[7]; -rz(pi/2) q[7]; -rz(pi/2) q[8]; -sx q[8]; -rz(pi/2) q[8]; -rz(pi/2) q[9]; -sx q[9]; -rz(pi/2) q[9]; -rz(pi/2) q[10]; -sx q[10]; -rz(pi/2) q[10]; -rz(pi/2) q[11]; -sx q[11]; -rz(pi/2) q[11]; -rz(pi/2) q[12]; -sx q[12]; -rz(pi/2) q[12]; -rz(pi/2) q[13]; -sx q[13]; -rz(pi/2) q[13]; -rz(pi/2) q[14]; -sx q[14]; -rz(pi/2) q[14]; -rz(pi/2) q[15]; -sx q[15]; -rz(pi/2) q[15]; -rz(pi/2) q[16]; -sx q[16]; -rz(pi/2) q[16]; -rz(pi/2) q[17]; -sx q[17]; -rz(pi/2) q[17]; -rz(pi/2) q[18]; -sx q[18]; -rz(pi/2) q[18]; -rz(pi/2) q[19]; -sx q[19]; -rz(pi/2) q[19]; -rz(pi/2) q[20]; -sx q[20]; -rz(pi/2) q[20]; -rz(pi/2) q[21]; -sx q[21]; -rz(pi/2) q[21]; -rz(pi/2) q[22]; -sx q[22]; -rz(pi/2) q[22]; -rz(pi/2) q[23]; -sx q[23]; -rz(pi/2) q[23]; -rz(pi/2) q[24]; -sx q[24]; -rz(pi/2) q[24]; -rz(pi/2) q[25]; -sx q[25]; -rz(pi/2) q[25]; -rz(pi/2) q[26]; -sx q[26]; -rz(pi/2) q[26]; -rz(pi/2) q[27]; -sx q[27]; -rz(pi/2) q[27]; -rz(pi/2) q[28]; -sx q[28]; -rz(pi/2) q[28]; -x psi[0]; -rz(-1.3464784489291783) psi[0]; -cx psi[0],q[0]; -rz(1.3464784489291783) q[0]; -cx psi[0],q[0]; -rz(0.44863575573143644) psi[0]; -cx psi[0],q[1]; -rz(-1.3464784489291783) q[0]; -cx q[0],q[28]; -rz(-0.44863575573143644) q[1]; -cx psi[0],q[1]; -rz(0.8972715114628729) psi[0]; -cx psi[0],q[2]; -rz(0.44863575573143644) q[1]; -rz(-0.8972715114628729) q[2]; -cx psi[0],q[2]; -rz(-1.3470496306640474) psi[0]; -cx psi[0],q[3]; -rz(0.8972715114628729) q[2]; -cx q[28],q[0]; -cx q[0],q[28]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(-pi/536870912) q[28]; -rz(1.3470496306640474) q[3]; -cx psi[0],q[3]; -rz(0.44749339226169826) psi[0]; -cx psi[0],q[4]; -rz(-1.3470496306640474) q[3]; -rz(-0.44749339226169826) q[4]; -cx psi[0],q[4]; -rz(0.8949867845233965) psi[0]; -cx psi[0],q[5]; -rz(0.44749339226169826) q[4]; -rz(-0.8949867845233965) q[5]; -cx psi[0],q[5]; -rz(-1.351619084543) psi[0]; -cx psi[0],q[6]; -rz(0.8949867845233965) q[5]; -rz(1.351619084543) q[6]; -cx psi[0],q[6]; -rz(0.43835448450379316) psi[0]; -cx psi[0],q[7]; -rz(-1.351619084543) q[6]; -rz(-0.43835448450379316) q[7]; -cx psi[0],q[7]; -rz(0.8767089690075863) psi[0]; -cx psi[0],q[8]; -rz(0.43835448450379316) q[7]; -rz(-0.8767089690075863) q[8]; -cx psi[0],q[8]; -rz(-1.3881747155746205) psi[0]; -cx psi[0],q[9]; -rz(0.8767089690075863) q[8]; -rz(1.3881747155746205) q[9]; -cx psi[0],q[9]; -rz(0.36524322244055224) psi[0]; -cx psi[0],q[10]; -rz(-0.36524322244055224) q[10]; -cx psi[0],q[10]; -rz(0.7304864448811045) psi[0]; -cx psi[0],q[11]; -rz(0.36524322244055224) q[10]; -rz(-0.7304864448811045) q[11]; -cx psi[0],q[11]; -rz(1.460972889762209) psi[0]; -cx psi[0],q[12]; -rz(0.7304864448811045) q[11]; -rz(-1.460972889762209) q[12]; -cx psi[0],q[12]; -rz(-0.21964687406537525) psi[0]; -cx psi[0],q[13]; -rz(1.460972889762209) q[12]; -rz(0.21964687406537525) q[13]; -cx psi[0],q[13]; -rz(-0.4392937481307505) psi[0]; -cx psi[0],q[14]; -rz(-0.21964687406537525) q[13]; -rz(0.4392937481307505) q[14]; -cx psi[0],q[14]; -rz(-0.878587496261501) psi[0]; -cx psi[0],q[15]; -rz(-0.4392937481307505) q[14]; -rz(-pi/32768) q[14]; -rz(0.878587496261501) q[15]; -cx psi[0],q[15]; -rz(1.384417661066791) psi[0]; -cx psi[0],q[16]; -rz(-0.878587496261501) q[15]; -cx q[13],q[15]; -cx q[15],q[13]; -cx q[13],q[15]; -rz(-pi/16384) q[13]; -rz(-pi/65536) q[15]; -rz(-1.384417661066791) q[16]; -cx psi[0],q[16]; -rz(-0.3727573314562108) psi[0]; -cx psi[0],q[17]; -rz(1.384417661066791) q[16]; -cx q[12],q[16]; -cx q[16],q[12]; -cx q[12],q[16]; -rz(-pi/8192) q[12]; -rz(-pi/131072) q[16]; -rz(0.3727573314562108) q[17]; -cx psi[0],q[17]; -rz(-0.7455146629124216) psi[0]; -cx psi[0],q[18]; -rz(-0.3727573314562108) q[17]; -cx q[11],q[17]; -cx q[17],q[11]; -cx q[11],q[17]; -rz(-pi/4096) q[11]; -rz(-pi/262144) q[17]; -rz(0.7455146629124216) q[18]; -cx psi[0],q[18]; -rz(-1.4910293258248433) psi[0]; -cx psi[0],q[19]; -rz(-0.7455146629124216) q[18]; -cx q[10],q[18]; -cx q[18],q[10]; -cx q[10],q[18]; -rz(-pi/2048) q[10]; -rz(-pi/524288) q[18]; -rz(1.4910293258248433) q[19]; -cx psi[0],q[19]; -rz(0.1595340019401067) psi[0]; -cx psi[0],q[20]; -rz(-1.4910293258248433) q[19]; -rz(-0.1595340019401067) q[20]; -cx psi[0],q[20]; -rz(0.3190680038802134) psi[0]; -cx psi[0],q[21]; -rz(0.1595340019401067) q[20]; -rz(-0.3190680038802134) q[21]; -cx psi[0],q[21]; -rz(0.6381360077604268) psi[0]; -cx psi[0],q[22]; -rz(0.3190680038802134) q[21]; -rz(-0.6381360077604268) q[22]; -cx psi[0],q[22]; -rz(1.2762720155208536) psi[0]; -cx psi[0],q[23]; -rz(0.6381360077604268) q[22]; -rz(-1.2762720155208536) q[23]; -cx psi[0],q[23]; -rz(-3*pi/16) psi[0]; -cx psi[0],q[24]; -rz(1.2762720155208536) q[23]; -rz(3*pi/16) q[24]; -cx psi[0],q[24]; -rz(-3*pi/8) psi[0]; -cx psi[0],q[25]; -rz(-3*pi/16) q[24]; -rz(3*pi/8) q[25]; -cx psi[0],q[25]; -rz(pi/4) psi[0]; -cx psi[0],q[26]; -rz(-3*pi/8) q[25]; -rz(-pi/4) q[26]; -cx psi[0],q[26]; -rz(pi/2) psi[0]; -cx psi[0],q[27]; -rz(pi/4) q[26]; -cx q[2],q[26]; -cx q[26],q[2]; -cx q[2],q[26]; -rz(-pi/8) q[2]; -rz(-pi/134217728) q[26]; -rz(-pi/2) q[27]; -cx psi[0],q[27]; -rz(pi/2) q[27]; -cx q[1],q[27]; -cx q[27],q[1]; -cx q[1],q[27]; -rz(-pi/4) q[1]; -cx q[1],q[0]; -rz(pi/4) q[0]; -cx q[1],q[0]; -rz(-pi/4) q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -cx q[2],q[0]; -rz(pi/8) q[0]; -cx q[2],q[0]; -rz(-pi/8) q[0]; -rz(-pi/4) q[2]; -cx q[2],q[1]; -rz(pi/4) q[1]; -cx q[2],q[1]; -rz(-pi/4) q[1]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -rz(-pi/268435456) q[27]; -cx q[3],q[25]; -cx q[25],q[3]; -cx q[3],q[25]; -rz(-pi/67108864) q[25]; -rz(-pi/16) q[3]; -cx q[3],q[0]; -rz(pi/16) q[0]; -cx q[3],q[0]; -rz(-pi/16) q[0]; -rz(-pi/8) q[3]; -cx q[3],q[1]; -rz(pi/8) q[1]; -cx q[3],q[1]; -rz(-pi/8) q[1]; -rz(-pi/4) q[3]; -cx q[3],q[2]; -rz(pi/4) q[2]; -cx q[3],q[2]; -rz(-pi/4) q[2]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -cx q[4],q[24]; -cx q[24],q[4]; -cx q[4],q[24]; -rz(-pi/33554432) q[24]; -rz(-pi/32) q[4]; -cx q[4],q[0]; -rz(pi/32) q[0]; -cx q[4],q[0]; -rz(-pi/32) q[0]; -rz(-pi/16) q[4]; -cx q[4],q[1]; -rz(pi/16) q[1]; -cx q[4],q[1]; -rz(-pi/16) q[1]; -rz(-pi/8) q[4]; -cx q[4],q[2]; -rz(pi/8) q[2]; -cx q[4],q[2]; -rz(-pi/8) q[2]; -rz(-pi/4) q[4]; -cx q[4],q[3]; -rz(pi/4) q[3]; -cx q[4],q[3]; -rz(-pi/4) q[3]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -cx q[5],q[23]; -cx q[23],q[5]; -cx q[5],q[23]; -rz(-pi/16777216) q[23]; -rz(-pi/64) q[5]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[5],q[0]; -rz(-pi/64) q[0]; -rz(-pi/32) q[5]; -cx q[5],q[1]; -rz(pi/32) q[1]; -cx q[5],q[1]; -rz(-pi/32) q[1]; -rz(-pi/16) q[5]; -cx q[5],q[2]; -rz(pi/16) q[2]; -cx q[5],q[2]; -rz(-pi/16) q[2]; -rz(-pi/8) q[5]; -cx q[5],q[3]; -rz(pi/8) q[3]; -cx q[5],q[3]; -rz(-pi/8) q[3]; -rz(-pi/4) q[5]; -cx q[5],q[4]; -rz(pi/4) q[4]; -cx q[5],q[4]; -rz(-pi/4) q[4]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[6],q[22]; -cx q[22],q[6]; -cx q[6],q[22]; -rz(-pi/8388608) q[22]; -rz(-pi/128) q[6]; -cx q[6],q[0]; -rz(pi/128) q[0]; -cx q[6],q[0]; -rz(-pi/128) q[0]; -rz(-pi/64) q[6]; -cx q[6],q[1]; -rz(pi/64) q[1]; -cx q[6],q[1]; -rz(-pi/64) q[1]; -rz(-pi/32) q[6]; -cx q[6],q[2]; -rz(pi/32) q[2]; -cx q[6],q[2]; -rz(-pi/32) q[2]; -rz(-pi/16) q[6]; -cx q[6],q[3]; -rz(pi/16) q[3]; -cx q[6],q[3]; -rz(-pi/16) q[3]; -rz(-pi/8) q[6]; -cx q[6],q[4]; -rz(pi/8) q[4]; -cx q[6],q[4]; -rz(-pi/8) q[4]; -rz(-pi/4) q[6]; -cx q[6],q[5]; -rz(pi/4) q[5]; -cx q[6],q[5]; -rz(-pi/4) q[5]; -rz(pi/2) q[6]; -sx q[6]; -rz(pi/2) q[6]; -cx q[7],q[21]; -cx q[21],q[7]; -cx q[7],q[21]; -rz(-pi/4194304) q[21]; -rz(-pi/256) q[7]; -cx q[7],q[0]; -rz(pi/256) q[0]; -cx q[7],q[0]; -rz(-pi/256) q[0]; -rz(-pi/128) q[7]; -cx q[7],q[1]; -rz(pi/128) q[1]; -cx q[7],q[1]; -rz(-pi/128) q[1]; -rz(-pi/64) q[7]; -cx q[7],q[2]; -rz(pi/64) q[2]; -cx q[7],q[2]; -rz(-pi/64) q[2]; -rz(-pi/32) q[7]; -cx q[7],q[3]; -rz(pi/32) q[3]; -cx q[7],q[3]; -rz(-pi/32) q[3]; -rz(-pi/16) q[7]; -cx q[7],q[4]; -rz(pi/16) q[4]; -cx q[7],q[4]; -rz(-pi/16) q[4]; -rz(-pi/8) q[7]; -cx q[7],q[5]; -rz(pi/8) q[5]; -cx q[7],q[5]; -rz(-pi/8) q[5]; -rz(-pi/4) q[7]; -cx q[7],q[6]; -rz(pi/4) q[6]; -cx q[7],q[6]; -rz(-pi/4) q[6]; -rz(pi/2) q[7]; -sx q[7]; -rz(pi/2) q[7]; -cx q[8],q[20]; -cx q[20],q[8]; -cx q[8],q[20]; -rz(-pi/2097152) q[20]; -rz(-pi/512) q[8]; -cx q[8],q[0]; -rz(pi/512) q[0]; -cx q[8],q[0]; -rz(-pi/512) q[0]; -rz(-pi/256) q[8]; -cx q[8],q[1]; -rz(pi/256) q[1]; -cx q[8],q[1]; -rz(-pi/256) q[1]; -rz(-pi/128) q[8]; -cx q[8],q[2]; -rz(pi/128) q[2]; -cx q[8],q[2]; -rz(-pi/128) q[2]; -rz(-pi/64) q[8]; -cx q[8],q[3]; -rz(pi/64) q[3]; -cx q[8],q[3]; -rz(-pi/64) q[3]; -rz(-pi/32) q[8]; -cx q[8],q[4]; -rz(pi/32) q[4]; -cx q[8],q[4]; -rz(-pi/32) q[4]; -rz(-pi/16) q[8]; -cx q[8],q[5]; -rz(pi/16) q[5]; -cx q[8],q[5]; -rz(-pi/16) q[5]; -rz(-pi/8) q[8]; -cx q[8],q[6]; -rz(pi/8) q[6]; -cx q[8],q[6]; -rz(-pi/8) q[6]; -rz(-pi/4) q[8]; -cx q[8],q[7]; -rz(pi/4) q[7]; -cx q[8],q[7]; -rz(-pi/4) q[7]; -rz(pi/2) q[8]; -sx q[8]; -rz(pi/2) q[8]; -rz(-1.3881747155746205) q[9]; -cx q[9],q[19]; -cx q[19],q[9]; -cx q[9],q[19]; -rz(-pi/1048576) q[19]; -rz(-pi/1024) q[9]; -cx q[9],q[0]; -rz(pi/1024) q[0]; -cx q[9],q[0]; -rz(-pi/1024) q[0]; -cx q[10],q[0]; -rz(pi/2048) q[0]; -cx q[10],q[0]; -rz(-pi/2048) q[0]; -rz(-pi/1024) q[10]; -cx q[11],q[0]; -rz(pi/4096) q[0]; -cx q[11],q[0]; -rz(-pi/4096) q[0]; -rz(-pi/2048) q[11]; -cx q[12],q[0]; -rz(pi/8192) q[0]; -cx q[12],q[0]; -rz(-pi/8192) q[0]; -rz(-pi/4096) q[12]; -cx q[13],q[0]; -rz(pi/16384) q[0]; -cx q[13],q[0]; -rz(-pi/16384) q[0]; -rz(-pi/8192) q[13]; -cx q[14],q[0]; -rz(pi/32768) q[0]; -cx q[14],q[0]; -rz(-pi/32768) q[0]; -rz(-pi/16384) q[14]; -cx q[15],q[0]; -rz(pi/65536) q[0]; -cx q[15],q[0]; -rz(-pi/65536) q[0]; -rz(-pi/32768) q[15]; -cx q[16],q[0]; -rz(pi/131072) q[0]; -cx q[16],q[0]; -rz(-pi/131072) q[0]; -rz(-pi/65536) q[16]; -cx q[17],q[0]; -rz(pi/262144) q[0]; -cx q[17],q[0]; -rz(-pi/262144) q[0]; -rz(-pi/131072) q[17]; -cx q[18],q[0]; -rz(pi/524288) q[0]; -cx q[18],q[0]; -rz(-pi/524288) q[0]; -rz(-pi/262144) q[18]; -cx q[19],q[0]; -rz(pi/1048576) q[0]; -cx q[19],q[0]; -rz(-pi/1048576) q[0]; -rz(-pi/524288) q[19]; -cx q[20],q[0]; -rz(pi/2097152) q[0]; -cx q[20],q[0]; -rz(-pi/2097152) q[0]; -rz(-pi/1048576) q[20]; -cx q[21],q[0]; -rz(pi/4194304) q[0]; -cx q[21],q[0]; -rz(-pi/4194304) q[0]; -rz(-pi/2097152) q[21]; -cx q[22],q[0]; -rz(pi/8388608) q[0]; -cx q[22],q[0]; -rz(-pi/8388608) q[0]; -rz(-pi/4194304) q[22]; -cx q[23],q[0]; -rz(pi/16777216) q[0]; -cx q[23],q[0]; -rz(-pi/16777216) q[0]; -rz(-pi/8388608) q[23]; -cx q[24],q[0]; -rz(pi/33554432) q[0]; -cx q[24],q[0]; -rz(-pi/33554432) q[0]; -rz(-pi/16777216) q[24]; -cx q[25],q[0]; -rz(pi/67108864) q[0]; -cx q[25],q[0]; -rz(-pi/67108864) q[0]; -rz(-pi/33554432) q[25]; -cx q[26],q[0]; -rz(pi/134217728) q[0]; -cx q[26],q[0]; -rz(-pi/134217728) q[0]; -rz(-pi/67108864) q[26]; -cx q[27],q[0]; -rz(pi/268435456) q[0]; -cx q[27],q[0]; -rz(-pi/268435456) q[0]; -rz(-pi/134217728) q[27]; -cx q[28],q[0]; -rz(pi/536870912) q[0]; -cx q[28],q[0]; -rz(-pi/536870912) q[0]; -rz(-pi/268435456) q[28]; -rz(-pi/512) q[9]; -cx q[9],q[1]; -rz(pi/512) q[1]; -cx q[9],q[1]; -rz(-pi/512) q[1]; -cx q[10],q[1]; -rz(pi/1024) q[1]; -cx q[10],q[1]; -rz(-pi/1024) q[1]; -rz(-pi/512) q[10]; -cx q[11],q[1]; -rz(pi/2048) q[1]; -cx q[11],q[1]; -rz(-pi/2048) q[1]; -rz(-pi/1024) q[11]; -cx q[12],q[1]; -rz(pi/4096) q[1]; -cx q[12],q[1]; -rz(-pi/4096) q[1]; -rz(-pi/2048) q[12]; -cx q[13],q[1]; -rz(pi/8192) q[1]; -cx q[13],q[1]; -rz(-pi/8192) q[1]; -rz(-pi/4096) q[13]; -cx q[14],q[1]; -rz(pi/16384) q[1]; -cx q[14],q[1]; -rz(-pi/16384) q[1]; -rz(-pi/8192) q[14]; -cx q[15],q[1]; -rz(pi/32768) q[1]; -cx q[15],q[1]; -rz(-pi/32768) q[1]; -rz(-pi/16384) q[15]; -cx q[16],q[1]; -rz(pi/65536) q[1]; -cx q[16],q[1]; -rz(-pi/65536) q[1]; -rz(-pi/32768) q[16]; -cx q[17],q[1]; -rz(pi/131072) q[1]; -cx q[17],q[1]; -rz(-pi/131072) q[1]; -rz(-pi/65536) q[17]; -cx q[18],q[1]; -rz(pi/262144) q[1]; -cx q[18],q[1]; -rz(-pi/262144) q[1]; -rz(-pi/131072) q[18]; -cx q[19],q[1]; -rz(pi/524288) q[1]; -cx q[19],q[1]; -rz(-pi/524288) q[1]; -rz(-pi/262144) q[19]; -cx q[20],q[1]; -rz(pi/1048576) q[1]; -cx q[20],q[1]; -rz(-pi/1048576) q[1]; -rz(-pi/524288) q[20]; -cx q[21],q[1]; -rz(pi/2097152) q[1]; -cx q[21],q[1]; -rz(-pi/2097152) q[1]; -rz(-pi/1048576) q[21]; -cx q[22],q[1]; -rz(pi/4194304) q[1]; -cx q[22],q[1]; -rz(-pi/4194304) q[1]; -rz(-pi/2097152) q[22]; -cx q[23],q[1]; -rz(pi/8388608) q[1]; -cx q[23],q[1]; -rz(-pi/8388608) q[1]; -rz(-pi/4194304) q[23]; -cx q[24],q[1]; -rz(pi/16777216) q[1]; -cx q[24],q[1]; -rz(-pi/16777216) q[1]; -rz(-pi/8388608) q[24]; -cx q[25],q[1]; -rz(pi/33554432) q[1]; -cx q[25],q[1]; -rz(-pi/33554432) q[1]; -rz(-pi/16777216) q[25]; -cx q[26],q[1]; -rz(pi/67108864) q[1]; -cx q[26],q[1]; -rz(-pi/67108864) q[1]; -rz(-pi/33554432) q[26]; -cx q[27],q[1]; -rz(pi/134217728) q[1]; -cx q[27],q[1]; -rz(-pi/134217728) q[1]; -rz(-pi/67108864) q[27]; -cx q[28],q[1]; -rz(pi/268435456) q[1]; -cx q[28],q[1]; -rz(-pi/268435456) q[1]; -rz(-pi/134217728) q[28]; -rz(-pi/256) q[9]; -cx q[9],q[2]; -rz(pi/256) q[2]; -cx q[9],q[2]; -rz(-pi/256) q[2]; -cx q[10],q[2]; -rz(pi/512) q[2]; -cx q[10],q[2]; -rz(-pi/256) q[10]; -rz(-pi/512) q[2]; -cx q[11],q[2]; -rz(pi/1024) q[2]; -cx q[11],q[2]; -rz(-pi/512) q[11]; -rz(-pi/1024) q[2]; -cx q[12],q[2]; -rz(pi/2048) q[2]; -cx q[12],q[2]; -rz(-pi/1024) q[12]; -rz(-pi/2048) q[2]; -cx q[13],q[2]; -rz(pi/4096) q[2]; -cx q[13],q[2]; -rz(-pi/2048) q[13]; -rz(-pi/4096) q[2]; -cx q[14],q[2]; -rz(pi/8192) q[2]; -cx q[14],q[2]; -rz(-pi/4096) q[14]; -rz(-pi/8192) q[2]; -cx q[15],q[2]; -rz(pi/16384) q[2]; -cx q[15],q[2]; -rz(-pi/8192) q[15]; -rz(-pi/16384) q[2]; -cx q[16],q[2]; -rz(pi/32768) q[2]; -cx q[16],q[2]; -rz(-pi/16384) q[16]; -rz(-pi/32768) q[2]; -cx q[17],q[2]; -rz(pi/65536) q[2]; -cx q[17],q[2]; -rz(-pi/32768) q[17]; -rz(-pi/65536) q[2]; -cx q[18],q[2]; -rz(pi/131072) q[2]; -cx q[18],q[2]; -rz(-pi/65536) q[18]; -rz(-pi/131072) q[2]; -cx q[19],q[2]; -rz(pi/262144) q[2]; -cx q[19],q[2]; -rz(-pi/131072) q[19]; -rz(-pi/262144) q[2]; -cx q[20],q[2]; -rz(pi/524288) q[2]; -cx q[20],q[2]; -rz(-pi/524288) q[2]; -rz(-pi/262144) q[20]; -cx q[21],q[2]; -rz(pi/1048576) q[2]; -cx q[21],q[2]; -rz(-pi/1048576) q[2]; -rz(-pi/524288) q[21]; -cx q[22],q[2]; -rz(pi/2097152) q[2]; -cx q[22],q[2]; -rz(-pi/2097152) q[2]; -rz(-pi/1048576) q[22]; -cx q[23],q[2]; -rz(pi/4194304) q[2]; -cx q[23],q[2]; -rz(-pi/4194304) q[2]; -rz(-pi/2097152) q[23]; -cx q[24],q[2]; -rz(pi/8388608) q[2]; -cx q[24],q[2]; -rz(-pi/8388608) q[2]; -rz(-pi/4194304) q[24]; -cx q[25],q[2]; -rz(pi/16777216) q[2]; -cx q[25],q[2]; -rz(-pi/16777216) q[2]; -rz(-pi/8388608) q[25]; -cx q[26],q[2]; -rz(pi/33554432) q[2]; -cx q[26],q[2]; -rz(-pi/33554432) q[2]; -rz(-pi/16777216) q[26]; -cx q[27],q[2]; -rz(pi/67108864) q[2]; -cx q[27],q[2]; -rz(-pi/67108864) q[2]; -rz(-pi/33554432) q[27]; -cx q[28],q[2]; -rz(pi/134217728) q[2]; -cx q[28],q[2]; -rz(-pi/134217728) q[2]; -rz(-pi/67108864) q[28]; -rz(-pi/128) q[9]; -cx q[9],q[3]; -rz(pi/128) q[3]; -cx q[9],q[3]; -rz(-pi/128) q[3]; -cx q[10],q[3]; -rz(pi/256) q[3]; -cx q[10],q[3]; -rz(-pi/128) q[10]; -rz(-pi/256) q[3]; -cx q[11],q[3]; -rz(pi/512) q[3]; -cx q[11],q[3]; -rz(-pi/256) q[11]; -rz(-pi/512) q[3]; -cx q[12],q[3]; -rz(pi/1024) q[3]; -cx q[12],q[3]; -rz(-pi/512) q[12]; -rz(-pi/1024) q[3]; -cx q[13],q[3]; -rz(pi/2048) q[3]; -cx q[13],q[3]; -rz(-pi/1024) q[13]; -rz(-pi/2048) q[3]; -cx q[14],q[3]; -rz(pi/4096) q[3]; -cx q[14],q[3]; -rz(-pi/2048) q[14]; -rz(-pi/4096) q[3]; -cx q[15],q[3]; -rz(pi/8192) q[3]; -cx q[15],q[3]; -rz(-pi/4096) q[15]; -rz(-pi/8192) q[3]; -cx q[16],q[3]; -rz(pi/16384) q[3]; -cx q[16],q[3]; -rz(-pi/8192) q[16]; -rz(-pi/16384) q[3]; -cx q[17],q[3]; -rz(pi/32768) q[3]; -cx q[17],q[3]; -rz(-pi/16384) q[17]; -rz(-pi/32768) q[3]; -cx q[18],q[3]; -rz(pi/65536) q[3]; -cx q[18],q[3]; -rz(-pi/32768) q[18]; -rz(-pi/65536) q[3]; -cx q[19],q[3]; -rz(pi/131072) q[3]; -cx q[19],q[3]; -rz(-pi/65536) q[19]; -rz(-pi/131072) q[3]; -cx q[20],q[3]; -rz(pi/262144) q[3]; -cx q[20],q[3]; -rz(-pi/131072) q[20]; -rz(-pi/262144) q[3]; -cx q[21],q[3]; -rz(pi/524288) q[3]; -cx q[21],q[3]; -rz(-pi/262144) q[21]; -rz(-pi/524288) q[3]; -cx q[22],q[3]; -rz(pi/1048576) q[3]; -cx q[22],q[3]; -rz(-pi/524288) q[22]; -rz(-pi/1048576) q[3]; -cx q[23],q[3]; -rz(pi/2097152) q[3]; -cx q[23],q[3]; -rz(-pi/1048576) q[23]; -rz(-pi/2097152) q[3]; -cx q[24],q[3]; -rz(pi/4194304) q[3]; -cx q[24],q[3]; -rz(-pi/2097152) q[24]; -rz(-pi/4194304) q[3]; -cx q[25],q[3]; -rz(pi/8388608) q[3]; -cx q[25],q[3]; -rz(-pi/4194304) q[25]; -rz(-pi/8388608) q[3]; -cx q[26],q[3]; -rz(pi/16777216) q[3]; -cx q[26],q[3]; -rz(-pi/8388608) q[26]; -rz(-pi/16777216) q[3]; -cx q[27],q[3]; -rz(pi/33554432) q[3]; -cx q[27],q[3]; -rz(-pi/16777216) q[27]; -rz(-pi/33554432) q[3]; -cx q[28],q[3]; -rz(pi/67108864) q[3]; -cx q[28],q[3]; -rz(-pi/33554432) q[28]; -rz(-pi/67108864) q[3]; -rz(-pi/64) q[9]; -cx q[9],q[4]; -rz(pi/64) q[4]; -cx q[9],q[4]; -rz(-pi/64) q[4]; -cx q[10],q[4]; -rz(pi/128) q[4]; -cx q[10],q[4]; -rz(-pi/64) q[10]; -rz(-pi/128) q[4]; -cx q[11],q[4]; -rz(pi/256) q[4]; -cx q[11],q[4]; -rz(-pi/128) q[11]; -rz(-pi/256) q[4]; -cx q[12],q[4]; -rz(pi/512) q[4]; -cx q[12],q[4]; -rz(-pi/256) q[12]; -rz(-pi/512) q[4]; -cx q[13],q[4]; -rz(pi/1024) q[4]; -cx q[13],q[4]; -rz(-pi/512) q[13]; -rz(-pi/1024) q[4]; -cx q[14],q[4]; -rz(pi/2048) q[4]; -cx q[14],q[4]; -rz(-pi/1024) q[14]; -rz(-pi/2048) q[4]; -cx q[15],q[4]; -rz(pi/4096) q[4]; -cx q[15],q[4]; -rz(-pi/2048) q[15]; -rz(-pi/4096) q[4]; -cx q[16],q[4]; -rz(pi/8192) q[4]; -cx q[16],q[4]; -rz(-pi/4096) q[16]; -rz(-pi/8192) q[4]; -cx q[17],q[4]; -rz(pi/16384) q[4]; -cx q[17],q[4]; -rz(-pi/8192) q[17]; -rz(-pi/16384) q[4]; -cx q[18],q[4]; -rz(pi/32768) q[4]; -cx q[18],q[4]; -rz(-pi/16384) q[18]; -rz(-pi/32768) q[4]; -cx q[19],q[4]; -rz(pi/65536) q[4]; -cx q[19],q[4]; -rz(-pi/32768) q[19]; -rz(-pi/65536) q[4]; -cx q[20],q[4]; -rz(pi/131072) q[4]; -cx q[20],q[4]; -rz(-pi/65536) q[20]; -rz(-pi/131072) q[4]; -cx q[21],q[4]; -rz(pi/262144) q[4]; -cx q[21],q[4]; -rz(-pi/131072) q[21]; -rz(-pi/262144) q[4]; -cx q[22],q[4]; -rz(pi/524288) q[4]; -cx q[22],q[4]; -rz(-pi/262144) q[22]; -rz(-pi/524288) q[4]; -cx q[23],q[4]; -rz(pi/1048576) q[4]; -cx q[23],q[4]; -rz(-pi/524288) q[23]; -rz(-pi/1048576) q[4]; -cx q[24],q[4]; -rz(pi/2097152) q[4]; -cx q[24],q[4]; -rz(-pi/1048576) q[24]; -rz(-pi/2097152) q[4]; -cx q[25],q[4]; -rz(pi/4194304) q[4]; -cx q[25],q[4]; -rz(-pi/2097152) q[25]; -rz(-pi/4194304) q[4]; -cx q[26],q[4]; -rz(pi/8388608) q[4]; -cx q[26],q[4]; -rz(-pi/4194304) q[26]; -rz(-pi/8388608) q[4]; -cx q[27],q[4]; -rz(pi/16777216) q[4]; -cx q[27],q[4]; -rz(-pi/8388608) q[27]; -rz(-pi/16777216) q[4]; -cx q[28],q[4]; -rz(pi/33554432) q[4]; -cx q[28],q[4]; -rz(-pi/16777216) q[28]; -rz(-pi/33554432) q[4]; -rz(-pi/32) q[9]; -cx q[9],q[5]; -rz(pi/32) q[5]; -cx q[9],q[5]; -rz(-pi/32) q[5]; -cx q[10],q[5]; -rz(pi/64) q[5]; -cx q[10],q[5]; -rz(-pi/32) q[10]; -rz(-pi/64) q[5]; -cx q[11],q[5]; -rz(pi/128) q[5]; -cx q[11],q[5]; -rz(-pi/64) q[11]; -rz(-pi/128) q[5]; -cx q[12],q[5]; -rz(pi/256) q[5]; -cx q[12],q[5]; -rz(-pi/128) q[12]; -rz(-pi/256) q[5]; -cx q[13],q[5]; -rz(pi/512) q[5]; -cx q[13],q[5]; -rz(-pi/256) q[13]; -rz(-pi/512) q[5]; -cx q[14],q[5]; -rz(pi/1024) q[5]; -cx q[14],q[5]; -rz(-pi/512) q[14]; -rz(-pi/1024) q[5]; -cx q[15],q[5]; -rz(pi/2048) q[5]; -cx q[15],q[5]; -rz(-pi/1024) q[15]; -rz(-pi/2048) q[5]; -cx q[16],q[5]; -rz(pi/4096) q[5]; -cx q[16],q[5]; -rz(-pi/2048) q[16]; -rz(-pi/4096) q[5]; -cx q[17],q[5]; -rz(pi/8192) q[5]; -cx q[17],q[5]; -rz(-pi/4096) q[17]; -rz(-pi/8192) q[5]; -cx q[18],q[5]; -rz(pi/16384) q[5]; -cx q[18],q[5]; -rz(-pi/8192) q[18]; -rz(-pi/16384) q[5]; -cx q[19],q[5]; -rz(pi/32768) q[5]; -cx q[19],q[5]; -rz(-pi/16384) q[19]; -rz(-pi/32768) q[5]; -cx q[20],q[5]; -rz(pi/65536) q[5]; -cx q[20],q[5]; -rz(-pi/32768) q[20]; -rz(-pi/65536) q[5]; -cx q[21],q[5]; -rz(pi/131072) q[5]; -cx q[21],q[5]; -rz(-pi/65536) q[21]; -rz(-pi/131072) q[5]; -cx q[22],q[5]; -rz(pi/262144) q[5]; -cx q[22],q[5]; -rz(-pi/131072) q[22]; -rz(-pi/262144) q[5]; -cx q[23],q[5]; -rz(pi/524288) q[5]; -cx q[23],q[5]; -rz(-pi/262144) q[23]; -rz(-pi/524288) q[5]; -cx q[24],q[5]; -rz(pi/1048576) q[5]; -cx q[24],q[5]; -rz(-pi/524288) q[24]; -rz(-pi/1048576) q[5]; -cx q[25],q[5]; -rz(pi/2097152) q[5]; -cx q[25],q[5]; -rz(-pi/1048576) q[25]; -rz(-pi/2097152) q[5]; -cx q[26],q[5]; -rz(pi/4194304) q[5]; -cx q[26],q[5]; -rz(-pi/2097152) q[26]; -rz(-pi/4194304) q[5]; -cx q[27],q[5]; -rz(pi/8388608) q[5]; -cx q[27],q[5]; -rz(-pi/4194304) q[27]; -rz(-pi/8388608) q[5]; -cx q[28],q[5]; -rz(pi/16777216) q[5]; -cx q[28],q[5]; -rz(-pi/8388608) q[28]; -rz(-pi/16777216) q[5]; -rz(-pi/16) q[9]; -cx q[9],q[6]; -rz(pi/16) q[6]; -cx q[9],q[6]; -rz(-pi/16) q[6]; -cx q[10],q[6]; -rz(pi/32) q[6]; -cx q[10],q[6]; -rz(-pi/16) q[10]; -rz(-pi/32) q[6]; -cx q[11],q[6]; -rz(pi/64) q[6]; -cx q[11],q[6]; -rz(-pi/32) q[11]; -rz(-pi/64) q[6]; -cx q[12],q[6]; -rz(pi/128) q[6]; -cx q[12],q[6]; -rz(-pi/64) q[12]; -rz(-pi/128) q[6]; -cx q[13],q[6]; -rz(pi/256) q[6]; -cx q[13],q[6]; -rz(-pi/128) q[13]; -rz(-pi/256) q[6]; -cx q[14],q[6]; -rz(pi/512) q[6]; -cx q[14],q[6]; -rz(-pi/256) q[14]; -rz(-pi/512) q[6]; -cx q[15],q[6]; -rz(pi/1024) q[6]; -cx q[15],q[6]; -rz(-pi/512) q[15]; -rz(-pi/1024) q[6]; -cx q[16],q[6]; -rz(pi/2048) q[6]; -cx q[16],q[6]; -rz(-pi/1024) q[16]; -rz(-pi/2048) q[6]; -cx q[17],q[6]; -rz(pi/4096) q[6]; -cx q[17],q[6]; -rz(-pi/2048) q[17]; -rz(-pi/4096) q[6]; -cx q[18],q[6]; -rz(pi/8192) q[6]; -cx q[18],q[6]; -rz(-pi/4096) q[18]; -rz(-pi/8192) q[6]; -cx q[19],q[6]; -rz(pi/16384) q[6]; -cx q[19],q[6]; -rz(-pi/8192) q[19]; -rz(-pi/16384) q[6]; -cx q[20],q[6]; -rz(pi/32768) q[6]; -cx q[20],q[6]; -rz(-pi/16384) q[20]; -rz(-pi/32768) q[6]; -cx q[21],q[6]; -rz(pi/65536) q[6]; -cx q[21],q[6]; -rz(-pi/32768) q[21]; -rz(-pi/65536) q[6]; -cx q[22],q[6]; -rz(pi/131072) q[6]; -cx q[22],q[6]; -rz(-pi/65536) q[22]; -rz(-pi/131072) q[6]; -cx q[23],q[6]; -rz(pi/262144) q[6]; -cx q[23],q[6]; -rz(-pi/131072) q[23]; -rz(-pi/262144) q[6]; -cx q[24],q[6]; -rz(pi/524288) q[6]; -cx q[24],q[6]; -rz(-pi/262144) q[24]; -rz(-pi/524288) q[6]; -cx q[25],q[6]; -rz(pi/1048576) q[6]; -cx q[25],q[6]; -rz(-pi/524288) q[25]; -rz(-pi/1048576) q[6]; -cx q[26],q[6]; -rz(pi/2097152) q[6]; -cx q[26],q[6]; -rz(-pi/1048576) q[26]; -rz(-pi/2097152) q[6]; -cx q[27],q[6]; -rz(pi/4194304) q[6]; -cx q[27],q[6]; -rz(-pi/2097152) q[27]; -rz(-pi/4194304) q[6]; -cx q[28],q[6]; -rz(pi/8388608) q[6]; -cx q[28],q[6]; -rz(-pi/4194304) q[28]; -rz(-pi/8388608) q[6]; -rz(-pi/8) q[9]; -cx q[9],q[7]; -rz(pi/8) q[7]; -cx q[9],q[7]; -rz(-pi/8) q[7]; -cx q[10],q[7]; -rz(pi/16) q[7]; -cx q[10],q[7]; -rz(-pi/8) q[10]; -rz(-pi/16) q[7]; -cx q[11],q[7]; -rz(pi/32) q[7]; -cx q[11],q[7]; -rz(-pi/16) q[11]; -rz(-pi/32) q[7]; -cx q[12],q[7]; -rz(pi/64) q[7]; -cx q[12],q[7]; -rz(-pi/32) q[12]; -rz(-pi/64) q[7]; -cx q[13],q[7]; -rz(pi/128) q[7]; -cx q[13],q[7]; -rz(-pi/64) q[13]; -rz(-pi/128) q[7]; -cx q[14],q[7]; -rz(pi/256) q[7]; -cx q[14],q[7]; -rz(-pi/128) q[14]; -rz(-pi/256) q[7]; -cx q[15],q[7]; -rz(pi/512) q[7]; -cx q[15],q[7]; -rz(-pi/256) q[15]; -rz(-pi/512) q[7]; -cx q[16],q[7]; -rz(pi/1024) q[7]; -cx q[16],q[7]; -rz(-pi/512) q[16]; -rz(-pi/1024) q[7]; -cx q[17],q[7]; -rz(pi/2048) q[7]; -cx q[17],q[7]; -rz(-pi/1024) q[17]; -rz(-pi/2048) q[7]; -cx q[18],q[7]; -rz(pi/4096) q[7]; -cx q[18],q[7]; -rz(-pi/2048) q[18]; -rz(-pi/4096) q[7]; -cx q[19],q[7]; -rz(pi/8192) q[7]; -cx q[19],q[7]; -rz(-pi/4096) q[19]; -rz(-pi/8192) q[7]; -cx q[20],q[7]; -rz(pi/16384) q[7]; -cx q[20],q[7]; -rz(-pi/8192) q[20]; -rz(-pi/16384) q[7]; -cx q[21],q[7]; -rz(pi/32768) q[7]; -cx q[21],q[7]; -rz(-pi/16384) q[21]; -rz(-pi/32768) q[7]; -cx q[22],q[7]; -rz(pi/65536) q[7]; -cx q[22],q[7]; -rz(-pi/32768) q[22]; -rz(-pi/65536) q[7]; -cx q[23],q[7]; -rz(pi/131072) q[7]; -cx q[23],q[7]; -rz(-pi/65536) q[23]; -rz(-pi/131072) q[7]; -cx q[24],q[7]; -rz(pi/262144) q[7]; -cx q[24],q[7]; -rz(-pi/131072) q[24]; -rz(-pi/262144) q[7]; -cx q[25],q[7]; -rz(pi/524288) q[7]; -cx q[25],q[7]; -rz(-pi/262144) q[25]; -rz(-pi/524288) q[7]; -cx q[26],q[7]; -rz(pi/1048576) q[7]; -cx q[26],q[7]; -rz(-pi/524288) q[26]; -rz(-pi/1048576) q[7]; -cx q[27],q[7]; -rz(pi/2097152) q[7]; -cx q[27],q[7]; -rz(-pi/1048576) q[27]; -rz(-pi/2097152) q[7]; -cx q[28],q[7]; -rz(pi/4194304) q[7]; -cx q[28],q[7]; -rz(-pi/2097152) q[28]; -rz(-pi/4194304) q[7]; -rz(-pi/4) q[9]; -cx q[9],q[8]; -rz(pi/4) q[8]; -cx q[9],q[8]; -rz(-pi/4) q[8]; -cx q[10],q[8]; -rz(pi/8) q[8]; -cx q[10],q[8]; -rz(-pi/4) q[10]; -rz(-pi/8) q[8]; -cx q[11],q[8]; -rz(pi/16) q[8]; -cx q[11],q[8]; -rz(-pi/8) q[11]; -rz(-pi/16) q[8]; -cx q[12],q[8]; -rz(pi/32) q[8]; -cx q[12],q[8]; -rz(-pi/16) q[12]; -rz(-pi/32) q[8]; -cx q[13],q[8]; -rz(pi/64) q[8]; -cx q[13],q[8]; -rz(-pi/32) q[13]; -rz(-pi/64) q[8]; -cx q[14],q[8]; -rz(pi/128) q[8]; -cx q[14],q[8]; -rz(-pi/64) q[14]; -rz(-pi/128) q[8]; -cx q[15],q[8]; -rz(pi/256) q[8]; -cx q[15],q[8]; -rz(-pi/128) q[15]; -rz(-pi/256) q[8]; -cx q[16],q[8]; -rz(pi/512) q[8]; -cx q[16],q[8]; -rz(-pi/256) q[16]; -rz(-pi/512) q[8]; -cx q[17],q[8]; -rz(pi/1024) q[8]; -cx q[17],q[8]; -rz(-pi/512) q[17]; -rz(-pi/1024) q[8]; -cx q[18],q[8]; -rz(pi/2048) q[8]; -cx q[18],q[8]; -rz(-pi/1024) q[18]; -rz(-pi/2048) q[8]; -cx q[19],q[8]; -rz(pi/4096) q[8]; -cx q[19],q[8]; -rz(-pi/2048) q[19]; -rz(-pi/4096) q[8]; -cx q[20],q[8]; -rz(pi/8192) q[8]; -cx q[20],q[8]; -rz(-pi/4096) q[20]; -rz(-pi/8192) q[8]; -cx q[21],q[8]; -rz(pi/16384) q[8]; -cx q[21],q[8]; -rz(-pi/8192) q[21]; -rz(-pi/16384) q[8]; -cx q[22],q[8]; -rz(pi/32768) q[8]; -cx q[22],q[8]; -rz(-pi/16384) q[22]; -rz(-pi/32768) q[8]; -cx q[23],q[8]; -rz(pi/65536) q[8]; -cx q[23],q[8]; -rz(-pi/32768) q[23]; -rz(-pi/65536) q[8]; -cx q[24],q[8]; -rz(pi/131072) q[8]; -cx q[24],q[8]; -rz(-pi/65536) q[24]; -rz(-pi/131072) q[8]; -cx q[25],q[8]; -rz(pi/262144) q[8]; -cx q[25],q[8]; -rz(-pi/131072) q[25]; -rz(-pi/262144) q[8]; -cx q[26],q[8]; -rz(pi/524288) q[8]; -cx q[26],q[8]; -rz(-pi/262144) q[26]; -rz(-pi/524288) q[8]; -cx q[27],q[8]; -rz(pi/1048576) q[8]; -cx q[27],q[8]; -rz(-pi/524288) q[27]; -rz(-pi/1048576) q[8]; -cx q[28],q[8]; -rz(pi/2097152) q[8]; -cx q[28],q[8]; -rz(-pi/1048576) q[28]; -rz(-pi/2097152) q[8]; -rz(pi/2) q[9]; -sx q[9]; -rz(pi/2) q[9]; -cx q[10],q[9]; -rz(pi/4) q[9]; -cx q[10],q[9]; -rz(pi/2) q[10]; -sx q[10]; -rz(pi/2) q[10]; -rz(-pi/4) q[9]; -cx q[11],q[9]; -rz(pi/8) q[9]; -cx q[11],q[9]; -rz(-pi/4) q[11]; -cx q[11],q[10]; -rz(pi/4) q[10]; -cx q[11],q[10]; -rz(-pi/4) q[10]; -rz(pi/2) q[11]; -sx q[11]; -rz(pi/2) q[11]; -rz(-pi/8) q[9]; -cx q[12],q[9]; -rz(pi/16) q[9]; -cx q[12],q[9]; -rz(-pi/8) q[12]; -cx q[12],q[10]; -rz(pi/8) q[10]; -cx q[12],q[10]; -rz(-pi/8) q[10]; -rz(-pi/4) q[12]; -cx q[12],q[11]; -rz(pi/4) q[11]; -cx q[12],q[11]; -rz(-pi/4) q[11]; -rz(pi/2) q[12]; -sx q[12]; -rz(pi/2) q[12]; -rz(-pi/16) q[9]; -cx q[13],q[9]; -rz(pi/32) q[9]; -cx q[13],q[9]; -rz(-pi/16) q[13]; -cx q[13],q[10]; -rz(pi/16) q[10]; -cx q[13],q[10]; -rz(-pi/16) q[10]; -rz(-pi/8) q[13]; -cx q[13],q[11]; -rz(pi/8) q[11]; -cx q[13],q[11]; -rz(-pi/8) q[11]; -rz(-pi/4) q[13]; -cx q[13],q[12]; -rz(pi/4) q[12]; -cx q[13],q[12]; -rz(-pi/4) q[12]; -rz(pi/2) q[13]; -sx q[13]; -rz(pi/2) q[13]; -rz(-pi/32) q[9]; -cx q[14],q[9]; -rz(pi/64) q[9]; -cx q[14],q[9]; -rz(-pi/32) q[14]; -cx q[14],q[10]; -rz(pi/32) q[10]; -cx q[14],q[10]; -rz(-pi/32) q[10]; -rz(-pi/16) q[14]; -cx q[14],q[11]; -rz(pi/16) q[11]; -cx q[14],q[11]; -rz(-pi/16) q[11]; -rz(-pi/8) q[14]; -cx q[14],q[12]; -rz(pi/8) q[12]; -cx q[14],q[12]; -rz(-pi/8) q[12]; -rz(-pi/4) q[14]; -cx q[14],q[13]; -rz(pi/4) q[13]; -cx q[14],q[13]; -rz(-pi/4) q[13]; -rz(pi/2) q[14]; -sx q[14]; -rz(pi/2) q[14]; -rz(-pi/64) q[9]; -cx q[15],q[9]; -rz(pi/128) q[9]; -cx q[15],q[9]; -rz(-pi/64) q[15]; -cx q[15],q[10]; -rz(pi/64) q[10]; -cx q[15],q[10]; -rz(-pi/64) q[10]; -rz(-pi/32) q[15]; -cx q[15],q[11]; -rz(pi/32) q[11]; -cx q[15],q[11]; -rz(-pi/32) q[11]; -rz(-pi/16) q[15]; -cx q[15],q[12]; -rz(pi/16) q[12]; -cx q[15],q[12]; -rz(-pi/16) q[12]; -rz(-pi/8) q[15]; -cx q[15],q[13]; -rz(pi/8) q[13]; -cx q[15],q[13]; -rz(-pi/8) q[13]; -rz(-pi/4) q[15]; -cx q[15],q[14]; -rz(pi/4) q[14]; -cx q[15],q[14]; -rz(-pi/4) q[14]; -rz(pi/2) q[15]; -sx q[15]; -rz(pi/2) q[15]; -rz(-pi/128) q[9]; -cx q[16],q[9]; -rz(pi/256) q[9]; -cx q[16],q[9]; -rz(-pi/128) q[16]; -cx q[16],q[10]; -rz(pi/128) q[10]; -cx q[16],q[10]; -rz(-pi/128) q[10]; -rz(-pi/64) q[16]; -cx q[16],q[11]; -rz(pi/64) q[11]; -cx q[16],q[11]; -rz(-pi/64) q[11]; -rz(-pi/32) q[16]; -cx q[16],q[12]; -rz(pi/32) q[12]; -cx q[16],q[12]; -rz(-pi/32) q[12]; -rz(-pi/16) q[16]; -cx q[16],q[13]; -rz(pi/16) q[13]; -cx q[16],q[13]; -rz(-pi/16) q[13]; -rz(-pi/8) q[16]; -cx q[16],q[14]; -rz(pi/8) q[14]; -cx q[16],q[14]; -rz(-pi/8) q[14]; -rz(-pi/4) q[16]; -cx q[16],q[15]; -rz(pi/4) q[15]; -cx q[16],q[15]; -rz(-pi/4) q[15]; -rz(pi/2) q[16]; -sx q[16]; -rz(pi/2) q[16]; -rz(-pi/256) q[9]; -cx q[17],q[9]; -rz(pi/512) q[9]; -cx q[17],q[9]; -rz(-pi/256) q[17]; -cx q[17],q[10]; -rz(pi/256) q[10]; -cx q[17],q[10]; -rz(-pi/256) q[10]; -rz(-pi/128) q[17]; -cx q[17],q[11]; -rz(pi/128) q[11]; -cx q[17],q[11]; -rz(-pi/128) q[11]; -rz(-pi/64) q[17]; -cx q[17],q[12]; -rz(pi/64) q[12]; -cx q[17],q[12]; -rz(-pi/64) q[12]; -rz(-pi/32) q[17]; -cx q[17],q[13]; -rz(pi/32) q[13]; -cx q[17],q[13]; -rz(-pi/32) q[13]; -rz(-pi/16) q[17]; -cx q[17],q[14]; -rz(pi/16) q[14]; -cx q[17],q[14]; -rz(-pi/16) q[14]; -rz(-pi/8) q[17]; -cx q[17],q[15]; -rz(pi/8) q[15]; -cx q[17],q[15]; -rz(-pi/8) q[15]; -rz(-pi/4) q[17]; -cx q[17],q[16]; -rz(pi/4) q[16]; -cx q[17],q[16]; -rz(-pi/4) q[16]; -rz(pi/2) q[17]; -sx q[17]; -rz(pi/2) q[17]; -rz(-pi/512) q[9]; -cx q[18],q[9]; -rz(pi/1024) q[9]; -cx q[18],q[9]; -rz(-pi/512) q[18]; -cx q[18],q[10]; -rz(pi/512) q[10]; -cx q[18],q[10]; -rz(-pi/512) q[10]; -rz(-pi/256) q[18]; -cx q[18],q[11]; -rz(pi/256) q[11]; -cx q[18],q[11]; -rz(-pi/256) q[11]; -rz(-pi/128) q[18]; -cx q[18],q[12]; -rz(pi/128) q[12]; -cx q[18],q[12]; -rz(-pi/128) q[12]; -rz(-pi/64) q[18]; -cx q[18],q[13]; -rz(pi/64) q[13]; -cx q[18],q[13]; -rz(-pi/64) q[13]; -rz(-pi/32) q[18]; -cx q[18],q[14]; -rz(pi/32) q[14]; -cx q[18],q[14]; -rz(-pi/32) q[14]; -rz(-pi/16) q[18]; -cx q[18],q[15]; -rz(pi/16) q[15]; -cx q[18],q[15]; -rz(-pi/16) q[15]; -rz(-pi/8) q[18]; -cx q[18],q[16]; -rz(pi/8) q[16]; -cx q[18],q[16]; -rz(-pi/8) q[16]; -rz(-pi/4) q[18]; -cx q[18],q[17]; -rz(pi/4) q[17]; -cx q[18],q[17]; -rz(-pi/4) q[17]; -rz(pi/2) q[18]; -sx q[18]; -rz(pi/2) q[18]; -rz(-pi/1024) q[9]; -cx q[19],q[9]; -rz(pi/2048) q[9]; -cx q[19],q[9]; -rz(-pi/1024) q[19]; -cx q[19],q[10]; -rz(pi/1024) q[10]; -cx q[19],q[10]; -rz(-pi/1024) q[10]; -rz(-pi/512) q[19]; -cx q[19],q[11]; -rz(pi/512) q[11]; -cx q[19],q[11]; -rz(-pi/512) q[11]; -rz(-pi/256) q[19]; -cx q[19],q[12]; -rz(pi/256) q[12]; -cx q[19],q[12]; -rz(-pi/256) q[12]; -rz(-pi/128) q[19]; -cx q[19],q[13]; -rz(pi/128) q[13]; -cx q[19],q[13]; -rz(-pi/128) q[13]; -rz(-pi/64) q[19]; -cx q[19],q[14]; -rz(pi/64) q[14]; -cx q[19],q[14]; -rz(-pi/64) q[14]; -rz(-pi/32) q[19]; -cx q[19],q[15]; -rz(pi/32) q[15]; -cx q[19],q[15]; -rz(-pi/32) q[15]; -rz(-pi/16) q[19]; -cx q[19],q[16]; -rz(pi/16) q[16]; -cx q[19],q[16]; -rz(-pi/16) q[16]; -rz(-pi/8) q[19]; -cx q[19],q[17]; -rz(pi/8) q[17]; -cx q[19],q[17]; -rz(-pi/8) q[17]; -rz(-pi/4) q[19]; -cx q[19],q[18]; -rz(pi/4) q[18]; -cx q[19],q[18]; -rz(-pi/4) q[18]; -rz(pi/2) q[19]; -sx q[19]; -rz(pi/2) q[19]; -rz(-pi/2048) q[9]; -cx q[20],q[9]; -rz(pi/4096) q[9]; -cx q[20],q[9]; -rz(-pi/2048) q[20]; -cx q[20],q[10]; -rz(pi/2048) q[10]; -cx q[20],q[10]; -rz(-pi/2048) q[10]; -rz(-pi/1024) q[20]; -cx q[20],q[11]; -rz(pi/1024) q[11]; -cx q[20],q[11]; -rz(-pi/1024) q[11]; -rz(-pi/512) q[20]; -cx q[20],q[12]; -rz(pi/512) q[12]; -cx q[20],q[12]; -rz(-pi/512) q[12]; -rz(-pi/256) q[20]; -cx q[20],q[13]; -rz(pi/256) q[13]; -cx q[20],q[13]; -rz(-pi/256) q[13]; -rz(-pi/128) q[20]; -cx q[20],q[14]; -rz(pi/128) q[14]; -cx q[20],q[14]; -rz(-pi/128) q[14]; -rz(-pi/64) q[20]; -cx q[20],q[15]; -rz(pi/64) q[15]; -cx q[20],q[15]; -rz(-pi/64) q[15]; -rz(-pi/32) q[20]; -cx q[20],q[16]; -rz(pi/32) q[16]; -cx q[20],q[16]; -rz(-pi/32) q[16]; -rz(-pi/16) q[20]; -cx q[20],q[17]; -rz(pi/16) q[17]; -cx q[20],q[17]; -rz(-pi/16) q[17]; -rz(-pi/8) q[20]; -cx q[20],q[18]; -rz(pi/8) q[18]; -cx q[20],q[18]; -rz(-pi/8) q[18]; -rz(-pi/4) q[20]; -cx q[20],q[19]; -rz(pi/4) q[19]; -cx q[20],q[19]; -rz(-pi/4) q[19]; -rz(pi/2) q[20]; -sx q[20]; -rz(pi/2) q[20]; -rz(-pi/4096) q[9]; -cx q[21],q[9]; -rz(pi/8192) q[9]; -cx q[21],q[9]; -rz(-pi/4096) q[21]; -cx q[21],q[10]; -rz(pi/4096) q[10]; -cx q[21],q[10]; -rz(-pi/4096) q[10]; -rz(-pi/2048) q[21]; -cx q[21],q[11]; -rz(pi/2048) q[11]; -cx q[21],q[11]; -rz(-pi/2048) q[11]; -rz(-pi/1024) q[21]; -cx q[21],q[12]; -rz(pi/1024) q[12]; -cx q[21],q[12]; -rz(-pi/1024) q[12]; -rz(-pi/512) q[21]; -cx q[21],q[13]; -rz(pi/512) q[13]; -cx q[21],q[13]; -rz(-pi/512) q[13]; -rz(-pi/256) q[21]; -cx q[21],q[14]; -rz(pi/256) q[14]; -cx q[21],q[14]; -rz(-pi/256) q[14]; -rz(-pi/128) q[21]; -cx q[21],q[15]; -rz(pi/128) q[15]; -cx q[21],q[15]; -rz(-pi/128) q[15]; -rz(-pi/64) q[21]; -cx q[21],q[16]; -rz(pi/64) q[16]; -cx q[21],q[16]; -rz(-pi/64) q[16]; -rz(-pi/32) q[21]; -cx q[21],q[17]; -rz(pi/32) q[17]; -cx q[21],q[17]; -rz(-pi/32) q[17]; -rz(-pi/16) q[21]; -cx q[21],q[18]; -rz(pi/16) q[18]; -cx q[21],q[18]; -rz(-pi/16) q[18]; -rz(-pi/8) q[21]; -cx q[21],q[19]; -rz(pi/8) q[19]; -cx q[21],q[19]; -rz(-pi/8) q[19]; -rz(-pi/4) q[21]; -cx q[21],q[20]; -rz(pi/4) q[20]; -cx q[21],q[20]; -rz(-pi/4) q[20]; -rz(pi/2) q[21]; -sx q[21]; -rz(pi/2) q[21]; -rz(-pi/8192) q[9]; -cx q[22],q[9]; -rz(pi/16384) q[9]; -cx q[22],q[9]; -rz(-pi/8192) q[22]; -cx q[22],q[10]; -rz(pi/8192) q[10]; -cx q[22],q[10]; -rz(-pi/8192) q[10]; -rz(-pi/4096) q[22]; -cx q[22],q[11]; -rz(pi/4096) q[11]; -cx q[22],q[11]; -rz(-pi/4096) q[11]; -rz(-pi/2048) q[22]; -cx q[22],q[12]; -rz(pi/2048) q[12]; -cx q[22],q[12]; -rz(-pi/2048) q[12]; -rz(-pi/1024) q[22]; -cx q[22],q[13]; -rz(pi/1024) q[13]; -cx q[22],q[13]; -rz(-pi/1024) q[13]; -rz(-pi/512) q[22]; -cx q[22],q[14]; -rz(pi/512) q[14]; -cx q[22],q[14]; -rz(-pi/512) q[14]; -rz(-pi/256) q[22]; -cx q[22],q[15]; -rz(pi/256) q[15]; -cx q[22],q[15]; -rz(-pi/256) q[15]; -rz(-pi/128) q[22]; -cx q[22],q[16]; -rz(pi/128) q[16]; -cx q[22],q[16]; -rz(-pi/128) q[16]; -rz(-pi/64) q[22]; -cx q[22],q[17]; -rz(pi/64) q[17]; -cx q[22],q[17]; -rz(-pi/64) q[17]; -rz(-pi/32) q[22]; -cx q[22],q[18]; -rz(pi/32) q[18]; -cx q[22],q[18]; -rz(-pi/32) q[18]; -rz(-pi/16) q[22]; -cx q[22],q[19]; -rz(pi/16) q[19]; -cx q[22],q[19]; -rz(-pi/16) q[19]; -rz(-pi/8) q[22]; -cx q[22],q[20]; -rz(pi/8) q[20]; -cx q[22],q[20]; -rz(-pi/8) q[20]; -rz(-pi/4) q[22]; -cx q[22],q[21]; -rz(pi/4) q[21]; -cx q[22],q[21]; -rz(-pi/4) q[21]; -rz(pi/2) q[22]; -sx q[22]; -rz(pi/2) q[22]; -rz(-pi/16384) q[9]; -cx q[23],q[9]; -rz(pi/32768) q[9]; -cx q[23],q[9]; -rz(-pi/16384) q[23]; -cx q[23],q[10]; -rz(pi/16384) q[10]; -cx q[23],q[10]; -rz(-pi/16384) q[10]; -rz(-pi/8192) q[23]; -cx q[23],q[11]; -rz(pi/8192) q[11]; -cx q[23],q[11]; -rz(-pi/8192) q[11]; -rz(-pi/4096) q[23]; -cx q[23],q[12]; -rz(pi/4096) q[12]; -cx q[23],q[12]; -rz(-pi/4096) q[12]; -rz(-pi/2048) q[23]; -cx q[23],q[13]; -rz(pi/2048) q[13]; -cx q[23],q[13]; -rz(-pi/2048) q[13]; -rz(-pi/1024) q[23]; -cx q[23],q[14]; -rz(pi/1024) q[14]; -cx q[23],q[14]; -rz(-pi/1024) q[14]; -rz(-pi/512) q[23]; -cx q[23],q[15]; -rz(pi/512) q[15]; -cx q[23],q[15]; -rz(-pi/512) q[15]; -rz(-pi/256) q[23]; -cx q[23],q[16]; -rz(pi/256) q[16]; -cx q[23],q[16]; -rz(-pi/256) q[16]; -rz(-pi/128) q[23]; -cx q[23],q[17]; -rz(pi/128) q[17]; -cx q[23],q[17]; -rz(-pi/128) q[17]; -rz(-pi/64) q[23]; -cx q[23],q[18]; -rz(pi/64) q[18]; -cx q[23],q[18]; -rz(-pi/64) q[18]; -rz(-pi/32) q[23]; -cx q[23],q[19]; -rz(pi/32) q[19]; -cx q[23],q[19]; -rz(-pi/32) q[19]; -rz(-pi/16) q[23]; -cx q[23],q[20]; -rz(pi/16) q[20]; -cx q[23],q[20]; -rz(-pi/16) q[20]; -rz(-pi/8) q[23]; -cx q[23],q[21]; -rz(pi/8) q[21]; -cx q[23],q[21]; -rz(-pi/8) q[21]; -rz(-pi/4) q[23]; -cx q[23],q[22]; -rz(pi/4) q[22]; -cx q[23],q[22]; -rz(-pi/4) q[22]; -rz(pi/2) q[23]; -sx q[23]; -rz(pi/2) q[23]; -rz(-pi/32768) q[9]; -cx q[24],q[9]; -rz(pi/65536) q[9]; -cx q[24],q[9]; -rz(-pi/32768) q[24]; -cx q[24],q[10]; -rz(pi/32768) q[10]; -cx q[24],q[10]; -rz(-pi/32768) q[10]; -rz(-pi/16384) q[24]; -cx q[24],q[11]; -rz(pi/16384) q[11]; -cx q[24],q[11]; -rz(-pi/16384) q[11]; -rz(-pi/8192) q[24]; -cx q[24],q[12]; -rz(pi/8192) q[12]; -cx q[24],q[12]; -rz(-pi/8192) q[12]; -rz(-pi/4096) q[24]; -cx q[24],q[13]; -rz(pi/4096) q[13]; -cx q[24],q[13]; -rz(-pi/4096) q[13]; -rz(-pi/2048) q[24]; -cx q[24],q[14]; -rz(pi/2048) q[14]; -cx q[24],q[14]; -rz(-pi/2048) q[14]; -rz(-pi/1024) q[24]; -cx q[24],q[15]; -rz(pi/1024) q[15]; -cx q[24],q[15]; -rz(-pi/1024) q[15]; -rz(-pi/512) q[24]; -cx q[24],q[16]; -rz(pi/512) q[16]; -cx q[24],q[16]; -rz(-pi/512) q[16]; -rz(-pi/256) q[24]; -cx q[24],q[17]; -rz(pi/256) q[17]; -cx q[24],q[17]; -rz(-pi/256) q[17]; -rz(-pi/128) q[24]; -cx q[24],q[18]; -rz(pi/128) q[18]; -cx q[24],q[18]; -rz(-pi/128) q[18]; -rz(-pi/64) q[24]; -cx q[24],q[19]; -rz(pi/64) q[19]; -cx q[24],q[19]; -rz(-pi/64) q[19]; -rz(-pi/32) q[24]; -cx q[24],q[20]; -rz(pi/32) q[20]; -cx q[24],q[20]; -rz(-pi/32) q[20]; -rz(-pi/16) q[24]; -cx q[24],q[21]; -rz(pi/16) q[21]; -cx q[24],q[21]; -rz(-pi/16) q[21]; -rz(-pi/8) q[24]; -cx q[24],q[22]; -rz(pi/8) q[22]; -cx q[24],q[22]; -rz(-pi/8) q[22]; -rz(-pi/4) q[24]; -cx q[24],q[23]; -rz(pi/4) q[23]; -cx q[24],q[23]; -rz(-pi/4) q[23]; -rz(pi/2) q[24]; -sx q[24]; -rz(pi/2) q[24]; -rz(-pi/65536) q[9]; -cx q[25],q[9]; -rz(pi/131072) q[9]; -cx q[25],q[9]; -rz(-pi/65536) q[25]; -cx q[25],q[10]; -rz(pi/65536) q[10]; -cx q[25],q[10]; -rz(-pi/65536) q[10]; -rz(-pi/32768) q[25]; -cx q[25],q[11]; -rz(pi/32768) q[11]; -cx q[25],q[11]; -rz(-pi/32768) q[11]; -rz(-pi/16384) q[25]; -cx q[25],q[12]; -rz(pi/16384) q[12]; -cx q[25],q[12]; -rz(-pi/16384) q[12]; -rz(-pi/8192) q[25]; -cx q[25],q[13]; -rz(pi/8192) q[13]; -cx q[25],q[13]; -rz(-pi/8192) q[13]; -rz(-pi/4096) q[25]; -cx q[25],q[14]; -rz(pi/4096) q[14]; -cx q[25],q[14]; -rz(-pi/4096) q[14]; -rz(-pi/2048) q[25]; -cx q[25],q[15]; -rz(pi/2048) q[15]; -cx q[25],q[15]; -rz(-pi/2048) q[15]; -rz(-pi/1024) q[25]; -cx q[25],q[16]; -rz(pi/1024) q[16]; -cx q[25],q[16]; -rz(-pi/1024) q[16]; -rz(-pi/512) q[25]; -cx q[25],q[17]; -rz(pi/512) q[17]; -cx q[25],q[17]; -rz(-pi/512) q[17]; -rz(-pi/256) q[25]; -cx q[25],q[18]; -rz(pi/256) q[18]; -cx q[25],q[18]; -rz(-pi/256) q[18]; -rz(-pi/128) q[25]; -cx q[25],q[19]; -rz(pi/128) q[19]; -cx q[25],q[19]; -rz(-pi/128) q[19]; -rz(-pi/64) q[25]; -cx q[25],q[20]; -rz(pi/64) q[20]; -cx q[25],q[20]; -rz(-pi/64) q[20]; -rz(-pi/32) q[25]; -cx q[25],q[21]; -rz(pi/32) q[21]; -cx q[25],q[21]; -rz(-pi/32) q[21]; -rz(-pi/16) q[25]; -cx q[25],q[22]; -rz(pi/16) q[22]; -cx q[25],q[22]; -rz(-pi/16) q[22]; -rz(-pi/8) q[25]; -cx q[25],q[23]; -rz(pi/8) q[23]; -cx q[25],q[23]; -rz(-pi/8) q[23]; -rz(-pi/4) q[25]; -cx q[25],q[24]; -rz(pi/4) q[24]; -cx q[25],q[24]; -rz(-pi/4) q[24]; -rz(pi/2) q[25]; -sx q[25]; -rz(pi/2) q[25]; -rz(-pi/131072) q[9]; -cx q[26],q[9]; -rz(pi/262144) q[9]; -cx q[26],q[9]; -rz(-pi/131072) q[26]; -cx q[26],q[10]; -rz(pi/131072) q[10]; -cx q[26],q[10]; -rz(-pi/131072) q[10]; -rz(-pi/65536) q[26]; -cx q[26],q[11]; -rz(pi/65536) q[11]; -cx q[26],q[11]; -rz(-pi/65536) q[11]; -rz(-pi/32768) q[26]; -cx q[26],q[12]; -rz(pi/32768) q[12]; -cx q[26],q[12]; -rz(-pi/32768) q[12]; -rz(-pi/16384) q[26]; -cx q[26],q[13]; -rz(pi/16384) q[13]; -cx q[26],q[13]; -rz(-pi/16384) q[13]; -rz(-pi/8192) q[26]; -cx q[26],q[14]; -rz(pi/8192) q[14]; -cx q[26],q[14]; -rz(-pi/8192) q[14]; -rz(-pi/4096) q[26]; -cx q[26],q[15]; -rz(pi/4096) q[15]; -cx q[26],q[15]; -rz(-pi/4096) q[15]; -rz(-pi/2048) q[26]; -cx q[26],q[16]; -rz(pi/2048) q[16]; -cx q[26],q[16]; -rz(-pi/2048) q[16]; -rz(-pi/1024) q[26]; -cx q[26],q[17]; -rz(pi/1024) q[17]; -cx q[26],q[17]; -rz(-pi/1024) q[17]; -rz(-pi/512) q[26]; -cx q[26],q[18]; -rz(pi/512) q[18]; -cx q[26],q[18]; -rz(-pi/512) q[18]; -rz(-pi/256) q[26]; -cx q[26],q[19]; -rz(pi/256) q[19]; -cx q[26],q[19]; -rz(-pi/256) q[19]; -rz(-pi/128) q[26]; -cx q[26],q[20]; -rz(pi/128) q[20]; -cx q[26],q[20]; -rz(-pi/128) q[20]; -rz(-pi/64) q[26]; -cx q[26],q[21]; -rz(pi/64) q[21]; -cx q[26],q[21]; -rz(-pi/64) q[21]; -rz(-pi/32) q[26]; -cx q[26],q[22]; -rz(pi/32) q[22]; -cx q[26],q[22]; -rz(-pi/32) q[22]; -rz(-pi/16) q[26]; -cx q[26],q[23]; -rz(pi/16) q[23]; -cx q[26],q[23]; -rz(-pi/16) q[23]; -rz(-pi/8) q[26]; -cx q[26],q[24]; -rz(pi/8) q[24]; -cx q[26],q[24]; -rz(-pi/8) q[24]; -rz(-pi/4) q[26]; -cx q[26],q[25]; -rz(pi/4) q[25]; -cx q[26],q[25]; -rz(-pi/4) q[25]; -rz(pi/2) q[26]; -sx q[26]; -rz(pi/2) q[26]; -rz(-pi/262144) q[9]; -cx q[27],q[9]; -rz(pi/524288) q[9]; -cx q[27],q[9]; -rz(-pi/262144) q[27]; -cx q[27],q[10]; -rz(pi/262144) q[10]; -cx q[27],q[10]; -rz(-pi/262144) q[10]; -rz(-pi/131072) q[27]; -cx q[27],q[11]; -rz(pi/131072) q[11]; -cx q[27],q[11]; -rz(-pi/131072) q[11]; -rz(-pi/65536) q[27]; -cx q[27],q[12]; -rz(pi/65536) q[12]; -cx q[27],q[12]; -rz(-pi/65536) q[12]; -rz(-pi/32768) q[27]; -cx q[27],q[13]; -rz(pi/32768) q[13]; -cx q[27],q[13]; -rz(-pi/32768) q[13]; -rz(-pi/16384) q[27]; -cx q[27],q[14]; -rz(pi/16384) q[14]; -cx q[27],q[14]; -rz(-pi/16384) q[14]; -rz(-pi/8192) q[27]; -cx q[27],q[15]; -rz(pi/8192) q[15]; -cx q[27],q[15]; -rz(-pi/8192) q[15]; -rz(-pi/4096) q[27]; -cx q[27],q[16]; -rz(pi/4096) q[16]; -cx q[27],q[16]; -rz(-pi/4096) q[16]; -rz(-pi/2048) q[27]; -cx q[27],q[17]; -rz(pi/2048) q[17]; -cx q[27],q[17]; -rz(-pi/2048) q[17]; -rz(-pi/1024) q[27]; -cx q[27],q[18]; -rz(pi/1024) q[18]; -cx q[27],q[18]; -rz(-pi/1024) q[18]; -rz(-pi/512) q[27]; -cx q[27],q[19]; -rz(pi/512) q[19]; -cx q[27],q[19]; -rz(-pi/512) q[19]; -rz(-pi/256) q[27]; -cx q[27],q[20]; -rz(pi/256) q[20]; -cx q[27],q[20]; -rz(-pi/256) q[20]; -rz(-pi/128) q[27]; -cx q[27],q[21]; -rz(pi/128) q[21]; -cx q[27],q[21]; -rz(-pi/128) q[21]; -rz(-pi/64) q[27]; -cx q[27],q[22]; -rz(pi/64) q[22]; -cx q[27],q[22]; -rz(-pi/64) q[22]; -rz(-pi/32) q[27]; -cx q[27],q[23]; -rz(pi/32) q[23]; -cx q[27],q[23]; -rz(-pi/32) q[23]; -rz(-pi/16) q[27]; -cx q[27],q[24]; -rz(pi/16) q[24]; -cx q[27],q[24]; -rz(-pi/16) q[24]; -rz(-pi/8) q[27]; -cx q[27],q[25]; -rz(pi/8) q[25]; -cx q[27],q[25]; -rz(-pi/8) q[25]; -rz(-pi/4) q[27]; -cx q[27],q[26]; -rz(pi/4) q[26]; -cx q[27],q[26]; -rz(-pi/4) q[26]; -rz(pi/2) q[27]; -sx q[27]; -rz(pi/2) q[27]; -rz(-pi/524288) q[9]; -cx q[28],q[9]; -rz(pi/1048576) q[9]; -cx q[28],q[9]; -rz(-pi/524288) q[28]; -cx q[28],q[10]; -rz(pi/524288) q[10]; -cx q[28],q[10]; -rz(-pi/524288) q[10]; -rz(-pi/262144) q[28]; -cx q[28],q[11]; -rz(pi/262144) q[11]; -cx q[28],q[11]; -rz(-pi/262144) q[11]; -rz(-pi/131072) q[28]; -cx q[28],q[12]; -rz(pi/131072) q[12]; -cx q[28],q[12]; -rz(-pi/131072) q[12]; -rz(-pi/65536) q[28]; -cx q[28],q[13]; -rz(pi/65536) q[13]; -cx q[28],q[13]; -rz(-pi/65536) q[13]; -rz(-pi/32768) q[28]; -cx q[28],q[14]; -rz(pi/32768) q[14]; -cx q[28],q[14]; -rz(-pi/32768) q[14]; -rz(-pi/16384) q[28]; -cx q[28],q[15]; -rz(pi/16384) q[15]; -cx q[28],q[15]; -rz(-pi/16384) q[15]; -rz(-pi/8192) q[28]; -cx q[28],q[16]; -rz(pi/8192) q[16]; -cx q[28],q[16]; -rz(-pi/8192) q[16]; -rz(-pi/4096) q[28]; -cx q[28],q[17]; -rz(pi/4096) q[17]; -cx q[28],q[17]; -rz(-pi/4096) q[17]; -rz(-pi/2048) q[28]; -cx q[28],q[18]; -rz(pi/2048) q[18]; -cx q[28],q[18]; -rz(-pi/2048) q[18]; -rz(-pi/1024) q[28]; -cx q[28],q[19]; -rz(pi/1024) q[19]; -cx q[28],q[19]; -rz(-pi/1024) q[19]; -rz(-pi/512) q[28]; -cx q[28],q[20]; -rz(pi/512) q[20]; -cx q[28],q[20]; -rz(-pi/512) q[20]; -rz(-pi/256) q[28]; -cx q[28],q[21]; -rz(pi/256) q[21]; -cx q[28],q[21]; -rz(-pi/256) q[21]; -rz(-pi/128) q[28]; -cx q[28],q[22]; -rz(pi/128) q[22]; -cx q[28],q[22]; -rz(-pi/128) q[22]; -rz(-pi/64) q[28]; -cx q[28],q[23]; -rz(pi/64) q[23]; -cx q[28],q[23]; -rz(-pi/64) q[23]; -rz(-pi/32) q[28]; -cx q[28],q[24]; -rz(pi/32) q[24]; -cx q[28],q[24]; -rz(-pi/32) q[24]; -rz(-pi/16) q[28]; -cx q[28],q[25]; -rz(pi/16) q[25]; -cx q[28],q[25]; -rz(-pi/16) q[25]; -rz(-pi/8) q[28]; -cx q[28],q[26]; -rz(pi/8) q[26]; -cx q[28],q[26]; -rz(-pi/8) q[26]; -rz(-pi/4) q[28]; -cx q[28],q[27]; -rz(pi/4) q[27]; -cx q[28],q[27]; -rz(-pi/4) q[27]; -rz(pi/2) q[28]; -sx q[28]; -rz(pi/2) q[28]; -rz(-pi/1048576) q[9]; diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 1b881d8fc..8ea4acdd7 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2275,7 +2275,7 @@ TEST(DDPackageTest, ReduceAncillaeRegression) { EXPECT_EQ(outputMatrix, expected); } -TEST(DDPackageTest, DDMShiftAllRows) { +TEST(DDPackageTest, DDShiftAllRows) { const auto nqubits = 2U; const auto dd = std::make_unique>(nqubits); const auto inputMatrix = @@ -2291,7 +2291,7 @@ TEST(DDPackageTest, DDMShiftAllRows) { EXPECT_EQ(outputMatrix2.getMatrix(), expectedMatrix2); } -TEST(DDPackageTest, DDMShiftAllRows3QubitsPart0) { +TEST(DDPackageTest, DDShiftAllRows3QubitsPart0) { const auto nqubits = 3U; const auto dd = std::make_unique>(nqubits); const auto inputMatrix = @@ -2340,7 +2340,7 @@ TEST(DDPackageTest, DDMShiftAllRows3QubitsPart0) { EXPECT_EQ(outputMatrix3.getMatrix(), expectedMatrix3); } -TEST(DDPackageTest, DDMShiftAllRows3QubitsPart1) { +TEST(DDPackageTest, DDShiftAllRows3QubitsPart1) { const size_t nqubits = 3U; const auto dd = std::make_unique>(nqubits); const auto inputMatrix = @@ -2364,7 +2364,7 @@ TEST(DDPackageTest, DDMShiftAllRows3QubitsPart1) { EXPECT_EQ(outputMatrix, expectedOutputMatrix); } -TEST(DDPackageTest, DDMShiftAllRows3QubitsPart2) { +TEST(DDPackageTest, DDShiftAllRows3QubitsPart2) { const size_t nqubits = 3U; const auto dd = std::make_unique>(nqubits); const auto inputMatrix = @@ -2389,7 +2389,7 @@ TEST(DDPackageTest, DDMShiftAllRows3QubitsPart2) { EXPECT_EQ(outputMatrix, expectedOutputMatrix); } -TEST(DDPackageTest, DDMShiftAllRows3QubitsPart3) { +TEST(DDPackageTest, DDShiftAllRows3QubitsPart3) { const size_t nqubits = 3U; const auto dd = std::make_unique>(nqubits); const auto inputMatrix = @@ -2414,7 +2414,7 @@ TEST(DDPackageTest, DDMShiftAllRows3QubitsPart3) { EXPECT_EQ(outputMatrix, expectedOutputMatrix); } -TEST(DDPackageTest, DDMShiftAllRows5Qubits) { +TEST(DDPackageTest, DDShiftAllRows5Qubits) { const auto nqubits = 5U; const auto dd = std::make_unique>(nqubits); const std::uint64_t n = 1 << nqubits; @@ -2436,207 +2436,3 @@ TEST(DDPackageTest, DDMShiftAllRows5Qubits) { // expectedMatrix = [1, 1, ... 0, 0 ...][0, 0, ... 1, 1 ...]... EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); } - -TEST(DDPackageTest, DDMPartialEquivalenceCheckingTrivialEquivalence) { - const auto nqubits = 2U; - const auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; - const auto inputDD = dd->makeDDFromMatrix(inputMatrix); - - EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 1, 1)); - EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 2, 1)); - EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 1, 2)); - EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 2, 2)); - - const auto hGate = dd->makeGateDD(dd::H_MAT, 2, 1); - const auto cxGate = dd->makeGateDD(dd::X_MAT, 2, 1_pc, 0); - const auto bellMatrix = dd->multiply(cxGate, hGate); - EXPECT_FALSE(dd->partialEquivalenceCheck(inputDD, bellMatrix, 1, 1)); -} - -TEST(DDPackageTest, DDMPartialEquivalenceChecking) { - const auto nqubits = 3U; - auto dd = std::make_unique>(nqubits); - // only the second qubit has differing gates in the two circuits, - // therefore they should be equivalent if we only measure the first qubit - const auto hGate = dd->makeGateDD(dd::H_MAT, 3, 1); - const auto xGate = dd->makeGateDD(dd::X_MAT, 3, 1); - const auto circuit1 = dd->multiply(xGate, hGate); - const auto circuit2 = dd->makeIdent(3); - - EXPECT_TRUE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); -} - -TEST(DDPackageTest, DDMPartialEquivalenceCheckingTestNotEquivalent) { - const auto nqubits = 2U; - const auto dd = std::make_unique>(nqubits); - // the first qubit has differing gates in the two circuits, - // therefore they should not be equivalent if we only measure the first qubit - const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 0); - const auto circuit1 = dd->multiply(xGate, hGate); - const auto circuit2 = dd->makeIdent(2); - EXPECT_FALSE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); - EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(circuit1, circuit2, 1)); -} - -TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaper) { - const auto nqubits = 3U; - const auto dd = std::make_unique>(nqubits); - const auto controlledSwapGate = - dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 0, 2); - const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); - const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); - const auto controlledHGate = - dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - - const auto c1 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - const auto c2 = dd->multiply(controlledHGate, xGate); - - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); -} - -TEST(DDPackageTest, DDMPartialEquivalenceCheckingExamplePaperZeroAncillae) { - const auto nqubits = 3U; - const auto dd = std::make_unique>(nqubits); - const auto controlledSwapGate = - dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 0, 2); - const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); - const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); - const auto controlledHGate = - dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - - const auto c1 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - const auto c2 = dd->multiply(controlledHGate, xGate); - - EXPECT_TRUE(dd->zeroAncillaePartialEquivalenceCheck(c1, c2, 1)); - EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(c1, c2, 2)); - - const auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 2); - const auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 0); - const auto controlledHGate2 = - dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - - const auto c3 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate2, dd->multiply(zGate2, controlledSwapGate))); - const auto c4 = dd->multiply(controlledHGate2, xGate); - - EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(c3, c4, 1)); -} - -TEST(DDPackageTest, DDMPartialEquivalenceWithDifferentNumberOfQubits) { - const auto dd = std::make_unique>(3); - const auto controlledSwapGate = - dd->makeTwoQubitGateDD(dd::SWAP_MAT, 3, qc::Controls{1}, 0, 2); - const auto hGate = dd->makeGateDD(dd::H_MAT, 3, 0); - const auto zGate = dd->makeGateDD(dd::Z_MAT, 3, 2); - const auto xGate = dd->makeGateDD(dd::X_MAT, 2, 1); - const auto controlledHGate = dd->makeGateDD(dd::H_MAT, 2, qc::Controls{1}, 0); - - const auto c1 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - const auto c2 = dd->multiply(controlledHGate, xGate); - - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); - EXPECT_FALSE(dd->partialEquivalenceCheck(c2, c1, 3, 3)); - EXPECT_FALSE(dd->partialEquivalenceCheck(c2, dd::mEdge::zero(), 2, 1)); - EXPECT_FALSE(dd->partialEquivalenceCheck(c2, dd::mEdge::one(), 2, 1)); - EXPECT_FALSE(dd->partialEquivalenceCheck(dd::mEdge::one(), c1, 2, 1)); - EXPECT_TRUE( - dd->partialEquivalenceCheck(dd::mEdge::one(), dd::mEdge::one(), 0, 1)); - EXPECT_TRUE( - dd->partialEquivalenceCheck(dd::mEdge::one(), dd::mEdge::one(), 0, 0)); -} - -TEST(DDPackageTest, DDMPartialEquivalenceCheckingComputeTable) { - const auto nqubits = 3U; - const auto dd = std::make_unique>(nqubits); - const auto controlledSwapGate = - dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 2, 0); - const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); - const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); - const auto controlledHGate = - dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - - const auto c1 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - const auto c2 = dd->multiply(controlledHGate, xGate); - - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); -} - -TEST(DDPackageTest, DDMPECMQTBenchGrover3Qubits) { - const auto dd = std::make_unique>(7); - - const qc::QuantumComputation c1{ - "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm"}; - const qc::QuantumComputation c2{ - "./circuits/grover-noancilla_indep_qiskit_3.qasm"}; - - // 3 measured qubits and 3 data qubits, full equivalence - EXPECT_TRUE(dd->partialEquivalenceCheck( - buildFunctionality(&c1, *dd, false, false), - buildFunctionality(&c2, *dd, false, false), 3, 3)); -} - -TEST(DDPackageTest, DDMPECMQTBenchGrover7Qubits) { - const auto dd = std::make_unique>(7); - - const qc::QuantumComputation c1{ - "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm"}; - const qc::QuantumComputation c2{ - "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm"}; - - // 7 measured qubits and 7 data qubits, full equivalence - EXPECT_TRUE(dd->partialEquivalenceCheck( - buildFunctionality(&c1, *dd, false, false), - buildFunctionality(&c2, *dd, false, false), 7, 7)); -} - -TEST(DDPackageTest, DDMPECSliQECGrover22Qubits) { - // doesn't terminate - const auto dd = std::make_unique>(22); - - const qc::QuantumComputation c1{ - "./circuits/Grover_1.qasm"}; // 11 qubits, 11 data qubits - const qc::QuantumComputation c2{ - "./circuits/Grover_2.qasm"}; // 12 qubits, 11 data qubits - - // 11 measured qubits and 11 data qubits - const auto c1Dd = buildFunctionality(&c1, *dd, false, false); - const auto c2Dd = buildFunctionality(&c2, *dd, false, false); - // adds 10 ancillary qubits -> total number of qubits is 22 - EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 11, 11)); -} - -TEST(DDPackageTest, DDMPECSliQECAdd19Qubits) { - // doesn't terminate - const auto dd = std::make_unique>(20); - - // full equivalence, 19 qubits - // but this test uses algorithm for partial equivalence, not the "zero - // ancillae" version - const qc::QuantumComputation c1{"./circuits/add6_196_1.qasm"}; - const qc::QuantumComputation c2{"./circuits/add6_196_2.qasm"}; - - // just for benchmarking reasons, we only measure 8 qubits - const auto c1Dd = buildFunctionality(&c1, *dd, false, false); - const auto c2Dd = buildFunctionality(&c2, *dd, false, false); - // doesn't add ancillary qubits -> total number of qubits is 19 - EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 8, 8)); -} From dbaef3e8bf65ee58f257e24e606eafba6dcccbc9 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Fri, 16 Feb 2024 20:43:09 +0100 Subject: [PATCH 43/51] :art: used qc::Qubit instead of dd::Qubit and used modern C++ random generators and some other requested changes --- include/mqt-core/QuantumComputation.hpp | 3 +- include/mqt-core/dd/Verification.hpp | 2 +- src/dd/Verification.cpp | 195 ++++++++++--------- test/algorithms/test_partial_equivalence.cpp | 28 +-- 4 files changed, 118 insertions(+), 110 deletions(-) diff --git a/include/mqt-core/QuantumComputation.hpp b/include/mqt-core/QuantumComputation.hpp index a4ce5ca28..6af8c8db7 100644 --- a/include/mqt-core/QuantumComputation.hpp +++ b/include/mqt-core/QuantumComputation.hpp @@ -307,8 +307,7 @@ class QuantumComputation { return nqubits; } [[nodiscard]] std::size_t getNmeasuredQubits() const { - return static_cast( - std::count(getGarbage().begin(), getGarbage().end(), false)); + return getNqubits() - getNgarbageQubits(); } [[nodiscard]] std::size_t getNgarbageQubits() const { return static_cast( diff --git a/include/mqt-core/dd/Verification.hpp b/include/mqt-core/dd/Verification.hpp index a12afaeeb..073144220 100644 --- a/include/mqt-core/dd/Verification.hpp +++ b/include/mqt-core/dd/Verification.hpp @@ -90,5 +90,5 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, } std::pair -generateRandomBenchmark(size_t n, Qubit d, Qubit m); +generateRandomBenchmark(size_t n, qc::Qubit d, qc::Qubit m); } // namespace dd diff --git a/src/dd/Verification.cpp b/src/dd/Verification.cpp index 981ccc736..933f610b2 100644 --- a/src/dd/Verification.cpp +++ b/src/dd/Verification.cpp @@ -20,15 +20,18 @@ const std::vector> PRE_GENERATED_CIRCUITS_SIZE_2_2{ void addPreGeneratedCircuits(QuantumComputation& circuit1, QuantumComputation& circuit2, const size_t n, - const Qubit groupBeginIndex, - const Qubit groupSize) { + const qc::Qubit groupBeginIndex, + const qc::Qubit groupSize) { const auto& circuits1 = groupSize == 1 ? PRE_GENERATED_CIRCUITS_SIZE_1_1 : PRE_GENERATED_CIRCUITS_SIZE_2_1; const auto& circuits2 = groupSize == 1 ? PRE_GENERATED_CIRCUITS_SIZE_1_2 : PRE_GENERATED_CIRCUITS_SIZE_2_2; const auto nrCircuits = circuits1.size(); - const auto randomIndex = static_cast(rand()) % nrCircuits; + auto randomGenerator = circuit1.getGenerator(); + std::uniform_int_distribution randomDistribution(0, nrCircuits - 1); + + const auto randomIndex = randomDistribution(randomGenerator); const auto x1 = circuits1[randomIndex]; const auto x2 = circuits2[randomIndex]; for (auto gateType : x1) { @@ -49,8 +52,10 @@ void addPreGeneratedCircuits(QuantumComputation& circuit1, } } -void addDecomposedCcxGate(QuantumComputation& circuit, const Qubit control1, - const Qubit control2, const Qubit target) { +void addDecomposedCcxGate(QuantumComputation& circuit, const Controls& controls, + const qc::Qubit target) { + qc::Qubit control1 = controls.begin()->qubit; + qc::Qubit control2 = (++controls.begin())->qubit; circuit.h(target); circuit.cx(control1, target); circuit.tdg(target); @@ -71,48 +76,37 @@ void addDecomposedCcxGate(QuantumComputation& circuit, const Qubit control1, void addStandardOperationToCircuit(QuantumComputation& circuit, const StandardOperation& op, const bool decomposeCcx) { - std::vector controls{}; - for (auto c : op.getControls()) { // the controls are at most 2 - controls.push_back(static_cast(c.qubit)); - } - std::vector targets{}; - for (auto t : op.getTargets()) { // the targets are at most 2 - targets.push_back(static_cast(t)); - } - - if (op.getType() == X && controls.size() == 2 && decomposeCcx) { + if (op.getType() == X && decomposeCcx && op.getControls().size() == 2) { // decompose toffoli gate - addDecomposedCcxGate(circuit, controls[0], controls[1], targets[0]); + addDecomposedCcxGate(circuit, op.getControls(), op.getTargets()[0]); } else { circuit.emplace_back(op); } } -std::vector fiveDiffferentRandomNumbers(const Qubit min, - const Qubit max) { - std::vector numbers; +std::vector +fiveDiffferentRandomNumbers(const qc::Qubit min, const qc::Qubit max, + std::mt19937_64 randomGenerator) { + std::vector numbers; - for (Qubit i = min; i < max; i++) { - numbers.push_back(i); + for (qc::Qubit i = min; i < max; i++) { + numbers.emplace_back(i); } - const unsigned seed = 42; - std::shuffle(numbers.begin(), numbers.end(), - std::default_random_engine(seed)); + std::shuffle(numbers.begin(), numbers.end(), randomGenerator); const int64_t lengthOutputVector{ static_cast(std::min(5UL, numbers.size()))}; - std::vector outputVector(numbers.begin(), - numbers.begin() + lengthOutputVector); + std::vector outputVector(numbers.begin(), + numbers.begin() + lengthOutputVector); return outputVector; } -StandardOperation -convertToStandardOperation(const size_t n, const size_t nrQubits, - const OpType randomOpType, const Qubit randomTarget1, - const Qubit randomTarget2, const fp randomParameter1, - const fp randomParameter2, const fp randomParameter3, - const Controls& randomControls) { +StandardOperation convertToStandardOperation( + const size_t n, const size_t nrQubits, const OpType randomOpType, + const qc::Qubit randomTarget1, const qc::Qubit randomTarget2, + const fp randomParameter1, const fp randomParameter2, + const fp randomParameter3, const Controls& randomControls) { switch (randomOpType) { // two targets and zero parameters @@ -188,20 +182,25 @@ convertToStandardOperation(const size_t n, const size_t nrQubits, } StandardOperation makeRandomStandardOperation(const size_t n, - const Qubit nrQubits, - const Qubit min) { - const auto randomNumbers = fiveDiffferentRandomNumbers(min, min + nrQubits); + const qc::Qubit nrQubits, + const qc::Qubit min, + std::mt19937_64 randomGenerator) { + const auto randomNumbers = + fiveDiffferentRandomNumbers(min, min + nrQubits, randomGenerator); + // choose one of the non-compound operations, but not "None", and also // not GPhase or I or Barrier - auto randomOpType = static_cast(rand() % (XXplusYY - H) + H); - const Qubit randomTarget1 = randomNumbers[0]; - Qubit randomTarget2{min}; + std::uniform_int_distribution<> randomDistrOpType(H, RZX); + auto randomOpType = static_cast(randomDistrOpType(randomGenerator)); + const qc::Qubit randomTarget1 = randomNumbers[0]; + qc::Qubit randomTarget2{min}; if (randomNumbers.size() > 1) { randomTarget2 = randomNumbers[1]; }; // choose random controls, but not more than available qubits - size_t nrControls = - std::min(randomNumbers.size() - 3, static_cast(rand() % 3)); + std::uniform_int_distribution randomDistrNrControls(0, 2); + size_t nrControls = std::min(randomNumbers.size() - 3, + randomDistrNrControls(randomGenerator)); if (randomNumbers.size() < 3) { nrControls = 0; } @@ -213,61 +212,69 @@ StandardOperation makeRandomStandardOperation(const size_t n, for (size_t i = 0; i < nrControls; i++) { randomControls.emplace(randomNumbers[i + 2]); } - const std::vector randomParameters{PI, PI_2, PI_4}; - const fp randomParameter1 = - randomParameters[static_cast(rand()) % randomParameters.size()]; - const fp randomParameter2 = - randomParameters[static_cast(rand()) % randomParameters.size()]; - const fp randomParameter3 = - randomParameters[static_cast(rand()) % randomParameters.size()]; + std::uniform_real_distribution randomDistrParameters(0, 2 * PI); + const fp randomParameter1 = randomDistrParameters(randomGenerator); + const fp randomParameter2 = randomDistrParameters(randomGenerator); + const fp randomParameter3 = randomDistrParameters(randomGenerator); + // const std::vector randomParameters{PI, PI_2, PI_4}; + // const fp randomParameter1 = + // randomParameters[static_cast(rand()) % + // randomParameters.size()]; + // const fp randomParameter2 = + // randomParameters[static_cast(rand()) % + // randomParameters.size()]; + // const fp randomParameter3 = + // randomParameters[static_cast(rand()) % + // randomParameters.size()]; return convertToStandardOperation( n, nrQubits, randomOpType, randomTarget1, randomTarget2, randomParameter1, randomParameter2, randomParameter3, randomControls); } std::pair -generateRandomBenchmark(const size_t n, const Qubit d, const Qubit m) { - if (d > n) { +generateRandomBenchmark(const size_t n, const qc::Qubit d, const qc::Qubit m) { + if (d > n || m > n) { throw std::runtime_error("The number of data or measured qubits can't be " "bigger than the total number of qubits. n = " + std::to_string(n) + "; d = " + std::to_string(d) + "; m = " + std::to_string(m)); } + qc::QuantumComputation circuit1{n}; qc::QuantumComputation circuit2{n}; + + auto randomGenerator = circuit1.getGenerator(); + // 1) H gates - for (Qubit i = 0U; i < d; i++) { + for (qc::Qubit i = 0U; i < d; i++) { circuit1.h(i); circuit2.h(i); } - for (Qubit i = 0U; i < static_cast(n); i++) { - circuit1.barrier(i); - circuit2.barrier(i); - } - // 2) Totally equivalent subcircuits - // generate a random subcircuit with d qubits and 3*d gates to apply - // on both circuits, but all the Toffoli gates in circuit2 are decomposed + circuit1.barrier(); + circuit2.barrier(); - for (Qubit i = 0U; static_cast(i) < 3 * d; i++) { - const auto op = makeRandomStandardOperation(n, d, 0); + // 2) Totally equivalent subcircuits + // Generate a random subcircuit with d qubits and 3*d gates to apply + // on both circuits, but all the Toffoli gates in circuit2 are decomposed + for (qc::Qubit i = 0U; i < 3 * d; i++) { + const auto op = makeRandomStandardOperation(n, d, 0, randomGenerator); addStandardOperationToCircuit(circuit1, op, false); addStandardOperationToCircuit(circuit2, op, true); } - for (Qubit i = 0U; i < static_cast(n); i++) { - circuit1.barrier(i); - circuit2.barrier(i); - } + circuit1.barrier(); + circuit2.barrier(); // 3) Partially equivalent subcircuits - - // divide data qubits into groups of size 1 or 2 - Qubit groupBeginIndex = 0; + // Divide data qubits into groups of size 1 or 2. For each group, we apply + // pre-generated subcircuits, which are pairwise partially equivalent. + qc::Qubit groupBeginIndex = 0; + std::uniform_int_distribution randomDistrGroupSize(1, 2); while (groupBeginIndex < d) { - Qubit groupSize = 1; + qc::Qubit groupSize = 1; if (groupBeginIndex < d - 1) { - groupSize = static_cast(rand() % 2) + 1; + groupSize = randomDistrGroupSize(randomGenerator); } addPreGeneratedCircuits(circuit1, circuit2, n, groupBeginIndex, groupSize); @@ -275,48 +282,50 @@ generateRandomBenchmark(const size_t n, const Qubit d, const Qubit m) { groupBeginIndex += groupSize; } - for (Qubit i = 0U; i < static_cast(n); i++) { - circuit1.barrier(i); - circuit2.barrier(i); - } + circuit1.barrier(); + circuit2.barrier(); + // 4) Arbitrary gates - // arbitrary gates are added to not measured qubits + // Arbitrary gates are added to data qubits that are not measured if (d > m) { - const Qubit notMQubits = d - m; - for (Qubit i = 0U; i < notMQubits; i++) { - const auto op = makeRandomStandardOperation(n, notMQubits, m); - addStandardOperationToCircuit(circuit1, op, false); - } - for (Qubit i = 0U; i < notMQubits; i++) { - const auto op = makeRandomStandardOperation(n, notMQubits, m); - addStandardOperationToCircuit(circuit2, op, false); + const qc::Qubit notMQubits = d - m; + for (qc::Qubit i = 0U; i < notMQubits; i++) { + addStandardOperationToCircuit( + circuit1, + makeRandomStandardOperation(n, notMQubits, m, randomGenerator), + false); + addStandardOperationToCircuit( + circuit2, + makeRandomStandardOperation(n, notMQubits, m, randomGenerator), + false); } } - for (Qubit i = 0U; i < static_cast(n); i++) { - circuit1.barrier(i); - circuit2.barrier(i); - } - - // 5) CNOT gates (if there are ancilla qubits) + circuit1.barrier(); + circuit2.barrier(); + // 5) CNOT gates + // For each ancilla qubit, add a CNOT that has the ancilla as control qubit, + // and any data qubit as target. As ancilla qubits are initially set to 0 and + // we haven't added any other gates to the ancilla qubits until now, these + // CNOT gates do not affect the circuit. if (d > 0) { - Qubit currentDataQubit = 0; - for (Qubit currentAncillaQubit = d; - currentAncillaQubit < static_cast(n); currentAncillaQubit++) { - auto nextDataQubit = static_cast((currentDataQubit + 1) % d); + qc::Qubit currentDataQubit = 0; + for (qc::Qubit currentAncillaQubit = d; currentAncillaQubit < n; + currentAncillaQubit++) { + auto nextDataQubit = (currentDataQubit + 1) % d; circuit1.cx(currentAncillaQubit, currentDataQubit); circuit2.cx(currentAncillaQubit, nextDataQubit); currentDataQubit = nextDataQubit; } } - for (Qubit i = d; i < static_cast(n); i++) { + for (qc::Qubit i = d; i < n; i++) { circuit1.setLogicalQubitAncillary(i); circuit2.setLogicalQubitAncillary(i); } - for (Qubit i = m; i < static_cast(n); i++) { + for (qc::Qubit i = m; i < n; i++) { circuit1.setLogicalQubitGarbage(i); circuit2.setLogicalQubitGarbage(i); } diff --git a/test/algorithms/test_partial_equivalence.cpp b/test/algorithms/test_partial_equivalence.cpp index fc8a4b579..25a6c5486 100644 --- a/test/algorithms/test_partial_equivalence.cpp +++ b/test/algorithms/test_partial_equivalence.cpp @@ -327,24 +327,25 @@ TEST(PartialEquivalenceTest, SliQECPeriodFinding8Qubits) { void partialEquivalencCheckingBenchmarks( const std::unique_ptr>& dd, - const size_t minN, const size_t maxN, const size_t reps, + const qc::Qubit minN, const qc::Qubit maxN, const size_t reps, const bool addAncilla) { - for (size_t n = minN; n < maxN; n++) { + + std::mt19937 gen(55); + + for (qc::Qubit n = minN; n < maxN; n++) { std::chrono::microseconds totalTime{0}; - std::uint16_t totalGates{0}; + std::size_t totalGates{0}; for (size_t k = 0; k < reps; k++) { - dd::Qubit d{0}; + qc::Qubit d{0}; if (addAncilla) { - d = static_cast(rand()) % static_cast(n - 1) + 1; + std::uniform_int_distribution nrDataQubits(1, n); + d = nrDataQubits(gen); } else { - d = static_cast(n); - } - dd::Qubit m{0}; - if (d == 1) { - m = 1; - } else { - m = static_cast(rand()) % static_cast(d - 1) + 1; + d = n; } + std::uniform_int_distribution nrDataQubits(1, d); + qc::Qubit m = nrDataQubits(gen); + const auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); const auto start = std::chrono::high_resolution_clock::now(); @@ -363,7 +364,7 @@ void partialEquivalencCheckingBenchmarks( // 1000000. // << " seconds\n"; totalTime += duration; - totalGates += static_cast(c2.size()); + totalGates += c2.size(); } std::cout << "\nnumber of qubits = " << n << "; number of reps = " << reps << "; average time = " @@ -377,7 +378,6 @@ void partialEquivalencCheckingBenchmarks( TEST(PartialEquivalenceTest, Benchmark) { const auto dd = std::make_unique>(20); - srand(55); const size_t minN = 2; const size_t maxN = 8; const size_t reps = 10; From 043923c24de0672920691f720d06d55e20134dd9 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Fri, 16 Feb 2024 21:05:47 +0100 Subject: [PATCH 44/51] =?UTF-8?q?=F0=9F=9A=A8=20made=20everything=20const?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dd/Verification.cpp | 4 ++-- test/algorithms/test_partial_equivalence.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dd/Verification.cpp b/src/dd/Verification.cpp index 933f610b2..26c440716 100644 --- a/src/dd/Verification.cpp +++ b/src/dd/Verification.cpp @@ -54,8 +54,8 @@ void addPreGeneratedCircuits(QuantumComputation& circuit1, void addDecomposedCcxGate(QuantumComputation& circuit, const Controls& controls, const qc::Qubit target) { - qc::Qubit control1 = controls.begin()->qubit; - qc::Qubit control2 = (++controls.begin())->qubit; + const qc::Qubit control1 = controls.begin()->qubit; + const qc::Qubit control2 = (++controls.begin())->qubit; circuit.h(target); circuit.cx(control1, target); circuit.tdg(target); diff --git a/test/algorithms/test_partial_equivalence.cpp b/test/algorithms/test_partial_equivalence.cpp index 25a6c5486..4bfc7e99c 100644 --- a/test/algorithms/test_partial_equivalence.cpp +++ b/test/algorithms/test_partial_equivalence.cpp @@ -344,7 +344,7 @@ void partialEquivalencCheckingBenchmarks( d = n; } std::uniform_int_distribution nrDataQubits(1, d); - qc::Qubit m = nrDataQubits(gen); + const qc::Qubit m = nrDataQubits(gen); const auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); From ad315c0ff99b9400dd7b4122a08eeeec5127eb3d Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Sat, 17 Feb 2024 11:59:00 +0100 Subject: [PATCH 45/51] :art: moved some functions from Package.hpp to Verification.hpp and removed unique_ptr from the dd parameter of functions and moved partial equivalence tests to dd/ --- include/mqt-core/QuantumComputation.hpp | 19 ++ include/mqt-core/dd/Package.hpp | 93 +------- include/mqt-core/dd/Verification.hpp | 115 +++++++++- src/QuantumComputation.cpp | 14 ++ test/CMakeLists.txt | 2 +- .../test_partial_equivalence.cpp | 198 ++++++++---------- 6 files changed, 230 insertions(+), 211 deletions(-) rename test/{algorithms => dd}/test_partial_equivalence.cpp (65%) diff --git a/include/mqt-core/QuantumComputation.hpp b/include/mqt-core/QuantumComputation.hpp index 6af8c8db7..c2d86408e 100644 --- a/include/mqt-core/QuantumComputation.hpp +++ b/include/mqt-core/QuantumComputation.hpp @@ -374,11 +374,30 @@ class QuantumComputation { * @param logicalQubitIndex */ void setLogicalQubitAncillary(Qubit logicalQubitIndex); + /** + * @brief Sets all logical qubits in the range [minLogicalQubitIndex, + * maxLogicalQubitIndex] to be ancillary + * @details Removes the qubits from the qubit register and adds it to the + * ancillary register, if such a register exists. Otherwise a new ancillary + * register is created. + * @param minLogicalQubitIndex first qubit that is set to be ancillary + * @param maxLogicalQubitIndex last qubit that is set to be ancillary + */ + void setLogicalQubitsAncillary(Qubit minLogicalQubitIndex, + Qubit maxLogicalQubitIndex); [[nodiscard]] bool logicalQubitIsGarbage(const Qubit logicalQubitIndex) const { return garbage[logicalQubitIndex]; } void setLogicalQubitGarbage(Qubit logicalQubitIndex); + /** + * @brief Sets all logical qubits in the range [minLogicalQubitIndex, + * maxLogicalQubitIndex] to be garbage + * @param minLogicalQubitIndex first qubit that is set to be garbage + * @param maxLogicalQubitIndex last qubit that is set to be garbage + */ + void setLogicalQubitsGarbage(Qubit minLogicalQubitIndex, + Qubit maxLogicalQubitIndex); [[nodiscard]] const std::vector& getAncillary() const { return ancillary; } diff --git a/include/mqt-core/dd/Package.hpp b/include/mqt-core/dd/Package.hpp index 5975353bb..5d29ea6bc 100644 --- a/include/mqt-core/dd/Package.hpp +++ b/include/mqt-core/dd/Package.hpp @@ -2474,6 +2474,7 @@ template class Package { return r; } +public: // only keeps the first 2^d columns mEdge setColumnsToZero(const mEdge& e, const Qubit d) { if (e.isTerminal()) { @@ -2528,6 +2529,7 @@ template class Package { return f; } +private: UnaryComputeTable shiftAllMatrixRows{}; Qubit shiftAllMatrixRowsM{0}; Qubit shiftAllMatrixRowsD{0}; @@ -2636,97 +2638,6 @@ template class Package { } return shiftAllRowsRecursive(e, m, d, 0); } - -private: - mEdge partialEquivalenceCheckSubroutine(mEdge u, const Qubit m, const Qubit k, - const Qubit extra) { - // add extra ancillary qubits - if (extra > 0) { - if (u.p->v + 1U + extra > nqubits) { - resize(u.p->v + 1U + extra); - } - u = kronecker(makeIdent(extra), u); - } - if (u.isTerminal()) { - return u; - } - const auto n = static_cast(u.p->v + 1); - const Qubit d = n - k; - u = setColumnsToZero(u, d); - const auto u2 = shiftAllRows(u, m, d); - return multiply(conjugateTranspose(u), u2); - } - -public: - /** - Checks for partial equivalence between the two circuits u1 and u2, - where the first d qubits of the circuits are the data qubits and - the first m qubits are the measured qubits. - @param u1 DD representation of first circuit - @param u2 DD representation of second circuit - @param d Number of data qubits - @param m Number of measured qubits - @return true if the two circuits u1 and u2 are partially equivalent. - **/ - bool partialEquivalenceCheck(mEdge u1, mEdge u2, const Qubit d, - const Qubit m) { - if (m == 0) { - return true; - } - if (u1.isTerminal() && u2.isTerminal()) { - return u1 == u2; - } - if (u1.isZeroTerminal() || u2.isZeroTerminal()) { - return false; - } - // add qubits such that u1 and u2 have the same dimension - if (u1.isTerminal()) { - auto w = u1.w; - u1 = makeIdent(u2.p->v + 1); - u1.w = w; - } else if (u2.isTerminal()) { - auto w = u2.w; - u2 = makeIdent(u1.p->v + 1); - u2.w = w; - } else if (u1.p->v < u2.p->v) { - u1 = kronecker(makeIdent(u2.p->v - u1.p->v), u1); - } else if (u1.p->v > u2.p->v) { - u2 = kronecker(makeIdent(u1.p->v - u2.p->v), u2); - } - - const Qubit n = u1.p->v + 1; - Qubit k = n - d; - Qubit extra{0}; - if (m > k) { - extra = m - k; - } - k = k + extra; - - const auto u1Prime = partialEquivalenceCheckSubroutine(u1, m, k, extra); - const auto u2Prime = partialEquivalenceCheckSubroutine(u2, m, k, extra); - - return u1Prime == u2Prime; - } - - /** - Checks for partial equivalence between the two circuits u1 and u2, - where all qubits of the circuits are the data qubits and - the first m qubits are the measured qubits. - @param u1 DD representation of first circuit - @param u2 DD representation of second circuit - @param m Number of measured qubits - @return true if the two circuits u1 and u2 are partially equivalent. - **/ - bool zeroAncillaePartialEquivalenceCheck(const mEdge& u1, const mEdge& u2, - const Qubit m) { - auto u1u2 = multiply(u1, conjugateTranspose(u2)); - const Qubit n = u1.p->v + 1; - std::vector garbage(n, false); - for (size_t i = m; i < n; i++) { - garbage[i] = true; - } - return isCloseToIdentity(u1u2, 1.0E-10, garbage, false); - } }; } // namespace dd diff --git a/include/mqt-core/dd/Verification.hpp b/include/mqt-core/dd/Verification.hpp index 073144220..84e737662 100644 --- a/include/mqt-core/dd/Verification.hpp +++ b/include/mqt-core/dd/Verification.hpp @@ -2,6 +2,100 @@ #include "dd/Package.hpp" namespace dd { + +template +mEdge partialEquivalenceCheckDDSubroutine(mEdge u, const Qubit m, const Qubit k, + const Qubit extra, + Package& dd) { + // add extra ancillary qubits + if (extra > 0) { + if (u.p->v + 1U + extra > dd.qubits()) { + dd.resize(u.p->v + 1U + extra); + } + u = dd.kronecker(dd.makeIdent(extra), u); + } + if (u.isTerminal()) { + return u; + } + const auto n = static_cast(u.p->v + 1); + const Qubit d = n - k; + u = dd.setColumnsToZero(u, d); + const auto u2 = dd.shiftAllRows(u, m, d); + return dd.multiply(dd.conjugateTranspose(u), u2); +} + +/** + Checks for partial equivalence between the two circuits u1 and u2, + where the first d qubits of the circuits are the data qubits and + the first m qubits are the measured qubits. + @param u1 DD representation of first circuit + @param u2 DD representation of second circuit + @param d Number of data qubits + @param m Number of measured qubits + @return true if the two circuits u1 and u2 are partially equivalent. + **/ +template +bool partialEquivalenceCheckDD(mEdge u1, mEdge u2, const Qubit d, const Qubit m, + Package& dd) { + if (m == 0) { + return true; + } + if (u1.isTerminal() && u2.isTerminal()) { + return u1 == u2; + } + if (u1.isZeroTerminal() || u2.isZeroTerminal()) { + return false; + } + // add qubits such that u1 and u2 have the same dimension + if (u1.isTerminal()) { + auto w = u1.w; + u1 = dd.makeIdent(u2.p->v + 1); + u1.w = w; + } else if (u2.isTerminal()) { + auto w = u2.w; + u2 = dd.makeIdent(u1.p->v + 1); + u2.w = w; + } else if (u1.p->v < u2.p->v) { + u1 = dd.kronecker(dd.makeIdent(u2.p->v - u1.p->v), u1); + } else if (u1.p->v > u2.p->v) { + u2 = dd.kronecker(dd.makeIdent(u1.p->v - u2.p->v), u2); + } + + const Qubit n = u1.p->v + 1; + Qubit k = n - d; + Qubit extra{0}; + if (m > k) { + extra = m - k; + } + k = k + extra; + + const auto u1Prime = partialEquivalenceCheckDDSubroutine(u1, m, k, extra, dd); + const auto u2Prime = partialEquivalenceCheckDDSubroutine(u2, m, k, extra, dd); + + return u1Prime == u2Prime; +} + +/** + Checks for partial equivalence between the two circuits u1 and u2, + where all qubits of the circuits are the data qubits and + the first m qubits are the measured qubits. + @param u1 DD representation of first circuit + @param u2 DD representation of second circuit + @param m Number of measured qubits + @return true if the two circuits u1 and u2 are partially equivalent. + **/ +template +bool zeroAncillaePartialEquivalenceCheckDD(const mEdge& u1, const mEdge& u2, + const Qubit m, Package& dd) { + auto u1u2 = dd.multiply(u1, dd.conjugateTranspose(u2)); + const Qubit n = u1.p->v + 1; + std::vector garbage(n, false); + for (size_t i = m; i < n; i++) { + garbage[i] = true; + } + return dd.isCloseToIdentity(u1u2, 1.0E-10, garbage, false); +} + /** Checks for partial equivalence between the two circuits c1 and c2 that have no ancilla qubits. @@ -12,9 +106,9 @@ namespace dd { @return true if the two circuits c1 and c2 are partially equivalent. **/ template -bool zeroAncillaePartialEquivalenceCheck( - qc::QuantumComputation c1, qc::QuantumComputation c2, - const std::unique_ptr>& dd) { +bool zeroAncillaePartialEquivalenceCheck(qc::QuantumComputation c1, + qc::QuantumComputation c2, + Package& dd) { if (c1.getNqubits() != c2.getNqubits() || c1.getGarbage() != c2.getGarbage()) { throw std::invalid_argument( @@ -26,9 +120,9 @@ bool zeroAncillaePartialEquivalenceCheck( c2.emplace_back(gate); } - const auto u = buildFunctionality(&c2, *dd, false, false); + const auto u = buildFunctionality(&c2, dd, false, false); - return dd->isCloseToIdentity(u, 1.0E-10, c1.getGarbage(), false); + return dd.isCloseToIdentity(u, 1.0E-10, c1.getGarbage(), false); } // get next garbage qubit after n inline Qubit getNextGarbage(Qubit n, const std::vector& garbage) { @@ -48,8 +142,7 @@ inline Qubit getNextGarbage(Qubit n, const std::vector& garbage) { **/ template bool partialEquivalenceCheck(qc::QuantumComputation c1, - qc::QuantumComputation c2, - const std::unique_ptr>& dd) { + qc::QuantumComputation c2, Package& dd) { const auto d1 = c1.getNqubitsWithoutAncillae(); const auto d2 = c2.getNqubitsWithoutAncillae(); @@ -82,11 +175,11 @@ bool partialEquivalenceCheck(qc::QuantumComputation c1, // partialEquivalenceCheck with dd - const auto u1 = buildFunctionality(&c1, *dd, false, false); - const auto u2 = buildFunctionality(&c2, *dd, false, false); + const auto u1 = buildFunctionality(&c1, dd, false, false); + const auto u2 = buildFunctionality(&c2, dd, false, false); - return dd->partialEquivalenceCheck(u1, u2, static_cast(d1), - static_cast(m1)); + return partialEquivalenceCheckDD(u1, u2, static_cast(d1), + static_cast(m1), dd); } std::pair diff --git a/src/QuantumComputation.cpp b/src/QuantumComputation.cpp index be1093b27..f6322b1f0 100644 --- a/src/QuantumComputation.cpp +++ b/src/QuantumComputation.cpp @@ -898,6 +898,13 @@ void QuantumComputation::setLogicalQubitAncillary( ancillary[logicalQubitIndex] = true; } +void QuantumComputation::setLogicalQubitsAncillary( + const Qubit minLogicalQubitIndex, const Qubit maxLogicalQubitIndex) { + for (Qubit i = minLogicalQubitIndex; i <= maxLogicalQubitIndex; i++) { + setLogicalQubitAncillary(i); + } +} + void QuantumComputation::setLogicalQubitGarbage(const Qubit logicalQubitIndex) { garbage[logicalQubitIndex] = true; // setting a logical qubit garbage also means removing it from the output @@ -911,6 +918,13 @@ void QuantumComputation::setLogicalQubitGarbage(const Qubit logicalQubitIndex) { } } +void QuantumComputation::setLogicalQubitsGarbage( + const Qubit minLogicalQubitIndex, const Qubit maxLogicalQubitIndex) { + for (Qubit i = minLogicalQubitIndex; i <= maxLogicalQubitIndex; i++) { + setLogicalQubitGarbage(i); + } +} + [[nodiscard]] std::pair> QuantumComputation::containsLogicalQubit(const Qubit logicalQubitIndex) const { if (const auto it = std::find_if(initialLayout.cbegin(), initialLayout.cend(), diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2aeb5328b..c98e3c228 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -13,10 +13,10 @@ package_add_test( dd/test_package.cpp dd/test_dd_functionality.cpp dd/test_dd_noise_functionality.cpp + dd/test_partial_equivalence.cpp algorithms/eval_dynamic_circuits.cpp algorithms/test_qft.cpp algorithms/test_grover.cpp - algorithms/test_partial_equivalence.cpp algorithms/test_bernsteinvazirani.cpp algorithms/test_entanglement.cpp algorithms/test_grcs.cpp diff --git a/test/algorithms/test_partial_equivalence.cpp b/test/dd/test_partial_equivalence.cpp similarity index 65% rename from test/algorithms/test_partial_equivalence.cpp rename to test/dd/test_partial_equivalence.cpp index 4bfc7e99c..c8b335e10 100644 --- a/test/algorithms/test_partial_equivalence.cpp +++ b/test/dd/test_partial_equivalence.cpp @@ -15,15 +15,15 @@ TEST(PartialEquivalenceTest, TrivialEquivalence) { dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; const auto inputDD = dd->makeDDFromMatrix(inputMatrix); - EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 1, 1)); - EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 2, 1)); - EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 1, 2)); - EXPECT_TRUE(dd->partialEquivalenceCheck(inputDD, inputDD, 2, 2)); + EXPECT_TRUE(partialEquivalenceCheckDD(inputDD, inputDD, 1, 1, *dd)); + EXPECT_TRUE(partialEquivalenceCheckDD(inputDD, inputDD, 2, 1, *dd)); + EXPECT_TRUE(partialEquivalenceCheckDD(inputDD, inputDD, 1, 2, *dd)); + EXPECT_TRUE(partialEquivalenceCheckDD(inputDD, inputDD, 2, 2, *dd)); const auto hGate = dd->makeGateDD(dd::H_MAT, 2, 1); const auto cxGate = dd->makeGateDD(dd::X_MAT, 2, 1_pc, 0); const auto bellMatrix = dd->multiply(cxGate, hGate); - EXPECT_FALSE(dd->partialEquivalenceCheck(inputDD, bellMatrix, 1, 1)); + EXPECT_FALSE(partialEquivalenceCheckDD(inputDD, bellMatrix, 1, 1, *dd)); } TEST(PartialEquivalenceTest, BasicPartialEquivalenceChecking) { @@ -36,7 +36,7 @@ TEST(PartialEquivalenceTest, BasicPartialEquivalenceChecking) { const auto circuit1 = dd->multiply(xGate, hGate); const auto circuit2 = dd->makeIdent(3); - EXPECT_TRUE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); + EXPECT_TRUE(partialEquivalenceCheckDD(circuit1, circuit2, 2, 1, *dd)); } TEST(PartialEquivalenceTest, NotEquivalent) { @@ -48,8 +48,9 @@ TEST(PartialEquivalenceTest, NotEquivalent) { const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 0); const auto circuit1 = dd->multiply(xGate, hGate); const auto circuit2 = dd->makeIdent(2); - EXPECT_FALSE(dd->partialEquivalenceCheck(circuit1, circuit2, 2, 1)); - EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(circuit1, circuit2, 1)); + EXPECT_FALSE(partialEquivalenceCheckDD(circuit1, circuit2, 2, 1, *dd)); + EXPECT_FALSE( + zeroAncillaePartialEquivalenceCheckDD(circuit1, circuit2, 1, *dd)); } TEST(PartialEquivalenceTest, ExamplePaper) { @@ -68,7 +69,7 @@ TEST(PartialEquivalenceTest, ExamplePaper) { dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); const auto c2 = dd->multiply(controlledHGate, xGate); - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); + EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); } TEST(PartialEquivalenceTest, ExamplePaperZeroAncillae) { @@ -87,8 +88,8 @@ TEST(PartialEquivalenceTest, ExamplePaperZeroAncillae) { dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); const auto c2 = dd->multiply(controlledHGate, xGate); - EXPECT_TRUE(dd->zeroAncillaePartialEquivalenceCheck(c1, c2, 1)); - EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(c1, c2, 2)); + EXPECT_TRUE(zeroAncillaePartialEquivalenceCheckDD(c1, c2, 1, *dd)); + EXPECT_FALSE(zeroAncillaePartialEquivalenceCheckDD(c1, c2, 2, *dd)); const auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 2); const auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 0); @@ -100,15 +101,16 @@ TEST(PartialEquivalenceTest, ExamplePaperZeroAncillae) { dd->multiply(hGate2, dd->multiply(zGate2, controlledSwapGate))); const auto c4 = dd->multiply(controlledHGate2, xGate); - EXPECT_FALSE(dd->zeroAncillaePartialEquivalenceCheck(c3, c4, 1)); + EXPECT_FALSE(zeroAncillaePartialEquivalenceCheckDD(c3, c4, 1, *dd)); } TEST(PartialEquivalenceTest, DifferentNumberOfQubits) { - const auto dd = std::make_unique>(3); + const auto nqubits = 3U; + const auto dd = std::make_unique>(nqubits); const auto controlledSwapGate = - dd->makeTwoQubitGateDD(dd::SWAP_MAT, 3, qc::Controls{1}, 0, 2); - const auto hGate = dd->makeGateDD(dd::H_MAT, 3, 0); - const auto zGate = dd->makeGateDD(dd::Z_MAT, 3, 2); + dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 0, 2); + const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); const auto xGate = dd->makeGateDD(dd::X_MAT, 2, 1); const auto controlledHGate = dd->makeGateDD(dd::H_MAT, 2, qc::Controls{1}, 0); @@ -117,15 +119,15 @@ TEST(PartialEquivalenceTest, DifferentNumberOfQubits) { dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); const auto c2 = dd->multiply(controlledHGate, xGate); - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); - EXPECT_FALSE(dd->partialEquivalenceCheck(c2, c1, 3, 3)); - EXPECT_FALSE(dd->partialEquivalenceCheck(c2, dd::mEdge::zero(), 2, 1)); - EXPECT_FALSE(dd->partialEquivalenceCheck(c2, dd::mEdge::one(), 2, 1)); - EXPECT_FALSE(dd->partialEquivalenceCheck(dd::mEdge::one(), c1, 2, 1)); + EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); + EXPECT_FALSE(partialEquivalenceCheckDD(c2, c1, 3, 3, *dd)); + EXPECT_FALSE(partialEquivalenceCheckDD(c2, dd::mEdge::zero(), 2, 1, *dd)); + EXPECT_FALSE(partialEquivalenceCheckDD(c2, dd::mEdge::one(), 2, 1, *dd)); + EXPECT_FALSE(partialEquivalenceCheckDD(dd::mEdge::one(), c1, 2, 1, *dd)); EXPECT_TRUE( - dd->partialEquivalenceCheck(dd::mEdge::one(), dd::mEdge::one(), 0, 1)); + partialEquivalenceCheckDD(dd::mEdge::one(), dd::mEdge::one(), 0, 1, *dd)); EXPECT_TRUE( - dd->partialEquivalenceCheck(dd::mEdge::one(), dd::mEdge::one(), 0, 0)); + partialEquivalenceCheckDD(dd::mEdge::one(), dd::mEdge::one(), 0, 0, *dd)); } TEST(PartialEquivalenceTest, ComputeTableTest) { @@ -144,15 +146,15 @@ TEST(PartialEquivalenceTest, ComputeTableTest) { dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); const auto c2 = dd->multiply(controlledHGate, xGate); - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); - EXPECT_TRUE(dd->partialEquivalenceCheck(c1, c2, 3, 1)); + EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); + EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); + EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); + EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); + EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); } TEST(PartialEquivalenceTest, MQTBenchGrover3Qubits) { - const auto dd = std::make_unique>(7); + const auto dd = std::make_unique>(3); const qc::QuantumComputation c1{ "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm"}; @@ -160,9 +162,7 @@ TEST(PartialEquivalenceTest, MQTBenchGrover3Qubits) { "./circuits/grover-noancilla_indep_qiskit_3.qasm"}; // 3 measured qubits and 3 data qubits, full equivalence - EXPECT_TRUE(dd->partialEquivalenceCheck( - buildFunctionality(&c1, *dd, false, false), - buildFunctionality(&c2, *dd, false, false), 3, 3)); + EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); } TEST(PartialEquivalenceTest, MQTBenchGrover7Qubits) { @@ -174,69 +174,69 @@ TEST(PartialEquivalenceTest, MQTBenchGrover7Qubits) { "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm"}; // 7 measured qubits and 7 data qubits, full equivalence - EXPECT_TRUE(dd->partialEquivalenceCheck( - buildFunctionality(&c1, *dd, false, false), - buildFunctionality(&c2, *dd, false, false), 7, 7)); + EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); } TEST(PartialEquivalenceTest, SliQECGrover22Qubits) { - const auto dd = std::make_unique>(22); + const auto dd = std::make_unique>(12); const qc::QuantumComputation c1{ "./circuits/Grover_1.qasm"}; // 11 qubits, 11 data qubits - const qc::QuantumComputation c2{ + qc::QuantumComputation c2{ "./circuits/Grover_2.qasm"}; // 12 qubits, 11 data qubits // 11 measured qubits and 11 data qubits - const auto c1Dd = buildFunctionality(&c1, *dd, false, false); - const auto c2Dd = buildFunctionality(&c2, *dd, false, false); + c2.setLogicalQubitAncillary(11); + c2.setLogicalQubitGarbage(11); + // adds 10 ancillary qubits -> total number of qubits is 22 - EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 11, 11)); + EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); } TEST(PartialEquivalenceTest, SliQECAdd19Qubits) { - const auto dd = std::make_unique>(20); + const auto dd = std::make_unique>(19); // full equivalence, 19 qubits // but this test uses algorithm for partial equivalence, not the "zero // ancillae" version - const qc::QuantumComputation c1{"./circuits/add6_196_1.qasm"}; - const qc::QuantumComputation c2{"./circuits/add6_196_2.qasm"}; + qc::QuantumComputation c1{"./circuits/add6_196_1.qasm"}; + qc::QuantumComputation c2{"./circuits/add6_196_2.qasm"}; // just for benchmarking reasons, we only measure 8 qubits - const auto c1Dd = buildFunctionality(&c1, *dd, false, false); - const auto c2Dd = buildFunctionality(&c2, *dd, false, false); + c1.setLogicalQubitsAncillary(8, 18); + c2.setLogicalQubitsAncillary(8, 18); + c1.setLogicalQubitsGarbage(8, 18); + c2.setLogicalQubitsGarbage(8, 18); + // doesn't add ancillary qubits -> total number of qubits is 19 - EXPECT_TRUE(dd->partialEquivalenceCheck(c1Dd, c2Dd, 8, 8)); + EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); } TEST(PartialEquivalenceTest, ExamplePaperDifferentQubitOrder) { const auto nqubits = 3U; auto dd = std::make_unique>(nqubits); - qc::QuantumComputation c1{3, 1}; + qc::QuantumComputation c1{nqubits, 1}; c1.cswap(1, 2, 0); c1.h(2); c1.z(0); c1.cswap(1, 2, 0); - qc::QuantumComputation c2{3, 1}; + qc::QuantumComputation c2{nqubits, 1}; c2.x(1); c2.ch(1, 2); - c1.setLogicalQubitGarbage(1); - c1.setLogicalQubitGarbage(0); + c1.setLogicalQubitsGarbage(0, 1); + c2.setLogicalQubitsGarbage(0, 1); - c2.setLogicalQubitGarbage(1); - c2.setLogicalQubitGarbage(0); - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); + EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); } TEST(PartialEquivalenceTest, ExamplePaperDifferentQubitOrderAndNumber) { const auto nqubits = 4U; auto dd = std::make_unique>(nqubits); - qc::QuantumComputation c1{4, 1}; + qc::QuantumComputation c1{nqubits, 1}; c1.cswap(1, 2, 0); c1.h(2); c1.z(0); @@ -246,54 +246,52 @@ TEST(PartialEquivalenceTest, ExamplePaperDifferentQubitOrderAndNumber) { c2.x(1); c2.ch(1, 2); - c1.setLogicalQubitGarbage(1); - c1.setLogicalQubitGarbage(0); + c1.setLogicalQubitsGarbage(0, 1); c1.setLogicalQubitGarbage(3); c1.setLogicalQubitAncillary(3); - c2.setLogicalQubitGarbage(1); - c2.setLogicalQubitGarbage(0); - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); - EXPECT_TRUE(dd::partialEquivalenceCheck(c2, c1, dd)); + c2.setLogicalQubitsGarbage(0, 1); + EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); + EXPECT_TRUE(partialEquivalenceCheck(c2, c1, *dd)); } TEST(PartialEquivalenceTest, ZeroAncillaSliQEC19Qubits) { - auto dd = std::make_unique>(20); + auto dd = std::make_unique>(19); // full equivalence, 10 qubits const qc::QuantumComputation c1{"./circuits/entanglement_1.qasm"}; const qc::QuantumComputation c2{"./circuits/entanglement_2.qasm"}; // calls zeroAncillaePartialEquivalenceCheck - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); + EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); // full equivalence, 19 qubits const qc::QuantumComputation c3{"./circuits/add6_196_1.qasm"}; const qc::QuantumComputation c4{"./circuits/add6_196_2.qasm"}; // calls zeroAncillaePartialEquivalenceCheck - EXPECT_TRUE(dd::partialEquivalenceCheck(c3, c4, dd)); + EXPECT_TRUE(partialEquivalenceCheck(c3, c4, *dd)); // full equivalence, 10 qubits const qc::QuantumComputation c5{"./circuits/bv_1.qasm"}; const qc::QuantumComputation c6{"./circuits/bv_2.qasm"}; // calls zeroAncillaePartialEquivalenceCheck - EXPECT_TRUE(dd::partialEquivalenceCheck(c5, c6, dd)); + EXPECT_TRUE(partialEquivalenceCheck(c5, c6, *dd)); } TEST(PartialEquivalenceTest, ZeroAncillaSliQECRandomCircuit) { - auto dd = std::make_unique>(20); + auto dd = std::make_unique>(10); // full equivalence, 10 qubits const qc::QuantumComputation c1{"./circuits/random_1.qasm"}; const qc::QuantumComputation c2{"./circuits/random_2.qasm"}; // calls buildFunctionality for c2^(-1) concatenated with c1 - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); + EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); } TEST(PartialEquivalenceTest, SliQECPeriodFinding8Qubits) { - auto dd = std::make_unique>(20); + auto dd = std::make_unique>(8); // 8 qubits, 3 data qubits qc::QuantumComputation c1{"./circuits/period_finding_1.qasm"}; // 8 qubits, 3 data qubits @@ -301,35 +299,19 @@ TEST(PartialEquivalenceTest, SliQECPeriodFinding8Qubits) { // 3 measured qubits and 3 data qubits - c2.setLogicalQubitAncillary(7); - c2.setLogicalQubitGarbage(7); - c2.setLogicalQubitAncillary(6); - c2.setLogicalQubitGarbage(6); - c2.setLogicalQubitAncillary(5); - c2.setLogicalQubitGarbage(5); - c2.setLogicalQubitAncillary(3); - c2.setLogicalQubitGarbage(3); - c2.setLogicalQubitAncillary(4); - c2.setLogicalQubitGarbage(4); - - c1.setLogicalQubitAncillary(7); - c1.setLogicalQubitGarbage(7); - c1.setLogicalQubitAncillary(6); - c1.setLogicalQubitGarbage(6); - c1.setLogicalQubitAncillary(5); - c1.setLogicalQubitGarbage(5); - c1.setLogicalQubitAncillary(3); - c1.setLogicalQubitGarbage(3); - c1.setLogicalQubitAncillary(4); - c1.setLogicalQubitGarbage(4); - EXPECT_TRUE(dd::partialEquivalenceCheck(c1, c2, dd)); -} + c2.setLogicalQubitsAncillary(3, 7); + c2.setLogicalQubitsGarbage(3, 7); + + c1.setLogicalQubitsAncillary(3, 7); + c1.setLogicalQubitsGarbage(3, 7); -void partialEquivalencCheckingBenchmarks( - const std::unique_ptr>& dd, - const qc::Qubit minN, const qc::Qubit maxN, const size_t reps, - const bool addAncilla) { + EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); +} +void partialEquivalencCheckingBenchmarks(const qc::Qubit minN, + const qc::Qubit maxN, + const size_t reps, + const bool addAncilla) { std::mt19937 gen(55); for (qc::Qubit n = minN; n < maxN; n++) { @@ -348,8 +330,11 @@ void partialEquivalencCheckingBenchmarks( const auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); + auto dd = std::make_unique>(n); + const auto start = std::chrono::high_resolution_clock::now(); - const bool result = dd::partialEquivalenceCheck(c1, c2, dd); + + const bool result = dd::partialEquivalenceCheck(c1, c2, *dd); // Get ending timepoint const auto stop = std::chrono::high_resolution_clock::now(); const auto duration = @@ -377,44 +362,41 @@ void partialEquivalencCheckingBenchmarks( } TEST(PartialEquivalenceTest, Benchmark) { - const auto dd = std::make_unique>(20); const size_t minN = 2; const size_t maxN = 8; const size_t reps = 10; std::cout << "Partial equivalence check\n"; - partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, true); + partialEquivalencCheckingBenchmarks(minN, maxN, reps, true); } TEST(PartialEquivalenceTest, ZeroAncillaBenchmark) { - const auto dd = std::make_unique>(30); const size_t minN = 3; const size_t maxN = 15; const size_t reps = 10; std::cout << "Zero-ancilla partial equivalence check\n"; - partialEquivalencCheckingBenchmarks(dd, minN, maxN, reps, false); + partialEquivalencCheckingBenchmarks(minN, maxN, reps, false); } TEST(PartialEquivalenceTest, InvalidInput) { - const auto dd = std::make_unique>(30); + const auto nqubits = 4U; + const auto dd = std::make_unique>(nqubits); // the circuits don't have the same number of measured qubits - qc::QuantumComputation c1{4, 1}; + qc::QuantumComputation c1{nqubits, 1}; c1.x(1); - qc::QuantumComputation c2{4, 1}; + qc::QuantumComputation c2{nqubits, 1}; c2.x(1); - c1.setLogicalQubitGarbage(1); - c1.setLogicalQubitGarbage(0); + c1.setLogicalQubitsGarbage(0, 1); c1.setLogicalQubitGarbage(3); - c2.setLogicalQubitGarbage(1); - c2.setLogicalQubitGarbage(0); + c2.setLogicalQubitsGarbage(0, 1); - EXPECT_FALSE(dd::partialEquivalenceCheck(c1, c2, dd)); + EXPECT_FALSE(partialEquivalenceCheck(c1, c2, *dd)); // now they have the same number of measured qubits but a different // permutation of garbage qubits c2.setLogicalQubitGarbage(2); - EXPECT_THROW(dd::partialEquivalenceCheck(c1, c2, dd), std::invalid_argument); + EXPECT_THROW(partialEquivalenceCheck(c1, c2, *dd), std::invalid_argument); } From 646a0445ec6833b7800cc501d2cd53d2b85a8c54 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Mon, 19 Feb 2024 10:22:42 +0100 Subject: [PATCH 46/51] :fire: removed zeroAncillaPEC and modified corresponding tests --- include/mqt-core/dd/Verification.hpp | 22 +---------- test/dd/test_package.cpp | 56 ++++++++++++++++++++++++++++ test/dd/test_partial_equivalence.cpp | 34 ----------------- 3 files changed, 57 insertions(+), 55 deletions(-) diff --git a/include/mqt-core/dd/Verification.hpp b/include/mqt-core/dd/Verification.hpp index 84e737662..ba46d62c0 100644 --- a/include/mqt-core/dd/Verification.hpp +++ b/include/mqt-core/dd/Verification.hpp @@ -75,27 +75,6 @@ bool partialEquivalenceCheckDD(mEdge u1, mEdge u2, const Qubit d, const Qubit m, return u1Prime == u2Prime; } -/** - Checks for partial equivalence between the two circuits u1 and u2, - where all qubits of the circuits are the data qubits and - the first m qubits are the measured qubits. - @param u1 DD representation of first circuit - @param u2 DD representation of second circuit - @param m Number of measured qubits - @return true if the two circuits u1 and u2 are partially equivalent. - **/ -template -bool zeroAncillaePartialEquivalenceCheckDD(const mEdge& u1, const mEdge& u2, - const Qubit m, Package& dd) { - auto u1u2 = dd.multiply(u1, dd.conjugateTranspose(u2)); - const Qubit n = u1.p->v + 1; - std::vector garbage(n, false); - for (size_t i = m; i < n; i++) { - garbage[i] = true; - } - return dd.isCloseToIdentity(u1u2, 1.0E-10, garbage, false); -} - /** Checks for partial equivalence between the two circuits c1 and c2 that have no ancilla qubits. @@ -124,6 +103,7 @@ bool zeroAncillaePartialEquivalenceCheck(qc::QuantumComputation c1, return dd.isCloseToIdentity(u, 1.0E-10, c1.getGarbage(), false); } + // get next garbage qubit after n inline Qubit getNextGarbage(Qubit n, const std::vector& garbage) { while (n < static_cast(garbage.size()) && !garbage.at(n)) { diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 3a748698c..fd97f81a8 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -1228,6 +1228,62 @@ TEST(DDPackageTest, CloseToIdentityWithGarbageInTheMiddle) { {true, false, true}, false)); } +TEST(PartialEquivalenceTest, CloseToIdentityFalse) { + const auto nqubits = 2U; + const auto dd = std::make_unique>(nqubits); + // the first qubit has differing gates in the two circuits, + // therefore they should not be equivalent if we only measure the first qubit + const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 0); + const auto circuit1 = dd->multiply(xGate, hGate); + const auto circuit2 = dd->makeIdent(2); + auto u1u2 = dd->multiply(circuit1, dd->conjugateTranspose(circuit2)); + std::vector garbage(nqubits, false); + garbage[1] = true; + EXPECT_FALSE(dd->isCloseToIdentity(u1u2, 1.0E-10, garbage, false)); +} + +TEST(PartialEquivalenceTest, CloseToIdentityExamplePaper) { + const auto nqubits = 3U; + const auto dd = std::make_unique>(nqubits); + const auto controlledSwapGate = + dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 0, 2); + const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); + const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); + const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); + const auto controlledHGate = + dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); + + const auto c1 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); + const auto c2 = dd->multiply(controlledHGate, xGate); + + auto c1c2 = dd->multiply(c1, dd->conjugateTranspose(c2)); + std::vector garbage(nqubits, false); + // only the last qubit is garbage + garbage[2] = true; + EXPECT_FALSE(dd->isCloseToIdentity(c1c2, 1.0E-10, garbage, false)); + // the last two qubits are garbage + garbage[1] = true; + EXPECT_TRUE(dd->isCloseToIdentity(c1c2, 1.0E-10, garbage, false)); + + const auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 2); + const auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 0); + const auto controlledHGate2 = + dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); + + const auto c3 = dd->multiply( + controlledSwapGate, + dd->multiply(hGate2, dd->multiply(zGate2, controlledSwapGate))); + const auto c4 = dd->multiply(controlledHGate2, xGate); + + auto c3c4 = dd->multiply(c3, dd->conjugateTranspose(c4)); + + // the last two qubits are garbage + EXPECT_FALSE(dd->isCloseToIdentity(c3c4, 1.0E-10, garbage, false)); +} + struct DensityMatrixSimulatorDDPackageConfigTesting : public dd::DDPackageConfig { static constexpr std::size_t UT_DM_NBUCKET = 65536U; diff --git a/test/dd/test_partial_equivalence.cpp b/test/dd/test_partial_equivalence.cpp index c8b335e10..f202af55a 100644 --- a/test/dd/test_partial_equivalence.cpp +++ b/test/dd/test_partial_equivalence.cpp @@ -49,8 +49,6 @@ TEST(PartialEquivalenceTest, NotEquivalent) { const auto circuit1 = dd->multiply(xGate, hGate); const auto circuit2 = dd->makeIdent(2); EXPECT_FALSE(partialEquivalenceCheckDD(circuit1, circuit2, 2, 1, *dd)); - EXPECT_FALSE( - zeroAncillaePartialEquivalenceCheckDD(circuit1, circuit2, 1, *dd)); } TEST(PartialEquivalenceTest, ExamplePaper) { @@ -72,38 +70,6 @@ TEST(PartialEquivalenceTest, ExamplePaper) { EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); } -TEST(PartialEquivalenceTest, ExamplePaperZeroAncillae) { - const auto nqubits = 3U; - const auto dd = std::make_unique>(nqubits); - const auto controlledSwapGate = - dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 0, 2); - const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); - const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); - const auto controlledHGate = - dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - - const auto c1 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - const auto c2 = dd->multiply(controlledHGate, xGate); - - EXPECT_TRUE(zeroAncillaePartialEquivalenceCheckDD(c1, c2, 1, *dd)); - EXPECT_FALSE(zeroAncillaePartialEquivalenceCheckDD(c1, c2, 2, *dd)); - - const auto hGate2 = dd->makeGateDD(dd::H_MAT, nqubits, 2); - const auto zGate2 = dd->makeGateDD(dd::Z_MAT, nqubits, 0); - const auto controlledHGate2 = - dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - - const auto c3 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate2, dd->multiply(zGate2, controlledSwapGate))); - const auto c4 = dd->multiply(controlledHGate2, xGate); - - EXPECT_FALSE(zeroAncillaePartialEquivalenceCheckDD(c3, c4, 1, *dd)); -} - TEST(PartialEquivalenceTest, DifferentNumberOfQubits) { const auto nqubits = 3U; const auto dd = std::make_unique>(nqubits); From a5620925ebc6209ecfddfa2c7a3ff32e15835df1 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Wed, 21 Feb 2024 15:40:10 +0100 Subject: [PATCH 47/51] :fire: remove redundant cast --- include/mqt-core/dd/Verification.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mqt-core/dd/Verification.hpp b/include/mqt-core/dd/Verification.hpp index ba46d62c0..65ab43714 100644 --- a/include/mqt-core/dd/Verification.hpp +++ b/include/mqt-core/dd/Verification.hpp @@ -17,7 +17,7 @@ mEdge partialEquivalenceCheckDDSubroutine(mEdge u, const Qubit m, const Qubit k, if (u.isTerminal()) { return u; } - const auto n = static_cast(u.p->v + 1); + const Qubit n = u.p->v + 1; const Qubit d = n - k; u = dd.setColumnsToZero(u, d); const auto u2 = dd.shiftAllRows(u, m, d); From 29144ea4532ae62e57ea65eda1819d8bd43816bb Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Wed, 21 Feb 2024 15:57:51 +0100 Subject: [PATCH 48/51] :fire: removed all partialEquivalence functions, s.t. they can be moved to MQT-QCEC --- include/mqt-core/dd/Verification.hpp | 167 - src/dd/CMakeLists.txt | 1 - src/dd/Verification.cpp | 336 -- test/CMakeLists.txt | 1 - test/circuits/Grover_1.qasm | 68 - test/circuits/Grover_2.qasm | 70 - test/circuits/add6_196_1.qasm | 245 -- test/circuits/add6_196_2.qasm | 270 -- test/circuits/bv_1.qasm | 33 - test/circuits/bv_2.qasm | 66 - test/circuits/entanglement_1.qasm | 14 - test/circuits/entanglement_2.qasm | 46 - .../grover-noancilla_indep_qiskit_3.qasm | 18 - ...ancilla_nativegates_ibm_qiskit_opt0_3.qasm | 58 - ...ancilla_nativegates_ibm_qiskit_opt0_7.qasm | 3762 ----------------- ...ancilla_nativegates_ibm_qiskit_opt1_7.qasm | 3600 ---------------- test/circuits/period_finding_1.qasm | 398 -- test/circuits/period_finding_2.qasm | 440 -- test/circuits/random_1.qasm | 154 - test/circuits/random_2.qasm | 532 --- test/dd/test_package.cpp | 4 +- test/dd/test_partial_equivalence.cpp | 368 -- 22 files changed, 2 insertions(+), 10649 deletions(-) delete mode 100644 include/mqt-core/dd/Verification.hpp delete mode 100644 src/dd/Verification.cpp delete mode 100644 test/circuits/Grover_1.qasm delete mode 100644 test/circuits/Grover_2.qasm delete mode 100644 test/circuits/add6_196_1.qasm delete mode 100644 test/circuits/add6_196_2.qasm delete mode 100644 test/circuits/bv_1.qasm delete mode 100644 test/circuits/bv_2.qasm delete mode 100644 test/circuits/entanglement_1.qasm delete mode 100644 test/circuits/entanglement_2.qasm delete mode 100644 test/circuits/grover-noancilla_indep_qiskit_3.qasm delete mode 100644 test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm delete mode 100644 test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm delete mode 100644 test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm delete mode 100644 test/circuits/period_finding_1.qasm delete mode 100644 test/circuits/period_finding_2.qasm delete mode 100644 test/circuits/random_1.qasm delete mode 100644 test/circuits/random_2.qasm delete mode 100644 test/dd/test_partial_equivalence.cpp diff --git a/include/mqt-core/dd/Verification.hpp b/include/mqt-core/dd/Verification.hpp deleted file mode 100644 index 65ab43714..000000000 --- a/include/mqt-core/dd/Verification.hpp +++ /dev/null @@ -1,167 +0,0 @@ -#include "dd/FunctionalityConstruction.hpp" -#include "dd/Package.hpp" - -namespace dd { - -template -mEdge partialEquivalenceCheckDDSubroutine(mEdge u, const Qubit m, const Qubit k, - const Qubit extra, - Package& dd) { - // add extra ancillary qubits - if (extra > 0) { - if (u.p->v + 1U + extra > dd.qubits()) { - dd.resize(u.p->v + 1U + extra); - } - u = dd.kronecker(dd.makeIdent(extra), u); - } - if (u.isTerminal()) { - return u; - } - const Qubit n = u.p->v + 1; - const Qubit d = n - k; - u = dd.setColumnsToZero(u, d); - const auto u2 = dd.shiftAllRows(u, m, d); - return dd.multiply(dd.conjugateTranspose(u), u2); -} - -/** - Checks for partial equivalence between the two circuits u1 and u2, - where the first d qubits of the circuits are the data qubits and - the first m qubits are the measured qubits. - @param u1 DD representation of first circuit - @param u2 DD representation of second circuit - @param d Number of data qubits - @param m Number of measured qubits - @return true if the two circuits u1 and u2 are partially equivalent. - **/ -template -bool partialEquivalenceCheckDD(mEdge u1, mEdge u2, const Qubit d, const Qubit m, - Package& dd) { - if (m == 0) { - return true; - } - if (u1.isTerminal() && u2.isTerminal()) { - return u1 == u2; - } - if (u1.isZeroTerminal() || u2.isZeroTerminal()) { - return false; - } - // add qubits such that u1 and u2 have the same dimension - if (u1.isTerminal()) { - auto w = u1.w; - u1 = dd.makeIdent(u2.p->v + 1); - u1.w = w; - } else if (u2.isTerminal()) { - auto w = u2.w; - u2 = dd.makeIdent(u1.p->v + 1); - u2.w = w; - } else if (u1.p->v < u2.p->v) { - u1 = dd.kronecker(dd.makeIdent(u2.p->v - u1.p->v), u1); - } else if (u1.p->v > u2.p->v) { - u2 = dd.kronecker(dd.makeIdent(u1.p->v - u2.p->v), u2); - } - - const Qubit n = u1.p->v + 1; - Qubit k = n - d; - Qubit extra{0}; - if (m > k) { - extra = m - k; - } - k = k + extra; - - const auto u1Prime = partialEquivalenceCheckDDSubroutine(u1, m, k, extra, dd); - const auto u2Prime = partialEquivalenceCheckDDSubroutine(u2, m, k, extra, dd); - - return u1Prime == u2Prime; -} - -/** - Checks for partial equivalence between the two circuits c1 and c2 - that have no ancilla qubits. - Assumption: the input and output permutations are the same. - - @param circuit1 First circuit - @param circuit2 Second circuit - @return true if the two circuits c1 and c2 are partially equivalent. - **/ -template -bool zeroAncillaePartialEquivalenceCheck(qc::QuantumComputation c1, - qc::QuantumComputation c2, - Package& dd) { - if (c1.getNqubits() != c2.getNqubits() || - c1.getGarbage() != c2.getGarbage()) { - throw std::invalid_argument( - "The circuits need to have the same number of qubits and the same " - "permutation of input and output qubits."); - } - c2.invert(); - for (auto& gate : c1) { - c2.emplace_back(gate); - } - - const auto u = buildFunctionality(&c2, dd, false, false); - - return dd.isCloseToIdentity(u, 1.0E-10, c1.getGarbage(), false); -} - -// get next garbage qubit after n -inline Qubit getNextGarbage(Qubit n, const std::vector& garbage) { - while (n < static_cast(garbage.size()) && !garbage.at(n)) { - n++; - } - return n; -} -/** - Checks for partial equivalence between the two circuits c1 and c2. - Assumption: the data qubits are all at the beginning of the input qubits and - the input and output permutations are the same. - - @param circuit1 First circuit - @param circuit2 Second circuit - @return true if the two circuits c1 and c2 are partially equivalent. - **/ -template -bool partialEquivalenceCheck(qc::QuantumComputation c1, - qc::QuantumComputation c2, Package& dd) { - - const auto d1 = c1.getNqubitsWithoutAncillae(); - const auto d2 = c2.getNqubitsWithoutAncillae(); - const auto m1 = c1.getNmeasuredQubits(); - const auto m2 = c2.getNmeasuredQubits(); - if (m1 != m2 || d1 != d2) { - return false; - } - const auto n1 = static_cast(c1.getNqubits()); - const auto n2 = static_cast(c2.getNqubits()); - if (d1 == n1 && d2 == n2) { - // no ancilla qubits - return zeroAncillaePartialEquivalenceCheck(c1, c2, dd); - } - // add swaps in order to put the measured (= not garbage) qubits in the end - const auto garbage1 = c1.getGarbage(); - - auto nextGarbage = getNextGarbage(0, garbage1); - // find the first garbage qubit at the end - for (std::int64_t i = std::min(n1, n2) - 1; - i >= static_cast(m1); i--) { - if (!garbage1.at(static_cast(i))) { - // swap it to the beginning - c1.swap(static_cast(i), nextGarbage); - c2.swap(static_cast(i), nextGarbage); - ++nextGarbage; - nextGarbage = getNextGarbage(nextGarbage, garbage1); - } - } - - // partialEquivalenceCheck with dd - - const auto u1 = buildFunctionality(&c1, dd, false, false); - const auto u2 = buildFunctionality(&c2, dd, false, false); - - return partialEquivalenceCheckDD(u1, u2, static_cast(d1), - static_cast(m1), dd); -} - -std::pair -generateRandomBenchmark(size_t n, qc::Qubit d, qc::Qubit m); -} // namespace dd diff --git a/src/dd/CMakeLists.txt b/src/dd/CMakeLists.txt index b8eff716c..a9d70ccf1 100644 --- a/src/dd/CMakeLists.txt +++ b/src/dd/CMakeLists.txt @@ -19,7 +19,6 @@ if(NOT TARGET ${MQT_CORE_TARGET_NAME}-dd) RealNumber.cpp RealNumberUniqueTable.cpp Simulation.cpp - Verification.cpp statistics/MemoryManagerStatistics.cpp statistics/Statistics.cpp statistics/TableStatistics.cpp diff --git a/src/dd/Verification.cpp b/src/dd/Verification.cpp deleted file mode 100644 index 26c440716..000000000 --- a/src/dd/Verification.cpp +++ /dev/null @@ -1,336 +0,0 @@ -#include "dd/Verification.hpp" - -#include "QuantumComputation.hpp" -#include "operations/OpType.hpp" -#include "operations/StandardOperation.hpp" - -namespace dd { - -const std::vector> PRE_GENERATED_CIRCUITS_SIZE_1_1{ - {}, {}, {}, {}}; - -const std::vector> PRE_GENERATED_CIRCUITS_SIZE_1_2{ - {Z}, {Tdg}, {S}, {Sdg}}; - -const std::vector> PRE_GENERATED_CIRCUITS_SIZE_2_1{ - {}, {}, {}, {}, {X}, {X}}; - -const std::vector> PRE_GENERATED_CIRCUITS_SIZE_2_2{ - {Z}, {Tdg}, {S}, {Sdg}, {X, Z}, {Z, X}}; - -void addPreGeneratedCircuits(QuantumComputation& circuit1, - QuantumComputation& circuit2, const size_t n, - const qc::Qubit groupBeginIndex, - const qc::Qubit groupSize) { - - const auto& circuits1 = groupSize == 1 ? PRE_GENERATED_CIRCUITS_SIZE_1_1 - : PRE_GENERATED_CIRCUITS_SIZE_2_1; - const auto& circuits2 = groupSize == 1 ? PRE_GENERATED_CIRCUITS_SIZE_1_2 - : PRE_GENERATED_CIRCUITS_SIZE_2_2; - const auto nrCircuits = circuits1.size(); - auto randomGenerator = circuit1.getGenerator(); - std::uniform_int_distribution randomDistribution(0, nrCircuits - 1); - - const auto randomIndex = randomDistribution(randomGenerator); - const auto x1 = circuits1[randomIndex]; - const auto x2 = circuits2[randomIndex]; - for (auto gateType : x1) { - if (gateType == X) { // add CNOT - circuit1.emplace_back(n, groupBeginIndex, - groupBeginIndex + 1, gateType); - } else { - circuit1.emplace_back(n, groupBeginIndex, gateType); - } - } - for (auto gateType : x2) { - if (gateType == X) { // add CNOT - circuit2.emplace_back(n, groupBeginIndex, - groupBeginIndex + 1, gateType); - } else { - circuit2.emplace_back(n, groupBeginIndex, gateType); - } - } -} - -void addDecomposedCcxGate(QuantumComputation& circuit, const Controls& controls, - const qc::Qubit target) { - const qc::Qubit control1 = controls.begin()->qubit; - const qc::Qubit control2 = (++controls.begin())->qubit; - circuit.h(target); - circuit.cx(control1, target); - circuit.tdg(target); - circuit.cx(control2, target); - circuit.t(target); - circuit.cx(control1, target); - circuit.tdg(target); - circuit.cx(control2, target); - circuit.t(target); - circuit.t(control1); - circuit.h(target); - circuit.cx(control2, control1); - circuit.t(control2); - circuit.tdg(control1); - circuit.cx(control2, control1); -} - -void addStandardOperationToCircuit(QuantumComputation& circuit, - const StandardOperation& op, - const bool decomposeCcx) { - if (op.getType() == X && decomposeCcx && op.getControls().size() == 2) { - // decompose toffoli gate - addDecomposedCcxGate(circuit, op.getControls(), op.getTargets()[0]); - } else { - circuit.emplace_back(op); - } -} - -std::vector -fiveDiffferentRandomNumbers(const qc::Qubit min, const qc::Qubit max, - std::mt19937_64 randomGenerator) { - std::vector numbers; - - for (qc::Qubit i = min; i < max; i++) { - numbers.emplace_back(i); - } - std::shuffle(numbers.begin(), numbers.end(), randomGenerator); - - const int64_t lengthOutputVector{ - static_cast(std::min(5UL, numbers.size()))}; - - std::vector outputVector(numbers.begin(), - numbers.begin() + lengthOutputVector); - return outputVector; -} - -StandardOperation convertToStandardOperation( - const size_t n, const size_t nrQubits, const OpType randomOpType, - const qc::Qubit randomTarget1, const qc::Qubit randomTarget2, - const fp randomParameter1, const fp randomParameter2, - const fp randomParameter3, const Controls& randomControls) { - - switch (randomOpType) { - // two targets and zero parameters - case qc::SWAP: - case qc::iSWAP: - case qc::iSWAPdg: - case qc::Peres: - case qc::Peresdg: - case qc::DCX: - case qc::ECR: - if (nrQubits > 1) { - return {n, randomControls, Targets{randomTarget1, randomTarget2}, - randomOpType}; - } - break; - - // two targets and one parameter - case qc::RXX: - case qc::RYY: - case qc::RZZ: - case qc::RZX: - if (nrQubits > 1) { - return {n, randomControls, Targets{randomTarget1, randomTarget2}, - randomOpType, std::vector{randomParameter1}}; - } - break; - - // two targets and two parameters - case qc::XXminusYY: - case qc::XXplusYY: - if (nrQubits > 1) { - return {n, randomControls, Targets{randomTarget1, randomTarget2}, - randomOpType, - std::vector{randomParameter1, randomParameter2}}; - } - break; - - // one target and zero parameters - case qc::I: - case qc::H: - case qc::X: - case qc::Y: - case qc::Z: - case qc::S: - case qc::Sdg: - case qc::T: - case qc::Tdg: - case qc::V: - case qc::Vdg: - case qc::SX: - case qc::SXdg: - return {n, randomControls, randomTarget1, randomOpType}; - // one target and three parameters - case qc::U: - return { - n, randomControls, randomTarget1, randomOpType, - std::vector{randomParameter1, randomParameter2, randomParameter3}}; - // one target and two parameters - case qc::U2: - return {n, randomControls, randomTarget1, randomOpType, - std::vector{randomParameter1, randomParameter2}}; - // one target and one parameter - case qc::P: - case qc::RX: - case qc::RY: - case qc::RZ: - return {n, randomControls, randomTarget1, randomOpType, - std::vector{randomParameter1}}; - default: - return {n, randomTarget1, qc::I}; - } - return {n, randomTarget1, qc::I}; -} - -StandardOperation makeRandomStandardOperation(const size_t n, - const qc::Qubit nrQubits, - const qc::Qubit min, - std::mt19937_64 randomGenerator) { - const auto randomNumbers = - fiveDiffferentRandomNumbers(min, min + nrQubits, randomGenerator); - - // choose one of the non-compound operations, but not "None", and also - // not GPhase or I or Barrier - std::uniform_int_distribution<> randomDistrOpType(H, RZX); - auto randomOpType = static_cast(randomDistrOpType(randomGenerator)); - const qc::Qubit randomTarget1 = randomNumbers[0]; - qc::Qubit randomTarget2{min}; - if (randomNumbers.size() > 1) { - randomTarget2 = randomNumbers[1]; - }; - // choose random controls, but not more than available qubits - std::uniform_int_distribution randomDistrNrControls(0, 2); - size_t nrControls = std::min(randomNumbers.size() - 3, - randomDistrNrControls(randomGenerator)); - if (randomNumbers.size() < 3) { - nrControls = 0; - } - if (nrControls == 2) { - // otherwise toffoli gates are almost never generated - randomOpType = qc::X; - } - Controls randomControls{}; - for (size_t i = 0; i < nrControls; i++) { - randomControls.emplace(randomNumbers[i + 2]); - } - std::uniform_real_distribution randomDistrParameters(0, 2 * PI); - const fp randomParameter1 = randomDistrParameters(randomGenerator); - const fp randomParameter2 = randomDistrParameters(randomGenerator); - const fp randomParameter3 = randomDistrParameters(randomGenerator); - // const std::vector randomParameters{PI, PI_2, PI_4}; - // const fp randomParameter1 = - // randomParameters[static_cast(rand()) % - // randomParameters.size()]; - // const fp randomParameter2 = - // randomParameters[static_cast(rand()) % - // randomParameters.size()]; - // const fp randomParameter3 = - // randomParameters[static_cast(rand()) % - // randomParameters.size()]; - return convertToStandardOperation( - n, nrQubits, randomOpType, randomTarget1, randomTarget2, randomParameter1, - randomParameter2, randomParameter3, randomControls); -} - -std::pair -generateRandomBenchmark(const size_t n, const qc::Qubit d, const qc::Qubit m) { - if (d > n || m > n) { - throw std::runtime_error("The number of data or measured qubits can't be " - "bigger than the total number of qubits. n = " + - std::to_string(n) + "; d = " + std::to_string(d) + - "; m = " + std::to_string(m)); - } - - qc::QuantumComputation circuit1{n}; - qc::QuantumComputation circuit2{n}; - - auto randomGenerator = circuit1.getGenerator(); - - // 1) H gates - for (qc::Qubit i = 0U; i < d; i++) { - circuit1.h(i); - circuit2.h(i); - } - - circuit1.barrier(); - circuit2.barrier(); - - // 2) Totally equivalent subcircuits - // Generate a random subcircuit with d qubits and 3*d gates to apply - // on both circuits, but all the Toffoli gates in circuit2 are decomposed - for (qc::Qubit i = 0U; i < 3 * d; i++) { - const auto op = makeRandomStandardOperation(n, d, 0, randomGenerator); - addStandardOperationToCircuit(circuit1, op, false); - addStandardOperationToCircuit(circuit2, op, true); - } - - circuit1.barrier(); - circuit2.barrier(); - - // 3) Partially equivalent subcircuits - // Divide data qubits into groups of size 1 or 2. For each group, we apply - // pre-generated subcircuits, which are pairwise partially equivalent. - qc::Qubit groupBeginIndex = 0; - std::uniform_int_distribution randomDistrGroupSize(1, 2); - while (groupBeginIndex < d) { - qc::Qubit groupSize = 1; - if (groupBeginIndex < d - 1) { - groupSize = randomDistrGroupSize(randomGenerator); - } - - addPreGeneratedCircuits(circuit1, circuit2, n, groupBeginIndex, groupSize); - - groupBeginIndex += groupSize; - } - - circuit1.barrier(); - circuit2.barrier(); - - // 4) Arbitrary gates - // Arbitrary gates are added to data qubits that are not measured - if (d > m) { - const qc::Qubit notMQubits = d - m; - for (qc::Qubit i = 0U; i < notMQubits; i++) { - addStandardOperationToCircuit( - circuit1, - makeRandomStandardOperation(n, notMQubits, m, randomGenerator), - false); - addStandardOperationToCircuit( - circuit2, - makeRandomStandardOperation(n, notMQubits, m, randomGenerator), - false); - } - } - - circuit1.barrier(); - circuit2.barrier(); - - // 5) CNOT gates - // For each ancilla qubit, add a CNOT that has the ancilla as control qubit, - // and any data qubit as target. As ancilla qubits are initially set to 0 and - // we haven't added any other gates to the ancilla qubits until now, these - // CNOT gates do not affect the circuit. - if (d > 0) { - qc::Qubit currentDataQubit = 0; - for (qc::Qubit currentAncillaQubit = d; currentAncillaQubit < n; - currentAncillaQubit++) { - auto nextDataQubit = (currentDataQubit + 1) % d; - circuit1.cx(currentAncillaQubit, currentDataQubit); - circuit2.cx(currentAncillaQubit, nextDataQubit); - currentDataQubit = nextDataQubit; - } - } - - for (qc::Qubit i = d; i < n; i++) { - circuit1.setLogicalQubitAncillary(i); - circuit2.setLogicalQubitAncillary(i); - } - - for (qc::Qubit i = m; i < n; i++) { - circuit1.setLogicalQubitGarbage(i); - circuit2.setLogicalQubitGarbage(i); - } - - return std::make_pair(circuit1, circuit2); -} - -} // namespace dd diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c98e3c228..8e358d581 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -13,7 +13,6 @@ package_add_test( dd/test_package.cpp dd/test_dd_functionality.cpp dd/test_dd_noise_functionality.cpp - dd/test_partial_equivalence.cpp algorithms/eval_dynamic_circuits.cpp algorithms/test_qft.cpp algorithms/test_grover.cpp diff --git a/test/circuits/Grover_1.qasm b/test/circuits/Grover_1.qasm deleted file mode 100644 index f7d74e5d0..000000000 --- a/test/circuits/Grover_1.qasm +++ /dev/null @@ -1,68 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[11]; -x q[10]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; -h q[9]; -h q[10]; -mcx q[0], q[10]; -mcx q[0], q[1], q[10]; -mcx q[0], q[1], q[2], q[10]; -mcx q[0], q[1], q[2], q[3], q[10]; -mcx q[0], q[1], q[2], q[3], q[4], q[10]; -mcx q[0], q[1], q[2], q[3], q[4], q[5], q[10]; -mcx q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[10]; -mcx q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[7], q[10]; -mcx q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[7], q[8], q[10]; -mcx q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[7], q[8], q[9], q[10]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; -h q[9]; -x q[0]; -x q[1]; -x q[2]; -x q[3]; -x q[4]; -x q[5]; -x q[6]; -x q[7]; -x q[8]; -x q[9]; -h q[9]; -mcx q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[7], q[8], q[9]; -h q[9]; -x q[0]; -x q[1]; -x q[2]; -x q[3]; -x q[4]; -x q[5]; -x q[6]; -x q[7]; -x q[8]; -x q[9]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; -h q[9]; diff --git a/test/circuits/Grover_2.qasm b/test/circuits/Grover_2.qasm deleted file mode 100644 index 10aef8f77..000000000 --- a/test/circuits/Grover_2.qasm +++ /dev/null @@ -1,70 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[12]; -x q[10]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; -h q[9]; -h q[10]; -mcx q[0], q[10]; -mcx q[0], q[1], q[10]; -mcx q[0], q[1], q[2], q[10]; -mcx q[0], q[1], q[2], q[3], q[10]; -mcx q[0], q[1], q[2], q[3], q[4], q[11]; -mcx q[11], q[10]; -mcx q[5], q[11], q[10]; -mcx q[5], q[6], q[11], q[10]; -mcx q[5], q[6], q[7], q[11], q[10]; -mcx q[5], q[6], q[7], q[8], q[11], q[10]; -mcx q[5], q[6], q[7], q[8], q[9], q[11], q[10]; -mcx q[0], q[1], q[2], q[3], q[4], q[11]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; -h q[9]; -x q[0]; -x q[1]; -x q[2]; -x q[3]; -x q[4]; -x q[5]; -x q[6]; -x q[7]; -x q[8]; -x q[9]; -h q[9]; -mcx q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[7], q[8], q[9]; -h q[9]; -x q[0]; -x q[1]; -x q[2]; -x q[3]; -x q[4]; -x q[5]; -x q[6]; -x q[7]; -x q[8]; -x q[9]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; -h q[9]; diff --git a/test/circuits/add6_196_1.qasm b/test/circuits/add6_196_1.qasm deleted file mode 100644 index 90983b6a0..000000000 --- a/test/circuits/add6_196_1.qasm +++ /dev/null @@ -1,245 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[19]; -creg c[19]; -h q[7]; -h q[8]; -h q[9]; -h q[10]; -h q[11]; -h q[12]; -h q[13]; -h q[14]; -h q[15]; -h q[16]; -h q[17]; -h q[18]; -mcx q[16],q[10],q[9],q[2]; -ccx q[16],q[10],q[4]; -ccx q[16],q[10],q[3]; -ccx q[17],q[11],q[5]; -ccx q[17],q[11],q[4]; -ccx q[17],q[11],q[3]; -ccx q[15],q[9],q[3]; -ccx q[15],q[9],q[2]; -ccx q[15],q[9],q[1]; -ccx q[15],q[9],q[0]; -mcx q[15],q[9],q[8],q[1]; -mcx q[15],q[9],q[8],q[0]; -mcx q[14],q[8],q[7],q[0]; -mcx q[16],q[15],q[10],q[2]; -mcx q[16],q[15],q[10],q[1]; -mcx q[16],q[15],q[14],q[10],q[1]; -mcx q[18],q[12],q[11],q[4]; -mcx q[18],q[12],q[11],q[3]; -mcx q[18],q[12],q[11],q[2]; -mcx q[18],q[12],q[11],q[1]; -mcx q[17],q[11],q[10],q[3]; -mcx q[14],q[13],q[8],q[0]; -ccx q[14],q[8],q[2]; -ccx q[14],q[8],q[1]; -ccx q[13],q[7],q[1]; -ccx q[13],q[7],q[0]; -x q[16]; -mcx q[17],q[16],q[15],q[11],q[8],q[1]; -mcx q[17],q[16],q[11],q[9],q[8],q[1]; -mcx q[17],q[16],q[11],q[3]; -mcx q[18],q[16],q[12],q[11],q[9],q[2]; -mcx q[18],q[16],q[12],q[11],q[9],q[1]; -mcx q[18],q[17],q[16],q[12],q[9],q[2]; -mcx q[18],q[17],q[16],q[12],q[9],q[1]; -x q[10]; -mcx q[18],q[15],q[14],q[12],q[11],q[10],q[7],q[0]; -mcx q[18],q[17],q[15],q[14],q[12],q[10],q[7],q[0]; -mcx q[17],q[11],q[10],q[9],q[8],q[1]; -mcx q[17],q[15],q[11],q[10],q[8],q[1]; -ccx q[16],q[10],q[4]; -x q[17]; -mcx q[18],q[17],q[12],q[4]; -mcx q[18],q[17],q[15],q[14],q[12],q[10],q[1]; -mcx q[18],q[17],q[15],q[12],q[10],q[8],q[7],q[0]; -mcx q[18],q[17],q[12],q[10],q[9],q[2]; -mcx q[18],q[17],q[12],q[10],q[9],q[1]; -mcx q[18],q[17],q[12],q[10],q[9],q[0]; -mcx q[18],q[17],q[12],q[10],q[9],q[8],q[1]; -mcx q[18],q[17],q[15],q[12],q[10],q[2]; -mcx q[18],q[17],q[15],q[12],q[10],q[1]; -mcx q[18],q[17],q[12],q[10],q[3]; -mcx q[18],q[17],q[14],q[13],q[12],q[10],q[9],q[0]; -x q[10]; -mcx q[18],q[17],q[16],q[12],q[3]; -mcx q[18],q[17],q[16],q[12],q[0]; -mcx q[18],q[17],q[16],q[15],q[12],q[2]; -mcx q[18],q[17],q[16],q[15],q[12],q[1]; -mcx q[18],q[17],q[16],q[15],q[12],q[0]; -x q[11]; -mcx q[18],q[12],q[11],q[10],q[3]; -mcx q[18],q[15],q[12],q[11],q[10],q[2]; -mcx q[18],q[15],q[12],q[11],q[10],q[1]; -x q[10]; -mcx q[18],q[12],q[11],q[10],q[9],q[2]; -mcx q[18],q[15],q[14],q[12],q[11],q[10],q[1]; -mcx q[18],q[14],q[12],q[11],q[10],q[9],q[7],q[0]; -mcx q[18],q[15],q[12],q[11],q[10],q[8],q[7],q[0]; -mcx q[18],q[15],q[13],q[12],q[11],q[10],q[8],q[0]; -mcx q[18],q[16],q[12],q[11],q[3]; -mcx q[18],q[16],q[12],q[11],q[2]; -mcx q[18],q[16],q[12],q[11],q[1]; -ccx q[17],q[11],q[5]; -x q[13]; -mcx q[15],q[14],q[13],q[9],q[0]; -mcx q[15],q[13],q[9],q[8],q[0]; -mcx q[18],q[17],q[13],q[12],q[10],q[9],q[8],q[0]; -x q[10]; -mcx q[18],q[13],q[12],q[11],q[10],q[9],q[8],q[0]; -mcx q[18],q[16],q[15],q[13],q[12],q[11],q[8],q[0]; -x q[16]; -mcx q[18],q[16],q[13],q[12],q[11],q[9],q[8],q[0]; -x q[14]; -mcx q[16],q[14],q[10],q[9],q[1]; -mcx q[15],q[14],q[9],q[1]; -x q[10]; -mcx q[18],q[17],q[15],q[14],q[13],q[12],q[10],q[0]; -mcx q[18],q[17],q[15],q[14],q[12],q[10],q[0]; -mcx q[18],q[17],q[14],q[12],q[10],q[9],q[7],q[0]; -mcx q[18],q[17],q[14],q[12],q[10],q[9],q[1]; -mcx q[18],q[14],q[12],q[11],q[10],q[9],q[1]; -x q[10]; -mcx q[16],q[14],q[13],q[10],q[9],q[0]; -mcx q[16],q[15],q[14],q[13],q[10],q[0]; -x q[16]; -mcx q[18],q[17],q[16],q[14],q[13],q[12],q[9],q[0]; -mcx q[18],q[17],q[16],q[15],q[14],q[13],q[12],q[0]; -x q[7]; -x q[10]; -mcx q[18],q[12],q[11],q[10],q[9],q[8],q[7],q[0]; -ccx q[13],q[7],q[1]; -x q[13]; -mcx q[15],q[14],q[9],q[7],q[0]; -x q[8]; -mcx q[18],q[16],q[15],q[12],q[11],q[8],q[1]; -mcx q[18],q[16],q[12],q[11],q[9],q[8],q[1]; -mcx q[18],q[17],q[16],q[12],q[9],q[8],q[1]; -mcx q[18],q[17],q[16],q[12],q[9],q[8],q[0]; -mcx q[18],q[17],q[16],q[15],q[12],q[8],q[1]; -mcx q[18],q[17],q[16],q[15],q[12],q[8],q[0]; -mcx q[18],q[17],q[15],q[13],q[12],q[10],q[8],q[0]; -mcx q[18],q[17],q[15],q[12],q[10],q[8],q[1]; -mcx q[15],q[9],q[8],q[7],q[0]; -mcx q[15],q[9],q[8],q[0]; -mcx q[18],q[16],q[15],q[12],q[11],q[8],q[7],q[0]; -mcx q[18],q[17],q[16],q[15],q[12],q[8],q[7],q[0]; -mcx q[18],q[17],q[16],q[12],q[9],q[8],q[7],q[0]; -mcx q[18],q[17],q[12],q[10],q[9],q[8],q[7],q[0]; -x q[17]; -mcx q[18],q[16],q[12],q[11],q[9],q[8],q[7],q[0]; -x q[11]; -ccx q[14],q[8],q[2]; -x q[15]; -mcx q[17],q[15],q[11],q[10],q[2]; -mcx q[17],q[15],q[11],q[10],q[7],q[0]; -mcx q[17],q[16],q[15],q[14],q[11],q[7],q[0]; -x q[7]; -mcx q[17],q[15],q[11],q[10],q[8],q[7],q[0]; -mcx q[17],q[15],q[14],q[11],q[10],q[0]; -mcx q[17],q[15],q[14],q[13],q[11],q[10],q[0]; -mcx q[17],q[16],q[15],q[11],q[2]; -x q[14]; -mcx q[17],q[15],q[14],q[11],q[10],q[1]; -mcx q[17],q[16],q[15],q[14],q[11],q[1]; -mcx q[17],q[16],q[15],q[11],q[8],q[7],q[0]; -mcx q[17],q[16],q[15],q[13],q[11],q[8],q[0]; -x q[16]; -mcx q[17],q[15],q[13],q[11],q[10],q[8],q[0]; -x q[10]; -mcx q[16],q[15],q[10],q[8],q[1]; -x q[7]; -mcx q[16],q[15],q[14],q[10],q[7],q[0]; -mcx q[17],q[15],q[14],q[11],q[10],q[7],q[0]; -mcx q[17],q[15],q[14],q[11],q[7],q[0]; -x q[13]; -mcx q[16],q[15],q[10],q[8],q[7],q[0]; -mcx q[16],q[15],q[10],q[7],q[0]; -mcx q[16],q[15],q[13],q[10],q[8],q[0]; -x q[16]; -mcx q[17],q[16],q[15],q[14],q[13],q[11],q[0]; -mcx q[17],q[16],q[15],q[13],q[11],q[0]; -x q[16]; -x q[13]; -x q[11]; -mcx q[18],q[16],q[15],q[12],q[11],q[2]; -mcx q[18],q[16],q[15],q[12],q[11],q[1]; -mcx q[18],q[15],q[14],q[13],q[12],q[11],q[10],q[0]; -mcx q[18],q[16],q[15],q[14],q[13],q[12],q[11],q[0]; -mcx q[18],q[15],q[12],q[11],q[10],q[8],q[1]; -mcx q[18],q[15],q[12],q[11],q[8],q[1]; -x q[16]; -mcx q[18],q[16],q[15],q[14],q[12],q[11],q[1]; -mcx q[18],q[16],q[15],q[14],q[12],q[11],q[0]; -mcx q[18],q[16],q[15],q[14],q[12],q[11],q[7],q[0]; -mcx q[18],q[16],q[15],q[12],q[11],q[7],q[0]; -x q[11]; -x q[17]; -mcx q[18],q[17],q[16],q[15],q[14],q[12],q[1]; -mcx q[18],q[17],q[16],q[15],q[13],q[12],q[8],q[0]; -mcx q[18],q[17],q[16],q[15],q[14],q[12],q[7],q[0]; -x q[7]; -mcx q[18],q[17],q[16],q[15],q[12],q[7],q[0]; -x q[17]; -x q[9]; -mcx q[17],q[16],q[11],q[9],q[2]; -mcx q[17],q[16],q[11],q[9],q[8],q[7],q[0]; -mcx q[17],q[16],q[11],q[9],q[7],q[0]; -mcx q[17],q[16],q[14],q[11],q[9],q[7],q[0]; -mcx q[17],q[16],q[14],q[11],q[9],q[1]; -mcx q[17],q[16],q[13],q[11],q[9],q[8],q[0]; -x q[16]; -mcx q[16],q[13],q[10],q[9],q[8],q[0]; -mcx q[16],q[10],q[9],q[8],q[1]; -mcx q[16],q[10],q[9],q[8],q[0]; -x q[8]; -ccx q[15],q[9],q[3]; -x q[7]; -mcx q[16],q[10],q[9],q[8],q[7],q[0]; -mcx q[16],q[14],q[10],q[9],q[7],q[0]; -x q[10]; -mcx q[17],q[11],q[10],q[9],q[2]; -mcx q[17],q[14],q[11],q[10],q[9],q[1]; -mcx q[17],q[14],q[11],q[10],q[9],q[0]; -mcx q[17],q[11],q[10],q[9],q[8],q[7],q[0]; -mcx q[17],q[14],q[11],q[10],q[9],q[7],q[0]; -mcx q[17],q[11],q[10],q[9],q[8],q[0]; -x q[8]; -mcx q[17],q[13],q[11],q[10],q[9],q[8],q[0]; -x q[14]; -mcx q[17],q[16],q[14],q[13],q[11],q[9],q[0]; -mcx q[17],q[14],q[13],q[11],q[10],q[9],q[0]; -mcx q[17],q[14],q[13],q[11],q[9],q[0]; -x q[14]; -x q[11]; -x q[16]; -mcx q[18],q[16],q[14],q[12],q[11],q[9],q[1]; -mcx q[18],q[16],q[14],q[12],q[11],q[9],q[0]; -mcx q[18],q[16],q[14],q[13],q[12],q[11],q[9],q[0]; -mcx q[18],q[14],q[13],q[12],q[11],q[10],q[9],q[0]; -mcx q[18],q[12],q[11],q[10],q[9],q[8],q[1]; -x q[17]; -mcx q[18],q[17],q[16],q[14],q[12],q[9],q[1]; -mcx q[18],q[17],q[16],q[13],q[12],q[9],q[8],q[0]; -x q[14]; -mcx q[18],q[16],q[14],q[12],q[11],q[9],q[7],q[0]; -mcx q[18],q[17],q[16],q[14],q[12],q[9],q[7],q[0]; -x q[12]; -cx q[12],q[6]; -ccx q[18],q[12],q[5]; -ccx q[18],q[12],q[4]; -ccx q[18],q[12],q[3]; -ccx q[18],q[12],q[2]; -ccx q[18],q[12],q[1]; -x q[18]; -cx q[18],q[6]; -cx q[18],q[5]; -cx q[18],q[4]; -cx q[18],q[3]; -cx q[18],q[2]; -cx q[18],q[1]; diff --git a/test/circuits/add6_196_2.qasm b/test/circuits/add6_196_2.qasm deleted file mode 100644 index 08e70c01a..000000000 --- a/test/circuits/add6_196_2.qasm +++ /dev/null @@ -1,270 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[19]; -creg c[19]; -h q[7]; -h q[8]; -h q[9]; -h q[10]; -h q[11]; -h q[12]; -h q[13]; -h q[14]; -h q[15]; -h q[16]; -h q[17]; -h q[18]; -mcx q[16],q[10],q[9],q[2]; -ccx q[16],q[10],q[4]; -ccx q[16],q[10],q[3]; -ccx q[17],q[11],q[5]; -ccx q[17],q[11],q[4]; -ccx q[17],q[11],q[3]; -ccx q[15],q[9],q[3]; -ccx q[15],q[9],q[2]; -ccx q[15],q[9],q[1]; -ccx q[15],q[9],q[0]; -mcx q[15],q[9],q[8],q[1]; -mcx q[15],q[9],q[8],q[0]; -mcx q[14],q[8],q[7],q[0]; -mcx q[16],q[15],q[10],q[2]; -mcx q[16],q[15],q[10],q[1]; -mcx q[16],q[15],q[14],q[10],q[1]; -mcx q[18],q[12],q[11],q[4]; -mcx q[18],q[12],q[11],q[3]; -mcx q[18],q[12],q[11],q[2]; -mcx q[18],q[12],q[11],q[1]; -mcx q[17],q[11],q[10],q[3]; -mcx q[14],q[13],q[8],q[0]; -ccx q[14],q[8],q[2]; -ccx q[14],q[8],q[1]; -ccx q[13],q[7],q[1]; -ccx q[13],q[7],q[0]; -x q[16]; -mcx q[17],q[16],q[15],q[11],q[8],q[1]; -mcx q[17],q[16],q[11],q[9],q[8],q[1]; -mcx q[17],q[16],q[11],q[3]; -mcx q[18],q[16],q[12],q[11],q[9],q[2]; -mcx q[18],q[16],q[12],q[11],q[9],q[1]; -mcx q[18],q[17],q[16],q[12],q[9],q[2]; -mcx q[18],q[17],q[16],q[12],q[9],q[1]; -x q[10]; -mcx q[18],q[15],q[14],q[12],q[11],q[10],q[7],q[0]; -mcx q[18],q[17],q[15],q[14],q[12],q[10],q[7],q[0]; -mcx q[17],q[11],q[10],q[9],q[8],q[1]; -mcx q[17],q[15],q[11],q[10],q[8],q[1]; -ccx q[16],q[10],q[4]; -x q[17]; -mcx q[18],q[17],q[12],q[4]; -mcx q[18],q[17],q[15],q[14],q[12],q[10],q[1]; -mcx q[18],q[17],q[15],q[12],q[10],q[8],q[7],q[0]; -mcx q[18],q[17],q[12],q[10],q[9],q[2]; -mcx q[18],q[17],q[12],q[10],q[9],q[1]; -mcx q[18],q[17],q[12],q[10],q[9],q[0]; -mcx q[18],q[17],q[12],q[10],q[9],q[8],q[1]; -mcx q[18],q[17],q[15],q[12],q[10],q[2]; -mcx q[18],q[17],q[15],q[12],q[10],q[1]; -mcx q[18],q[17],q[12],q[10],q[3]; -mcx q[18],q[17],q[14],q[13],q[12],q[10],q[9],q[0]; -x q[10]; -mcx q[18],q[17],q[16],q[12],q[3]; -mcx q[18],q[17],q[16],q[12],q[0]; -mcx q[18],q[17],q[16],q[15],q[12],q[2]; -mcx q[18],q[17],q[16],q[15],q[12],q[1]; -mcx q[18],q[17],q[16],q[15],q[12],q[0]; -x q[11]; -mcx q[18],q[12],q[11],q[10],q[3]; -mcx q[18],q[15],q[12],q[11],q[10],q[2]; -mcx q[18],q[15],q[12],q[11],q[10],q[1]; -x q[10]; -mcx q[18],q[12],q[11],q[10],q[9],q[2]; -mcx q[18],q[15],q[14],q[12],q[11],q[10],q[1]; -mcx q[18],q[14],q[12],q[11],q[10],q[9],q[7],q[0]; -mcx q[18],q[15],q[12],q[11],q[10],q[8],q[7],q[0]; -mcx q[18],q[15],q[13],q[12],q[11],q[10],q[8],q[0]; -mcx q[18],q[16],q[12],q[11],q[3]; -mcx q[18],q[16],q[12],q[11],q[2]; -mcx q[18],q[16],q[12],q[11],q[1]; -ccx q[17],q[11],q[5]; -x q[13]; -mcx q[15],q[14],q[13],q[9],q[0]; -mcx q[15],q[13],q[9],q[8],q[0]; -mcx q[18],q[17],q[13],q[12],q[10],q[9],q[8],q[0]; -x q[10]; -mcx q[18],q[13],q[12],q[11],q[10],q[9],q[8],q[0]; -mcx q[18],q[16],q[15],q[13],q[12],q[11],q[8],q[0]; -x q[16]; -mcx q[18],q[16],q[13],q[12],q[11],q[9],q[8],q[0]; -x q[14]; -mcx q[16],q[14],q[10],q[9],q[1]; -mcx q[15],q[14],q[9],q[1]; -x q[10]; -mcx q[18],q[17],q[15],q[14],q[13],q[12],q[10],q[0]; -mcx q[18],q[17],q[15],q[14],q[12],q[10],q[0]; -mcx q[18],q[17],q[14],q[12],q[10],q[9],q[7],q[0]; -mcx q[18],q[17],q[14],q[12],q[10],q[9],q[1]; -mcx q[18],q[14],q[12],q[11],q[10],q[9],q[1]; -x q[10]; -mcx q[16],q[14],q[13],q[10],q[9],q[0]; -mcx q[16],q[15],q[14],q[13],q[10],q[0]; -x q[16]; -mcx q[18],q[17],q[16],q[14],q[13],q[12],q[9],q[0]; -mcx q[18],q[17],q[16],q[15],q[14],q[13],q[12],q[0]; -x q[7]; -x q[10]; -mcx q[18],q[12],q[11],q[10],q[9],q[8],q[7],q[0]; -ccx q[13],q[7],q[1]; -x q[13]; -mcx q[15],q[14],q[9],q[7],q[0]; -x q[8]; -mcx q[18],q[16],q[15],q[12],q[11],q[8],q[1]; -mcx q[18],q[16],q[12],q[11],q[9],q[8],q[1]; -mcx q[18],q[17],q[16],q[12],q[9],q[8],q[1]; -mcx q[18],q[17],q[16],q[12],q[9],q[8],q[0]; -mcx q[18],q[17],q[16],q[15],q[12],q[8],q[1]; -mcx q[18],q[17],q[16],q[15],q[12],q[8],q[0]; -mcx q[18],q[17],q[15],q[13],q[12],q[10],q[8],q[0]; -mcx q[18],q[17],q[15],q[12],q[10],q[8],q[1]; -mcx q[15],q[9],q[8],q[7],q[0]; -mcx q[15],q[9],q[8],q[0]; -mcx q[18],q[16],q[15],q[12],q[11],q[8],q[7],q[0]; -mcx q[18],q[17],q[16],q[15],q[12],q[8],q[7],q[0]; -mcx q[18],q[17],q[16],q[12],q[9],q[8],q[7],q[0]; -mcx q[18],q[17],q[12],q[10],q[9],q[8],q[7],q[0]; -x q[17]; -mcx q[18],q[16],q[12],q[11],q[9],q[8],q[7],q[0]; -x q[11]; -ccx q[14],q[8],q[2]; -x q[15]; -mcx q[17],q[15],q[11],q[10],q[2]; -mcx q[17],q[15],q[11],q[10],q[7],q[0]; -mcx q[17],q[16],q[15],q[14],q[11],q[7],q[0]; -x q[7]; -mcx q[17],q[15],q[11],q[10],q[8],q[7],q[0]; -mcx q[17],q[15],q[14],q[11],q[10],q[0]; -mcx q[17],q[15],q[14],q[13],q[11],q[10],q[0]; -mcx q[17],q[16],q[15],q[11],q[2]; -x q[14]; -mcx q[17],q[15],q[14],q[11],q[10],q[1]; -mcx q[17],q[16],q[15],q[14],q[11],q[1]; -mcx q[17],q[16],q[15],q[11],q[8],q[7],q[0]; -mcx q[17],q[16],q[15],q[13],q[11],q[8],q[0]; -x q[16]; -mcx q[17],q[15],q[13],q[11],q[10],q[8],q[0]; -x q[10]; -mcx q[16],q[15],q[10],q[8],q[1]; -x q[7]; -mcx q[16],q[15],q[14],q[10],q[7],q[0]; -mcx q[17],q[15],q[14],q[11],q[10],q[7],q[0]; -mcx q[17],q[15],q[14],q[11],q[7],q[0]; -x q[13]; -mcx q[16],q[15],q[10],q[8],q[7],q[0]; -mcx q[16],q[15],q[10],q[7],q[0]; -mcx q[16],q[15],q[13],q[10],q[8],q[0]; -x q[16]; -mcx q[17],q[16],q[15],q[14],q[13],q[11],q[0]; -mcx q[17],q[16],q[15],q[13],q[11],q[0]; -x q[16]; -x q[13]; -x q[11]; -mcx q[18],q[16],q[15],q[12],q[11],q[2]; -mcx q[18],q[16],q[15],q[12],q[11],q[1]; -mcx q[18],q[15],q[14],q[13],q[12],q[11],q[10],q[0]; -mcx q[18],q[16],q[15],q[14],q[13],q[12],q[11],q[0]; -mcx q[18],q[15],q[12],q[11],q[10],q[8],q[1]; -mcx q[18],q[15],q[12],q[11],q[8],q[1]; -x q[16]; -mcx q[18],q[16],q[15],q[14],q[12],q[11],q[1]; -mcx q[18],q[16],q[15],q[14],q[12],q[11],q[0]; -mcx q[18],q[16],q[15],q[14],q[12],q[11],q[7],q[0]; -mcx q[18],q[16],q[15],q[12],q[11],q[7],q[0]; -x q[11]; -x q[17]; -mcx q[18],q[17],q[16],q[15],q[14],q[12],q[1]; -mcx q[18],q[17],q[16],q[15],q[13],q[12],q[8],q[0]; -mcx q[18],q[17],q[16],q[15],q[14],q[12],q[7],q[0]; -x q[7]; -mcx q[18],q[17],q[16],q[15],q[12],q[7],q[0]; -x q[17]; -x q[9]; -mcx q[17],q[16],q[11],q[9],q[2]; -mcx q[17],q[16],q[11],q[9],q[8],q[7],q[0]; -mcx q[17],q[16],q[11],q[9],q[7],q[0]; -mcx q[17],q[16],q[14],q[11],q[9],q[7],q[0]; -mcx q[17],q[16],q[14],q[11],q[9],q[1]; -mcx q[17],q[16],q[13],q[11],q[9],q[8],q[0]; -x q[16]; -mcx q[16],q[13],q[10],q[9],q[8],q[0]; -mcx q[16],q[10],q[9],q[8],q[1]; -mcx q[16],q[10],q[9],q[8],q[0]; -x q[8]; -ccx q[15],q[9],q[3]; -x q[7]; -mcx q[16],q[10],q[9],q[8],q[7],q[0]; -mcx q[16],q[14],q[10],q[9],q[7],q[0]; -x q[10]; -mcx q[17],q[11],q[10],q[9],q[2]; -mcx q[17],q[14],q[11],q[10],q[9],q[1]; -mcx q[17],q[14],q[11],q[10],q[9],q[0]; -mcx q[17],q[11],q[10],q[9],q[8],q[7],q[0]; -mcx q[17],q[14],q[11],q[10],q[9],q[7],q[0]; -mcx q[17],q[11],q[10],q[9],q[8],q[0]; -x q[8]; -mcx q[17],q[13],q[11],q[10],q[9],q[8],q[0]; -x q[14]; -mcx q[17],q[16],q[14],q[13],q[11],q[9],q[0]; -mcx q[17],q[14],q[13],q[11],q[10],q[9],q[0]; -mcx q[17],q[14],q[13],q[11],q[9],q[0]; -x q[14]; -x q[11]; -x q[16]; -mcx q[18],q[16],q[14],q[12],q[11],q[9],q[1]; -mcx q[18],q[16],q[14],q[12],q[11],q[9],q[0]; -mcx q[18],q[16],q[14],q[13],q[12],q[11],q[9],q[0]; -mcx q[18],q[14],q[13],q[12],q[11],q[10],q[9],q[0]; -mcx q[18],q[12],q[11],q[10],q[9],q[8],q[1]; -x q[17]; -mcx q[18],q[17],q[16],q[14],q[12],q[9],q[1]; -mcx q[18],q[17],q[16],q[13],q[12],q[9],q[8],q[0]; -x q[14]; -mcx q[18],q[16],q[14],q[12],q[11],q[9],q[7],q[0]; -mcx q[18],q[17],q[16],q[14],q[12],q[9],q[7],q[0]; -x q[12]; -h q[12]; -h q[6]; -cx q[6], q[12]; -h q[12]; -h q[6]; -ccx q[18],q[12],q[5]; -ccx q[18],q[12],q[4]; -ccx q[18],q[12],q[3]; -ccx q[18],q[12],q[2]; -ccx q[18],q[12],q[1]; -x q[18]; -cx q[18], q[12]; -cx q[12], q[6]; -cx q[18], q[12]; -cx q[12], q[6]; -h q[18]; -h q[5]; -cx q[5], q[18]; -h q[18]; -h q[5]; -x q[16]; -ccx q[16], q[18], q[4]; -x q[16]; -ccx q[16], q[18], q[4]; -h q[18]; -h q[3]; -cx q[3], q[18]; -h q[18]; -h q[3]; -cx q[18], q[10]; -cx q[10], q[2]; -cx q[18], q[10]; -cx q[10], q[2]; -h q[18]; -h q[1]; -cx q[1], q[18]; -h q[18]; -h q[1]; diff --git a/test/circuits/bv_1.qasm b/test/circuits/bv_1.qasm deleted file mode 100644 index 1867a792c..000000000 --- a/test/circuits/bv_1.qasm +++ /dev/null @@ -1,33 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[10]; -creg c[10]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; -x q[9]; -h q[9]; -cx q[0], q[9]; -cx q[1], q[9]; -cx q[2], q[9]; -cx q[3], q[9]; -cx q[4], q[9]; -cx q[5], q[9]; -cx q[6], q[9]; -cx q[7], q[9]; -cx q[8], q[9]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; diff --git a/test/circuits/bv_2.qasm b/test/circuits/bv_2.qasm deleted file mode 100644 index a16ae96e3..000000000 --- a/test/circuits/bv_2.qasm +++ /dev/null @@ -1,66 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[10]; -creg c[10]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; -x q[9]; -h q[9]; -h q[0]; -h q[9]; -cx q[9], q[0]; -h q[0]; -h q[9]; -cx q[1], q[7]; -cx q[7], q[9]; -cx q[1], q[7]; -cx q[7], q[9]; -x q[6]; -ccx q[6], q[2], q[9]; -x q[6]; -ccx q[6], q[2], q[9]; -h q[3]; -h q[9]; -cx q[9], q[3]; -h q[3]; -h q[9]; -h q[4]; -h q[9]; -cx q[9], q[4]; -h q[4]; -h q[9]; -x q[1]; -ccx q[1], q[5], q[9]; -x q[1]; -ccx q[1], q[5], q[9]; -h q[6]; -h q[9]; -cx q[9], q[6]; -h q[6]; -h q[9]; -h q[7]; -h q[9]; -cx q[9], q[7]; -h q[7]; -h q[9]; -h q[8]; -h q[9]; -cx q[9], q[8]; -h q[8]; -h q[9]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; diff --git a/test/circuits/entanglement_1.qasm b/test/circuits/entanglement_1.qasm deleted file mode 100644 index 8063a66d3..000000000 --- a/test/circuits/entanglement_1.qasm +++ /dev/null @@ -1,14 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[10]; -creg c[10]; -h q[0]; -cx q[0], q[1]; -cx q[0], q[2]; -cx q[0], q[3]; -cx q[0], q[4]; -cx q[0], q[5]; -cx q[0], q[6]; -cx q[0], q[7]; -cx q[0], q[8]; -cx q[0], q[9]; diff --git a/test/circuits/entanglement_2.qasm b/test/circuits/entanglement_2.qasm deleted file mode 100644 index 3da96b7bb..000000000 --- a/test/circuits/entanglement_2.qasm +++ /dev/null @@ -1,46 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[10]; -creg c[10]; -h q[0]; -x q[2]; -ccx q[2], q[0], q[1]; -x q[2]; -ccx q[2], q[0], q[1]; -h q[0]; -h q[2]; -cx q[2], q[0]; -h q[0]; -h q[2]; -h q[0]; -h q[3]; -cx q[3], q[0]; -h q[0]; -h q[3]; -h q[0]; -h q[4]; -cx q[4], q[0]; -h q[0]; -h q[4]; -h q[0]; -h q[5]; -cx q[5], q[0]; -h q[0]; -h q[5]; -x q[5]; -ccx q[5], q[0], q[6]; -x q[5]; -ccx q[5], q[0], q[6]; -h q[0]; -h q[7]; -cx q[7], q[0]; -h q[0]; -h q[7]; -cx q[0], q[9]; -cx q[9], q[8]; -cx q[0], q[9]; -cx q[9], q[8]; -cx q[0], q[6]; -cx q[6], q[9]; -cx q[0], q[6]; -cx q[6], q[9]; diff --git a/test/circuits/grover-noancilla_indep_qiskit_3.qasm b/test/circuits/grover-noancilla_indep_qiskit_3.qasm deleted file mode 100644 index e818fecf8..000000000 --- a/test/circuits/grover-noancilla_indep_qiskit_3.qasm +++ /dev/null @@ -1,18 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[2]; -qreg flag[1]; -creg meas[3]; -h q[0]; -h q[1]; -x flag[0]; -cp(pi/2) q[1],flag[0]; -cx q[1],q[0]; -cp(-pi/2) q[0],flag[0]; -cx q[1],q[0]; -cp(pi/2) q[0],flag[0]; -u2(0,0) q[0]; -u1(-pi) q[1]; -cx q[0],q[1]; -u2(-pi,-pi) q[0]; -u1(-pi) q[1]; diff --git a/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm b/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm deleted file mode 100644 index 269a58edf..000000000 --- a/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm +++ /dev/null @@ -1,58 +0,0 @@ -// Benchmark was created by MQT Bench on 2023-06-29 -// For more information about MQT Bench, please visit https://www.cda.cit.tum.de/mqtbench/ -// MQT Bench version: v1.0.0 -// Qiskit version: {'qiskit-terra': '0.24.1', 'qiskit-aer': '0.12.0', 'qiskit-ignis': None, 'qiskit-ibmq-provider': '0.20.2', 'qiskit': '0.43.1', 'qiskit-nature': '0.6.2', 'qiskit-finance': '0.3.4', 'qiskit-optimization': '0.5.0', 'qiskit-machine-learning': '0.6.1'} -// Used Gate Set: ['rz', 'sx', 'x', 'cx', 'measure'] - -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[2]; -qreg flag[1]; -creg meas[3]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -rz(pi/4) q[1]; -x flag[0]; -cx q[1],flag[0]; -rz(-pi/4) flag[0]; -cx q[1],flag[0]; -rz(pi/4) flag[0]; -cx q[1],q[0]; -rz(-pi/4) q[0]; -cx q[0],flag[0]; -rz(pi/4) flag[0]; -cx q[0],flag[0]; -rz(-pi/4) flag[0]; -cx q[1],q[0]; -rz(pi/4) q[0]; -cx q[0],flag[0]; -rz(-pi/4) flag[0]; -cx q[0],flag[0]; -rz(pi/4) flag[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -x q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -x q[1]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -cx q[0],q[1]; -x q[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -x q[1]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; diff --git a/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm b/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm deleted file mode 100644 index c97c98fe8..000000000 --- a/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm +++ /dev/null @@ -1,3762 +0,0 @@ -// Benchmark was created by MQT Bench on 2023-06-29 -// For more information about MQT Bench, please visit https://www.cda.cit.tum.de/mqtbench/ -// MQT Bench version: v1.0.0 -// Qiskit version: {'qiskit-terra': '0.24.1', 'qiskit-aer': '0.12.0', 'qiskit-ignis': None, 'qiskit-ibmq-provider': '0.20.2', 'qiskit': '0.43.1', 'qiskit-nature': '0.6.2', 'qiskit-finance': '0.3.4', 'qiskit-optimization': '0.5.0', 'qiskit-machine-learning': '0.6.1'} -// Used Gate Set: ['rz', 'sx', 'x', 'cx', 'measure'] - -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[6]; -qreg flag[1]; -creg meas[7]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/64) q[5]; -x flag[0]; -cx q[5],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],flag[0]; -rz(pi/64) flag[0]; -cx q[5],q[4]; -rz(-pi/64) q[4]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[4]; -rz(pi/64) q[4]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -x q[1]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -x q[2]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -x q[3]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -x q[4]; -rz(pi/32) q[4]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -x q[0]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -x q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[4],q[5]; -rz(-pi/32) q[5]; -cx q[4],q[5]; -cx q[4],q[3]; -rz(-pi/32) q[3]; -rz(pi/32) q[5]; -cx q[3],q[5]; -rz(pi/32) q[5]; -cx q[3],q[5]; -cx q[4],q[3]; -rz(pi/32) q[3]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -x q[1]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -x q[2]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -x q[3]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -x q[4]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -x q[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(pi/32) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -x q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/64) q[5]; -cx q[5],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],flag[0]; -rz(pi/64) flag[0]; -cx q[5],q[4]; -rz(-pi/64) q[4]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[4]; -rz(pi/64) q[4]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -x q[1]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -x q[2]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -x q[3]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -x q[4]; -rz(pi/32) q[4]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -x q[0]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -x q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[4],q[5]; -rz(-pi/32) q[5]; -cx q[4],q[5]; -cx q[4],q[3]; -rz(-pi/32) q[3]; -rz(pi/32) q[5]; -cx q[3],q[5]; -rz(pi/32) q[5]; -cx q[3],q[5]; -cx q[4],q[3]; -rz(pi/32) q[3]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -x q[1]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -x q[2]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -x q[3]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -x q[4]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -x q[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(pi/32) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -x q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/64) q[5]; -cx q[5],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],flag[0]; -rz(pi/64) flag[0]; -cx q[5],q[4]; -rz(-pi/64) q[4]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[4]; -rz(pi/64) q[4]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -x q[1]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -x q[2]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -x q[3]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -x q[4]; -rz(pi/32) q[4]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -x q[0]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -x q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[4],q[5]; -rz(-pi/32) q[5]; -cx q[4],q[5]; -cx q[4],q[3]; -rz(-pi/32) q[3]; -rz(pi/32) q[5]; -cx q[3],q[5]; -rz(pi/32) q[5]; -cx q[3],q[5]; -cx q[4],q[3]; -rz(pi/32) q[3]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -x q[1]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -x q[2]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -x q[3]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -x q[4]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -x q[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(pi/32) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -x q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/64) q[5]; -cx q[5],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],flag[0]; -rz(pi/64) flag[0]; -cx q[5],q[4]; -rz(-pi/64) q[4]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[4]; -rz(pi/64) q[4]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -x q[1]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -x q[2]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -x q[3]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -x q[4]; -rz(pi/32) q[4]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -x q[0]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -x q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[4],q[5]; -rz(-pi/32) q[5]; -cx q[4],q[5]; -cx q[4],q[3]; -rz(-pi/32) q[3]; -rz(pi/32) q[5]; -cx q[3],q[5]; -rz(pi/32) q[5]; -cx q[3],q[5]; -cx q[4],q[3]; -rz(pi/32) q[3]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -x q[1]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -x q[2]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -x q[3]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -x q[4]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -x q[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(pi/32) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -x q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/64) q[5]; -cx q[5],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],flag[0]; -rz(pi/64) flag[0]; -cx q[5],q[4]; -rz(-pi/64) q[4]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[4]; -rz(pi/64) q[4]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -x q[1]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -x q[2]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -x q[3]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -x q[4]; -rz(pi/32) q[4]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -x q[0]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -x q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[4],q[5]; -rz(-pi/32) q[5]; -cx q[4],q[5]; -cx q[4],q[3]; -rz(-pi/32) q[3]; -rz(pi/32) q[5]; -cx q[3],q[5]; -rz(pi/32) q[5]; -cx q[3],q[5]; -cx q[4],q[3]; -rz(pi/32) q[3]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -x q[1]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -x q[2]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -x q[3]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -x q[4]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -x q[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(pi/32) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -x q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/64) q[5]; -cx q[5],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],flag[0]; -rz(pi/64) flag[0]; -cx q[5],q[4]; -rz(-pi/64) q[4]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[4]; -rz(pi/64) q[4]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -x q[1]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -x q[2]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -x q[3]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -x q[4]; -rz(pi/32) q[4]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -x q[0]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -x q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[4],q[5]; -rz(-pi/32) q[5]; -cx q[4],q[5]; -cx q[4],q[3]; -rz(-pi/32) q[3]; -rz(pi/32) q[5]; -cx q[3],q[5]; -rz(pi/32) q[5]; -cx q[3],q[5]; -cx q[4],q[3]; -rz(pi/32) q[3]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -x q[1]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -x q[2]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -x q[3]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -x q[4]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -x q[0]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(pi/32) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -x q[5]; -rz(pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; diff --git a/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm b/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm deleted file mode 100644 index 82bd2e2e8..000000000 --- a/test/circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm +++ /dev/null @@ -1,3600 +0,0 @@ -// Benchmark was created by MQT Bench on 2023-06-29 -// For more information about MQT Bench, please visit https://www.cda.cit.tum.de/mqtbench/ -// MQT Bench version: v1.0.0 -// Qiskit version: {'qiskit-terra': '0.24.1', 'qiskit-aer': '0.12.0', 'qiskit-ignis': None, 'qiskit-ibmq-provider': '0.20.2', 'qiskit': '0.43.1', 'qiskit-nature': '0.6.2', 'qiskit-finance': '0.3.4', 'qiskit-optimization': '0.5.0', 'qiskit-machine-learning': '0.6.1'} -// Used Gate Set: ['rz', 'sx', 'x', 'cx', 'measure'] - -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[6]; -qreg flag[1]; -creg meas[7]; -rz(pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -rz(pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -rz(pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -rz(pi/2) q[4]; -sx q[4]; -rz(pi/2) q[4]; -rz(pi/2) q[5]; -sx q[5]; -rz(1.619883712007237) q[5]; -x flag[0]; -cx q[5],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],flag[0]; -rz(pi/64) flag[0]; -cx q[5],q[4]; -rz(-pi/64) q[4]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[4]; -rz(pi/64) q[4]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[4]; -sx q[4]; -rz(1.6689710972195773) q[4]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -rz(-pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(-pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[4],q[5]; -rz(-pi/32) q[5]; -cx q[4],q[5]; -cx q[4],q[3]; -rz(-pi/32) q[3]; -rz(pi/32) q[5]; -cx q[3],q[5]; -rz(pi/32) q[5]; -cx q[3],q[5]; -cx q[4],q[3]; -rz(pi/32) q[3]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(-pi/2) q[1]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[2]; -sx q[2]; -rz(-pi/2) q[2]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[3]; -sx q[3]; -rz(-pi/2) q[3]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(pi/2) q[4]; -sx q[4]; -rz(-pi/2) q[4]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(pi/2) q[0]; -sx q[0]; -rz(-pi/2) q[0]; -rz(1.6689710972195773) q[5]; -sx q[5]; -rz(-1.5217089415825567) q[5]; -cx q[5],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],flag[0]; -rz(pi/64) flag[0]; -cx q[5],q[4]; -rz(-pi/64) q[4]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[4]; -rz(pi/64) q[4]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[4]; -sx q[4]; -rz(1.6689710972195773) q[4]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -rz(-pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(-pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[4],q[5]; -rz(-pi/32) q[5]; -cx q[4],q[5]; -cx q[4],q[3]; -rz(-pi/32) q[3]; -rz(pi/32) q[5]; -cx q[3],q[5]; -rz(pi/32) q[5]; -cx q[3],q[5]; -cx q[4],q[3]; -rz(pi/32) q[3]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(-pi/2) q[1]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[2]; -sx q[2]; -rz(-pi/2) q[2]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[3]; -sx q[3]; -rz(-pi/2) q[3]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(pi/2) q[4]; -sx q[4]; -rz(-pi/2) q[4]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(pi/2) q[0]; -sx q[0]; -rz(-pi/2) q[0]; -rz(1.6689710972195773) q[5]; -sx q[5]; -rz(-1.5217089415825567) q[5]; -cx q[5],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],flag[0]; -rz(pi/64) flag[0]; -cx q[5],q[4]; -rz(-pi/64) q[4]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[4]; -rz(pi/64) q[4]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[4]; -sx q[4]; -rz(1.6689710972195773) q[4]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -rz(-pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(-pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[4],q[5]; -rz(-pi/32) q[5]; -cx q[4],q[5]; -cx q[4],q[3]; -rz(-pi/32) q[3]; -rz(pi/32) q[5]; -cx q[3],q[5]; -rz(pi/32) q[5]; -cx q[3],q[5]; -cx q[4],q[3]; -rz(pi/32) q[3]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(-pi/2) q[1]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[2]; -sx q[2]; -rz(-pi/2) q[2]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[3]; -sx q[3]; -rz(-pi/2) q[3]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(pi/2) q[4]; -sx q[4]; -rz(-pi/2) q[4]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(pi/2) q[0]; -sx q[0]; -rz(-pi/2) q[0]; -rz(1.6689710972195773) q[5]; -sx q[5]; -rz(-1.5217089415825567) q[5]; -cx q[5],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],flag[0]; -rz(pi/64) flag[0]; -cx q[5],q[4]; -rz(-pi/64) q[4]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[4]; -rz(pi/64) q[4]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[4]; -sx q[4]; -rz(1.6689710972195773) q[4]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -rz(-pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(-pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[4],q[5]; -rz(-pi/32) q[5]; -cx q[4],q[5]; -cx q[4],q[3]; -rz(-pi/32) q[3]; -rz(pi/32) q[5]; -cx q[3],q[5]; -rz(pi/32) q[5]; -cx q[3],q[5]; -cx q[4],q[3]; -rz(pi/32) q[3]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(-pi/2) q[1]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[2]; -sx q[2]; -rz(-pi/2) q[2]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[3]; -sx q[3]; -rz(-pi/2) q[3]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(pi/2) q[4]; -sx q[4]; -rz(-pi/2) q[4]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(pi/2) q[0]; -sx q[0]; -rz(-pi/2) q[0]; -rz(1.6689710972195773) q[5]; -sx q[5]; -rz(-1.5217089415825567) q[5]; -cx q[5],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],flag[0]; -rz(pi/64) flag[0]; -cx q[5],q[4]; -rz(-pi/64) q[4]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[4]; -rz(pi/64) q[4]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[4]; -sx q[4]; -rz(1.6689710972195773) q[4]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -rz(-pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(-pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[4],q[5]; -rz(-pi/32) q[5]; -cx q[4],q[5]; -cx q[4],q[3]; -rz(-pi/32) q[3]; -rz(pi/32) q[5]; -cx q[3],q[5]; -rz(pi/32) q[5]; -cx q[3],q[5]; -cx q[4],q[3]; -rz(pi/32) q[3]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(-pi/2) q[1]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[2]; -sx q[2]; -rz(-pi/2) q[2]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[3]; -sx q[3]; -rz(-pi/2) q[3]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(pi/2) q[4]; -sx q[4]; -rz(-pi/2) q[4]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(pi/2) q[0]; -sx q[0]; -rz(-pi/2) q[0]; -rz(1.6689710972195773) q[5]; -sx q[5]; -rz(-1.5217089415825567) q[5]; -cx q[5],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],flag[0]; -rz(pi/64) flag[0]; -cx q[5],q[4]; -rz(-pi/64) q[4]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[4]; -rz(pi/64) q[4]; -cx q[4],flag[0]; -rz(-pi/64) flag[0]; -cx q[4],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[3]; -rz(-pi/64) q[3]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[3]; -rz(pi/64) q[3]; -cx q[3],flag[0]; -rz(-pi/64) flag[0]; -cx q[3],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[2]; -rz(-pi/64) q[2]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[2]; -rz(pi/64) q[2]; -cx q[2],flag[0]; -rz(-pi/64) flag[0]; -cx q[2],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[1]; -rz(-pi/64) q[1]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[1]; -rz(pi/64) q[1]; -cx q[1],flag[0]; -rz(-pi/64) flag[0]; -cx q[1],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[1],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[1]; -sx q[1]; -rz(pi/2) q[1]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[2],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[2]; -sx q[2]; -rz(pi/2) q[2]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[3],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[3]; -sx q[3]; -rz(pi/2) q[3]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[4],q[0]; -rz(-pi/64) q[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -rz(-pi/2) q[4]; -sx q[4]; -rz(1.6689710972195773) q[4]; -cx q[5],q[0]; -rz(pi/64) q[0]; -cx q[0],flag[0]; -rz(-pi/64) flag[0]; -cx q[0],flag[0]; -rz(pi/64) flag[0]; -rz(-pi/2) q[0]; -sx q[0]; -rz(pi/2) q[0]; -rz(-pi/2) q[5]; -sx q[5]; -rz(pi/2) q[5]; -cx q[4],q[5]; -rz(-pi/32) q[5]; -cx q[4],q[5]; -cx q[4],q[3]; -rz(-pi/32) q[3]; -rz(pi/32) q[5]; -cx q[3],q[5]; -rz(pi/32) q[5]; -cx q[3],q[5]; -cx q[4],q[3]; -rz(pi/32) q[3]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -rz(-pi/32) q[5]; -cx q[3],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[3],q[2]; -rz(-pi/32) q[2]; -rz(pi/32) q[5]; -cx q[2],q[5]; -rz(pi/32) q[5]; -cx q[2],q[5]; -cx q[4],q[2]; -rz(pi/32) q[2]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -rz(-pi/32) q[5]; -cx q[2],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[2],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[3],q[1]; -rz(-pi/32) q[1]; -rz(pi/32) q[5]; -cx q[1],q[5]; -rz(pi/32) q[5]; -cx q[1],q[5]; -cx q[4],q[1]; -rz(pi/32) q[1]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -rz(-pi/32) q[5]; -cx q[1],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[1],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[1]; -sx q[1]; -rz(-pi/2) q[1]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[2],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[2]; -sx q[2]; -rz(-pi/2) q[2]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -cx q[3],q[0]; -rz(-pi/32) q[0]; -rz(pi/2) q[3]; -sx q[3]; -rz(-pi/2) q[3]; -rz(pi/32) q[5]; -cx q[0],q[5]; -rz(pi/32) q[5]; -cx q[0],q[5]; -cx q[4],q[0]; -rz(pi/32) q[0]; -rz(pi/2) q[4]; -sx q[4]; -rz(-pi/2) q[4]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(-pi/32) q[5]; -cx q[0],q[5]; -rz(pi/2) q[0]; -sx q[0]; -rz(-pi/2) q[0]; -rz(1.6689710972195773) q[5]; -sx q[5]; -rz(-pi/2) q[5]; diff --git a/test/circuits/period_finding_1.qasm b/test/circuits/period_finding_1.qasm deleted file mode 100644 index c8e1902d7..000000000 --- a/test/circuits/period_finding_1.qasm +++ /dev/null @@ -1,398 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[8]; -h q[0]; -h q[1]; -h q[2]; -x q[7]; -mcx q[0], q[7]; -mcx q[0], q[7], q[4]; -mcx q[0], q[7]; -mcx q[0], q[4]; -mcx q[0], q[4], q[7]; -mcx q[0], q[4]; -mcx q[0], q[5]; -mcx q[0], q[4], q[5]; -mcx q[0], q[4], q[6]; -mcx q[0], q[5], q[7], q[4]; -mcx q[0], q[5], q[6]; -mcx q[0], q[6], q[5]; -mcx q[0], q[4]; -mcx q[0], q[5]; -mcx q[0], q[4], q[5], q[7]; -mcx q[0], q[4]; -mcx q[0], q[5]; -mcx q[0], q[7], q[5]; -mcx q[0], q[4], q[5]; -mcx q[0], q[4], q[6]; -mcx q[0], q[4]; -mcx q[0], q[4], q[5]; -mcx q[0], q[6], q[7], q[4]; -mcx q[0], q[4], q[7], q[6]; -mcx q[0], q[4], q[5]; -mcx q[0], q[5], q[4]; -mcx q[0], q[6]; -mcx q[0], q[6]; -mcx q[0], q[4], q[7], q[6]; -mcx q[0], q[4], q[5]; -mcx q[0], q[4], q[6]; -mcx q[0], q[5], q[6], q[4]; -mcx q[0], q[5], q[6]; -mcx q[0], q[7], q[4], q[5]; -mcx q[0], q[5], q[6]; -mcx q[0], q[7]; -mcx q[0], q[6], q[7], q[4], q[5]; -mcx q[0], q[7]; -mcx q[0], q[6]; -mcx q[0], q[4], q[7]; -mcx q[0], q[4]; -mcx q[0], q[4]; -mcx q[0], q[5]; -mcx q[0], q[4], q[5], q[6]; -mcx q[0], q[4]; -mcx q[0], q[5]; -mcx q[0], q[6], q[4]; -mcx q[0], q[5]; -mcx q[0], q[4], q[5]; -mcx q[0], q[5], q[4]; -mcx q[0], q[5]; -mcx q[0], q[4], q[6]; -mcx q[0], q[4]; -mcx q[0], q[4], q[5]; -mcx q[1], q[7]; -mcx q[1], q[7], q[4]; -mcx q[1], q[7]; -mcx q[1], q[4]; -mcx q[1], q[4], q[7]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[5], q[7], q[4]; -mcx q[1], q[5], q[6]; -mcx q[1], q[6], q[5]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5], q[7]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[7], q[5]; -mcx q[1], q[4], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[4]; -mcx q[1], q[4], q[5]; -mcx q[1], q[6], q[7], q[4]; -mcx q[1], q[4], q[7], q[6]; -mcx q[1], q[4], q[5]; -mcx q[1], q[5], q[4]; -mcx q[1], q[6]; -mcx q[1], q[6]; -mcx q[1], q[4], q[7], q[6]; -mcx q[1], q[4], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[5], q[6], q[4]; -mcx q[1], q[5], q[6]; -mcx q[1], q[7], q[4], q[5]; -mcx q[1], q[5], q[6]; -mcx q[1], q[7]; -mcx q[1], q[6], q[7], q[4], q[5]; -mcx q[1], q[7]; -mcx q[1], q[6]; -mcx q[1], q[4], q[7]; -mcx q[1], q[4]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5], q[6]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[6], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5]; -mcx q[1], q[5], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[4]; -mcx q[1], q[4], q[5]; -mcx q[1], q[7]; -mcx q[1], q[7], q[4]; -mcx q[1], q[7]; -mcx q[1], q[4]; -mcx q[1], q[4], q[7]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[5], q[7], q[4]; -mcx q[1], q[5], q[6]; -mcx q[1], q[6], q[5]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5], q[7]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[7], q[5]; -mcx q[1], q[4], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[4]; -mcx q[1], q[4], q[5]; -mcx q[1], q[6], q[7], q[4]; -mcx q[1], q[4], q[7], q[6]; -mcx q[1], q[4], q[5]; -mcx q[1], q[5], q[4]; -mcx q[1], q[6]; -mcx q[1], q[6]; -mcx q[1], q[4], q[7], q[6]; -mcx q[1], q[4], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[5], q[6], q[4]; -mcx q[1], q[5], q[6]; -mcx q[1], q[7], q[4], q[5]; -mcx q[1], q[5], q[6]; -mcx q[1], q[7]; -mcx q[1], q[6], q[7], q[4], q[5]; -mcx q[1], q[7]; -mcx q[1], q[6]; -mcx q[1], q[4], q[7]; -mcx q[1], q[4]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5], q[6]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[6], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5]; -mcx q[1], q[5], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[4]; -mcx q[1], q[4], q[5]; -mcx q[2], q[7]; -mcx q[2], q[7], q[4]; -mcx q[2], q[7]; -mcx q[2], q[4]; -mcx q[2], q[4], q[7]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[7], q[4]; -mcx q[2], q[5], q[6]; -mcx q[2], q[6], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[7]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[7], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[6], q[7], q[4]; -mcx q[2], q[4], q[7], q[6]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[6]; -mcx q[2], q[6]; -mcx q[2], q[4], q[7], q[6]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[6], q[4]; -mcx q[2], q[5], q[6]; -mcx q[2], q[7], q[4], q[5]; -mcx q[2], q[5], q[6]; -mcx q[2], q[7]; -mcx q[2], q[6], q[7], q[4], q[5]; -mcx q[2], q[7]; -mcx q[2], q[6]; -mcx q[2], q[4], q[7]; -mcx q[2], q[4]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[6]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[6], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[7]; -mcx q[2], q[7], q[4]; -mcx q[2], q[7]; -mcx q[2], q[4]; -mcx q[2], q[4], q[7]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[7], q[4]; -mcx q[2], q[5], q[6]; -mcx q[2], q[6], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[7]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[7], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[6], q[7], q[4]; -mcx q[2], q[4], q[7], q[6]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[6]; -mcx q[2], q[6]; -mcx q[2], q[4], q[7], q[6]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[6], q[4]; -mcx q[2], q[5], q[6]; -mcx q[2], q[7], q[4], q[5]; -mcx q[2], q[5], q[6]; -mcx q[2], q[7]; -mcx q[2], q[6], q[7], q[4], q[5]; -mcx q[2], q[7]; -mcx q[2], q[6]; -mcx q[2], q[4], q[7]; -mcx q[2], q[4]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[6]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[6], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[7]; -mcx q[2], q[7], q[4]; -mcx q[2], q[7]; -mcx q[2], q[4]; -mcx q[2], q[4], q[7]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[7], q[4]; -mcx q[2], q[5], q[6]; -mcx q[2], q[6], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[7]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[7], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[6], q[7], q[4]; -mcx q[2], q[4], q[7], q[6]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[6]; -mcx q[2], q[6]; -mcx q[2], q[4], q[7], q[6]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[6], q[4]; -mcx q[2], q[5], q[6]; -mcx q[2], q[7], q[4], q[5]; -mcx q[2], q[5], q[6]; -mcx q[2], q[7]; -mcx q[2], q[6], q[7], q[4], q[5]; -mcx q[2], q[7]; -mcx q[2], q[6]; -mcx q[2], q[4], q[7]; -mcx q[2], q[4]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[6]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[6], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[7]; -mcx q[2], q[7], q[4]; -mcx q[2], q[7]; -mcx q[2], q[4]; -mcx q[2], q[4], q[7]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[7], q[4]; -mcx q[2], q[5], q[6]; -mcx q[2], q[6], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[7]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[7], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[6], q[7], q[4]; -mcx q[2], q[4], q[7], q[6]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[6]; -mcx q[2], q[6]; -mcx q[2], q[4], q[7], q[6]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[6], q[4]; -mcx q[2], q[5], q[6]; -mcx q[2], q[7], q[4], q[5]; -mcx q[2], q[5], q[6]; -mcx q[2], q[7]; -mcx q[2], q[6], q[7], q[4], q[5]; -mcx q[2], q[7]; -mcx q[2], q[6]; -mcx q[2], q[4], q[7]; -mcx q[2], q[4]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[6]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[6], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -h q[2]; -cswap q[0], q[2], q[3]; -t q[3]; -cswap q[0], q[2], q[3]; -cswap q[1], q[2], q[3]; -s q[3]; -cswap q[1], q[2], q[3]; -h q[1]; -cswap q[0], q[1], q[3]; -s q[3]; -cswap q[0], q[1], q[3]; -h q[0]; -swap q[0], q[2]; diff --git a/test/circuits/period_finding_2.qasm b/test/circuits/period_finding_2.qasm deleted file mode 100644 index df934fd3a..000000000 --- a/test/circuits/period_finding_2.qasm +++ /dev/null @@ -1,440 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[8]; -h q[0]; -h q[1]; -h q[2]; -x q[7]; -mcx q[0], q[5]; -mcx q[0], q[5], q[7]; -mcx q[0], q[5]; -mcx q[0], q[4]; -mcx q[0], q[5]; -mcx q[0], q[4], q[5], q[7]; -mcx q[0], q[4]; -mcx q[0], q[5]; -mcx q[0], q[7], q[5]; -mcx q[0], q[5], q[6]; -mcx q[0], q[5]; -mcx q[0], q[4], q[5]; -mcx q[0], q[4], q[6]; -mcx q[0], q[5], q[7], q[4]; -mcx q[0], q[5], q[6]; -mcx q[0], q[6], q[5]; -mcx q[0], q[5]; -mcx q[0], q[5]; -mcx q[0], q[4], q[7], q[5]; -mcx q[0], q[4], q[5]; -mcx q[0], q[4], q[6]; -mcx q[0], q[5], q[4]; -mcx q[0], q[4], q[5]; -mcx q[0], q[5], q[6], q[4]; -mcx q[0], q[7], q[4], q[5]; -mcx q[0], q[6]; -mcx q[0], q[6]; -mcx q[0], q[6]; -mcx q[0], q[7]; -mcx q[0], q[5], q[7], q[4], q[6]; -mcx q[0], q[7]; -mcx q[0], q[5], q[6]; -mcx q[0], q[6], q[5]; -mcx q[0], q[6]; -mcx q[0], q[4], q[7]; -mcx q[0], q[5]; -mcx q[0], q[5], q[4]; -mcx q[0], q[5]; -mcx q[0], q[4]; -mcx q[0], q[4], q[6]; -mcx q[0], q[4]; -mcx q[0], q[4], q[5]; -mcx q[0], q[6], q[4]; -mcx q[0], q[5]; -mcx q[0], q[4]; -mcx q[0], q[5]; -mcx q[0], q[4], q[5], q[6]; -mcx q[0], q[4]; -mcx q[0], q[5]; -mcx q[0], q[6], q[4]; -mcx q[0], q[5]; -mcx q[0], q[4], q[5]; -mcx q[0], q[5], q[4]; -mcx q[0], q[5]; -mcx q[0], q[4], q[6]; -mcx q[0], q[5], q[4]; -mcx q[0], q[4]; -mcx q[0], q[4]; -mcx q[0], q[4], q[5]; -mcx q[0], q[4]; -mcx q[1], q[5]; -mcx q[1], q[5], q[7]; -mcx q[1], q[5]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5], q[7]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[7], q[5]; -mcx q[1], q[5], q[6]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[5], q[7], q[4]; -mcx q[1], q[5], q[6]; -mcx q[1], q[6], q[5]; -mcx q[1], q[5]; -mcx q[1], q[5]; -mcx q[1], q[4], q[7], q[5]; -mcx q[1], q[4], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[5], q[4]; -mcx q[1], q[4], q[5]; -mcx q[1], q[5], q[6], q[4]; -mcx q[1], q[7], q[4], q[5]; -mcx q[1], q[6]; -mcx q[1], q[6]; -mcx q[1], q[6]; -mcx q[1], q[7]; -mcx q[1], q[5], q[7], q[4], q[6]; -mcx q[1], q[7]; -mcx q[1], q[5], q[6]; -mcx q[1], q[6], q[5]; -mcx q[1], q[6]; -mcx q[1], q[4], q[7]; -mcx q[1], q[5]; -mcx q[1], q[5], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4]; -mcx q[1], q[4], q[6]; -mcx q[1], q[4]; -mcx q[1], q[4], q[5]; -mcx q[1], q[6], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5], q[6]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[6], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5]; -mcx q[1], q[5], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[5], q[4]; -mcx q[1], q[4]; -mcx q[1], q[4]; -mcx q[1], q[4], q[5]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[5], q[7]; -mcx q[1], q[5]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5], q[7]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[7], q[5]; -mcx q[1], q[5], q[6]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[5], q[7], q[4]; -mcx q[1], q[5], q[6]; -mcx q[1], q[6], q[5]; -mcx q[1], q[5]; -mcx q[1], q[5]; -mcx q[1], q[4], q[7], q[5]; -mcx q[1], q[4], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[5], q[4]; -mcx q[1], q[4], q[5]; -mcx q[1], q[5], q[6], q[4]; -mcx q[1], q[7], q[4], q[5]; -mcx q[1], q[6]; -mcx q[1], q[6]; -mcx q[1], q[6]; -mcx q[1], q[7]; -mcx q[1], q[5], q[7], q[4], q[6]; -mcx q[1], q[7]; -mcx q[1], q[5], q[6]; -mcx q[1], q[6], q[5]; -mcx q[1], q[6]; -mcx q[1], q[4], q[7]; -mcx q[1], q[5]; -mcx q[1], q[5], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4]; -mcx q[1], q[4], q[6]; -mcx q[1], q[4]; -mcx q[1], q[4], q[5]; -mcx q[1], q[6], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5], q[6]; -mcx q[1], q[4]; -mcx q[1], q[5]; -mcx q[1], q[6], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[5]; -mcx q[1], q[5], q[4]; -mcx q[1], q[5]; -mcx q[1], q[4], q[6]; -mcx q[1], q[5], q[4]; -mcx q[1], q[4]; -mcx q[1], q[4]; -mcx q[1], q[4], q[5]; -mcx q[1], q[4]; -mcx q[2], q[5]; -mcx q[2], q[5], q[7]; -mcx q[2], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[7]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[7], q[5]; -mcx q[2], q[5], q[6]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[7], q[4]; -mcx q[2], q[5], q[6]; -mcx q[2], q[6], q[5]; -mcx q[2], q[5]; -mcx q[2], q[5]; -mcx q[2], q[4], q[7], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[6], q[4]; -mcx q[2], q[7], q[4], q[5]; -mcx q[2], q[6]; -mcx q[2], q[6]; -mcx q[2], q[6]; -mcx q[2], q[7]; -mcx q[2], q[5], q[7], q[4], q[6]; -mcx q[2], q[7]; -mcx q[2], q[5], q[6]; -mcx q[2], q[6], q[5]; -mcx q[2], q[6]; -mcx q[2], q[4], q[7]; -mcx q[2], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4]; -mcx q[2], q[4], q[6]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[6], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[6]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[6], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[4]; -mcx q[2], q[4]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[5], q[7]; -mcx q[2], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[7]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[7], q[5]; -mcx q[2], q[5], q[6]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[7], q[4]; -mcx q[2], q[5], q[6]; -mcx q[2], q[6], q[5]; -mcx q[2], q[5]; -mcx q[2], q[5]; -mcx q[2], q[4], q[7], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[6], q[4]; -mcx q[2], q[7], q[4], q[5]; -mcx q[2], q[6]; -mcx q[2], q[6]; -mcx q[2], q[6]; -mcx q[2], q[7]; -mcx q[2], q[5], q[7], q[4], q[6]; -mcx q[2], q[7]; -mcx q[2], q[5], q[6]; -mcx q[2], q[6], q[5]; -mcx q[2], q[6]; -mcx q[2], q[4], q[7]; -mcx q[2], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4]; -mcx q[2], q[4], q[6]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[6], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[6]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[6], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[4]; -mcx q[2], q[4]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[5], q[7]; -mcx q[2], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[7]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[7], q[5]; -mcx q[2], q[5], q[6]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[7], q[4]; -mcx q[2], q[5], q[6]; -mcx q[2], q[6], q[5]; -mcx q[2], q[5]; -mcx q[2], q[5]; -mcx q[2], q[4], q[7], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[6], q[4]; -mcx q[2], q[7], q[4], q[5]; -mcx q[2], q[6]; -mcx q[2], q[6]; -mcx q[2], q[6]; -mcx q[2], q[7]; -mcx q[2], q[5], q[7], q[4], q[6]; -mcx q[2], q[7]; -mcx q[2], q[5], q[6]; -mcx q[2], q[6], q[5]; -mcx q[2], q[6]; -mcx q[2], q[4], q[7]; -mcx q[2], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4]; -mcx q[2], q[4], q[6]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[6], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[6]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[6], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[4]; -mcx q[2], q[4]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[5], q[7]; -mcx q[2], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[7]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[7], q[5]; -mcx q[2], q[5], q[6]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[7], q[4]; -mcx q[2], q[5], q[6]; -mcx q[2], q[6], q[5]; -mcx q[2], q[5]; -mcx q[2], q[5]; -mcx q[2], q[4], q[7], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[6], q[4]; -mcx q[2], q[7], q[4], q[5]; -mcx q[2], q[6]; -mcx q[2], q[6]; -mcx q[2], q[6]; -mcx q[2], q[7]; -mcx q[2], q[5], q[7], q[4], q[6]; -mcx q[2], q[7]; -mcx q[2], q[5], q[6]; -mcx q[2], q[6], q[5]; -mcx q[2], q[6]; -mcx q[2], q[4], q[7]; -mcx q[2], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4]; -mcx q[2], q[4], q[6]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[6], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5], q[6]; -mcx q[2], q[4]; -mcx q[2], q[5]; -mcx q[2], q[6], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[5]; -mcx q[2], q[5], q[4]; -mcx q[2], q[5]; -mcx q[2], q[4], q[6]; -mcx q[2], q[5], q[4]; -mcx q[2], q[4]; -mcx q[2], q[4]; -mcx q[2], q[4], q[5]; -mcx q[2], q[4]; -h q[2]; -cswap q[0], q[2], q[3]; -t q[3]; -cswap q[0], q[2], q[3]; -cswap q[1], q[2], q[3]; -s q[3]; -cswap q[1], q[2], q[3]; -h q[1]; -cswap q[0], q[1], q[3]; -s q[3]; -cswap q[0], q[1], q[3]; -h q[0]; -swap q[0], q[2]; diff --git a/test/circuits/random_1.qasm b/test/circuits/random_1.qasm deleted file mode 100644 index aea6900dd..000000000 --- a/test/circuits/random_1.qasm +++ /dev/null @@ -1,154 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[10]; -creg c[10]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; -h q[9]; -ccx q[0], q[6], q[7]; -ccx q[0], q[3], q[7]; -cx q[4], q[2]; -h q[8]; -cx q[5], q[1]; -s q[5]; -h q[6]; -s q[9]; -t q[6]; -cx q[4], q[7]; -s q[4]; -t q[2]; -cx q[3], q[7]; -ccx q[6], q[0], q[9]; -h q[3]; -s q[3]; -t q[8]; -t q[3]; -t q[8]; -cx q[6], q[7]; -h q[9]; -t q[8]; -s q[3]; -cx q[3], q[0]; -h q[7]; -t q[9]; -h q[8]; -h q[2]; -cx q[9], q[5]; -ccx q[2], q[1], q[7]; -s q[3]; -t q[6]; -cx q[7], q[3]; -t q[2]; -ccx q[8], q[2], q[1]; -t q[7]; -t q[2]; -s q[2]; -cx q[5], q[6]; -s q[0]; -ccx q[0], q[5], q[3]; -h q[4]; -cx q[6], q[9]; -s q[6]; -cx q[3], q[8]; -t q[8]; -cx q[9], q[7]; -h q[2]; -cx q[7], q[6]; -s q[6]; -ccx q[9], q[5], q[8]; -cx q[7], q[2]; -ccx q[7], q[1], q[6]; -h q[0]; -cx q[8], q[1]; -h q[5]; -h q[2]; -h q[9]; -cx q[7], q[2]; -cx q[6], q[8]; -cx q[5], q[4]; -cx q[6], q[5]; -ccx q[8], q[2], q[3]; -t q[9]; -h q[3]; -ccx q[9], q[7], q[0]; -h q[4]; -cx q[3], q[4]; -h q[0]; -ccx q[8], q[1], q[4]; -s q[7]; -s q[5]; -ccx q[6], q[3], q[5]; -s q[1]; -ccx q[3], q[6], q[1]; -t q[7]; -ccx q[6], q[7], q[8]; -s q[4]; -ccx q[5], q[1], q[0]; -s q[6]; -ccx q[6], q[3], q[1]; -cx q[1], q[0]; -t q[4]; -t q[7]; -cx q[3], q[4]; -cx q[4], q[8]; -cx q[8], q[4]; -cx q[7], q[5]; -t q[4]; -cx q[7], q[9]; -cx q[1], q[8]; -t q[6]; -s q[9]; -cx q[9], q[1]; -ccx q[4], q[0], q[9]; -t q[5]; -h q[6]; -ccx q[5], q[4], q[9]; -s q[3]; -s q[4]; -h q[8]; -h q[3]; -ccx q[1], q[6], q[3]; -ccx q[9], q[7], q[0]; -cx q[3], q[5]; -ccx q[3], q[8], q[9]; -t q[0]; -ccx q[0], q[9], q[5]; -cx q[5], q[9]; -s q[2]; -h q[9]; -t q[2]; -h q[8]; -ccx q[5], q[1], q[6]; -cx q[9], q[5]; -h q[2]; -cx q[7], q[9]; -cx q[7], q[9]; -s q[5]; -cx q[5], q[8]; -ccx q[7], q[6], q[3]; -h q[6]; -s q[0]; -s q[3]; -ccx q[6], q[5], q[8]; -cx q[0], q[9]; -h q[2]; -t q[3]; -h q[9]; -s q[1]; -ccx q[5], q[2], q[4]; -h q[6]; -ccx q[6], q[1], q[5]; -s q[7]; -s q[2]; -cx q[7], q[5]; -h q[2]; -s q[9]; -cx q[2], q[8]; -cx q[1], q[6]; diff --git a/test/circuits/random_2.qasm b/test/circuits/random_2.qasm deleted file mode 100644 index cb7d21c38..000000000 --- a/test/circuits/random_2.qasm +++ /dev/null @@ -1,532 +0,0 @@ -OPENQASM 2.0; -include "qelib1.inc"; -qreg q[10]; -creg c[10]; -h q[0]; -h q[1]; -h q[2]; -h q[3]; -h q[4]; -h q[5]; -h q[6]; -h q[7]; -h q[8]; -h q[9]; -h q[7]; -cx q[7], q[6]; -tdg q[6]; -cx q[0], q[6]; -t q[6]; -cx q[7], q[6]; -tdg q[6]; -cx q[0], q[6]; -t q[6]; -cx q[0], q[7]; -tdg q[7]; -cx q[0], q[7]; -t q[0]; -t q[7]; -h q[7]; -h q[7]; -cx q[7], q[3]; -tdg q[3]; -cx q[0], q[3]; -t q[3]; -cx q[7], q[3]; -tdg q[3]; -cx q[0], q[3]; -t q[3]; -cx q[0], q[7]; -tdg q[7]; -cx q[0], q[7]; -t q[0]; -t q[7]; -h q[7]; -cx q[4], q[2]; -h q[8]; -cx q[5], q[1]; -s q[5]; -h q[6]; -s q[9]; -t q[6]; -cx q[4], q[7]; -s q[4]; -t q[2]; -cx q[3], q[7]; -h q[9]; -cx q[9], q[0]; -tdg q[0]; -cx q[6], q[0]; -t q[0]; -cx q[9], q[0]; -tdg q[0]; -cx q[6], q[0]; -t q[0]; -cx q[6], q[9]; -tdg q[9]; -cx q[6], q[9]; -t q[6]; -t q[9]; -h q[9]; -h q[3]; -s q[3]; -t q[8]; -t q[3]; -t q[8]; -cx q[6], q[7]; -h q[9]; -t q[8]; -s q[3]; -cx q[3], q[0]; -h q[7]; -t q[9]; -h q[8]; -h q[2]; -cx q[9], q[5]; -h q[7]; -cx q[7], q[1]; -tdg q[1]; -cx q[2], q[1]; -t q[1]; -cx q[7], q[1]; -tdg q[1]; -cx q[2], q[1]; -t q[1]; -cx q[2], q[7]; -tdg q[7]; -cx q[2], q[7]; -t q[2]; -t q[7]; -h q[7]; -s q[3]; -t q[6]; -cx q[7], q[3]; -t q[2]; -h q[1]; -cx q[1], q[2]; -tdg q[2]; -cx q[8], q[2]; -t q[2]; -cx q[1], q[2]; -tdg q[2]; -cx q[8], q[2]; -t q[2]; -cx q[8], q[1]; -tdg q[1]; -cx q[8], q[1]; -t q[8]; -t q[1]; -h q[1]; -t q[7]; -t q[2]; -s q[2]; -cx q[5], q[6]; -s q[0]; -h q[3]; -cx q[3], q[5]; -tdg q[5]; -cx q[0], q[5]; -t q[5]; -cx q[3], q[5]; -tdg q[5]; -cx q[0], q[5]; -t q[5]; -cx q[0], q[3]; -tdg q[3]; -cx q[0], q[3]; -t q[0]; -t q[3]; -h q[3]; -h q[4]; -cx q[6], q[9]; -s q[6]; -cx q[3], q[8]; -t q[8]; -cx q[9], q[7]; -h q[2]; -cx q[7], q[6]; -s q[6]; -h q[8]; -cx q[8], q[5]; -tdg q[5]; -cx q[9], q[5]; -t q[5]; -cx q[8], q[5]; -tdg q[5]; -cx q[9], q[5]; -t q[5]; -cx q[9], q[8]; -tdg q[8]; -cx q[9], q[8]; -t q[9]; -t q[8]; -h q[8]; -cx q[7], q[2]; -h q[6]; -cx q[6], q[1]; -tdg q[1]; -cx q[7], q[1]; -t q[1]; -cx q[6], q[1]; -tdg q[1]; -cx q[7], q[1]; -t q[1]; -cx q[7], q[6]; -tdg q[6]; -cx q[7], q[6]; -t q[7]; -t q[6]; -h q[6]; -h q[0]; -cx q[8], q[1]; -h q[5]; -h q[2]; -h q[9]; -cx q[7], q[2]; -cx q[6], q[8]; -cx q[5], q[4]; -cx q[6], q[5]; -h q[3]; -cx q[3], q[2]; -tdg q[2]; -cx q[8], q[2]; -t q[2]; -cx q[3], q[2]; -tdg q[2]; -cx q[8], q[2]; -t q[2]; -cx q[8], q[3]; -tdg q[3]; -cx q[8], q[3]; -t q[8]; -t q[3]; -h q[3]; -t q[9]; -h q[3]; -h q[0]; -cx q[0], q[7]; -tdg q[7]; -cx q[9], q[7]; -t q[7]; -cx q[0], q[7]; -tdg q[7]; -cx q[9], q[7]; -t q[7]; -cx q[9], q[0]; -tdg q[0]; -cx q[9], q[0]; -t q[9]; -t q[0]; -h q[0]; -h q[4]; -cx q[3], q[4]; -h q[0]; -h q[4]; -cx q[4], q[1]; -tdg q[1]; -cx q[8], q[1]; -t q[1]; -cx q[4], q[1]; -tdg q[1]; -cx q[8], q[1]; -t q[1]; -cx q[8], q[4]; -tdg q[4]; -cx q[8], q[4]; -t q[8]; -t q[4]; -h q[4]; -s q[7]; -s q[5]; -h q[5]; -cx q[5], q[3]; -tdg q[3]; -cx q[6], q[3]; -t q[3]; -cx q[5], q[3]; -tdg q[3]; -cx q[6], q[3]; -t q[3]; -cx q[6], q[5]; -tdg q[5]; -cx q[6], q[5]; -t q[6]; -t q[5]; -h q[5]; -s q[1]; -h q[1]; -cx q[1], q[6]; -tdg q[6]; -cx q[3], q[6]; -t q[6]; -cx q[1], q[6]; -tdg q[6]; -cx q[3], q[6]; -t q[6]; -cx q[3], q[1]; -tdg q[1]; -cx q[3], q[1]; -t q[3]; -t q[1]; -h q[1]; -t q[7]; -h q[8]; -cx q[8], q[7]; -tdg q[7]; -cx q[6], q[7]; -t q[7]; -cx q[8], q[7]; -tdg q[7]; -cx q[6], q[7]; -t q[7]; -cx q[6], q[8]; -tdg q[8]; -cx q[6], q[8]; -t q[6]; -t q[8]; -h q[8]; -s q[4]; -h q[0]; -cx q[0], q[1]; -tdg q[1]; -cx q[5], q[1]; -t q[1]; -cx q[0], q[1]; -tdg q[1]; -cx q[5], q[1]; -t q[1]; -cx q[5], q[0]; -tdg q[0]; -cx q[5], q[0]; -t q[5]; -t q[0]; -h q[0]; -s q[6]; -h q[1]; -cx q[1], q[3]; -tdg q[3]; -cx q[6], q[3]; -t q[3]; -cx q[1], q[3]; -tdg q[3]; -cx q[6], q[3]; -t q[3]; -cx q[6], q[1]; -tdg q[1]; -cx q[6], q[1]; -t q[6]; -t q[1]; -h q[1]; -cx q[1], q[0]; -t q[4]; -t q[7]; -cx q[3], q[4]; -cx q[4], q[8]; -cx q[8], q[4]; -cx q[7], q[5]; -t q[4]; -cx q[7], q[9]; -cx q[1], q[8]; -t q[6]; -s q[9]; -cx q[9], q[1]; -h q[9]; -cx q[9], q[0]; -tdg q[0]; -cx q[4], q[0]; -t q[0]; -cx q[9], q[0]; -tdg q[0]; -cx q[4], q[0]; -t q[0]; -cx q[4], q[9]; -tdg q[9]; -cx q[4], q[9]; -t q[4]; -t q[9]; -h q[9]; -t q[5]; -h q[6]; -h q[9]; -cx q[9], q[4]; -tdg q[4]; -cx q[5], q[4]; -t q[4]; -cx q[9], q[4]; -tdg q[4]; -cx q[5], q[4]; -t q[4]; -cx q[5], q[9]; -tdg q[9]; -cx q[5], q[9]; -t q[5]; -t q[9]; -h q[9]; -s q[3]; -s q[4]; -h q[8]; -h q[3]; -h q[3]; -cx q[3], q[6]; -tdg q[6]; -cx q[1], q[6]; -t q[6]; -cx q[3], q[6]; -tdg q[6]; -cx q[1], q[6]; -t q[6]; -cx q[1], q[3]; -tdg q[3]; -cx q[1], q[3]; -t q[1]; -t q[3]; -h q[3]; -h q[0]; -cx q[0], q[7]; -tdg q[7]; -cx q[9], q[7]; -t q[7]; -cx q[0], q[7]; -tdg q[7]; -cx q[9], q[7]; -t q[7]; -cx q[9], q[0]; -tdg q[0]; -cx q[9], q[0]; -t q[9]; -t q[0]; -h q[0]; -cx q[3], q[5]; -h q[9]; -cx q[9], q[8]; -tdg q[8]; -cx q[3], q[8]; -t q[8]; -cx q[9], q[8]; -tdg q[8]; -cx q[3], q[8]; -t q[8]; -cx q[3], q[9]; -tdg q[9]; -cx q[3], q[9]; -t q[3]; -t q[9]; -h q[9]; -t q[0]; -h q[5]; -cx q[5], q[9]; -tdg q[9]; -cx q[0], q[9]; -t q[9]; -cx q[5], q[9]; -tdg q[9]; -cx q[0], q[9]; -t q[9]; -cx q[0], q[5]; -tdg q[5]; -cx q[0], q[5]; -t q[0]; -t q[5]; -h q[5]; -cx q[5], q[9]; -s q[2]; -h q[9]; -t q[2]; -h q[8]; -h q[6]; -cx q[6], q[1]; -tdg q[1]; -cx q[5], q[1]; -t q[1]; -cx q[6], q[1]; -tdg q[1]; -cx q[5], q[1]; -t q[1]; -cx q[5], q[6]; -tdg q[6]; -cx q[5], q[6]; -t q[5]; -t q[6]; -h q[6]; -cx q[9], q[5]; -h q[2]; -cx q[7], q[9]; -cx q[7], q[9]; -s q[5]; -cx q[5], q[8]; -h q[3]; -cx q[3], q[6]; -tdg q[6]; -cx q[7], q[6]; -t q[6]; -cx q[3], q[6]; -tdg q[6]; -cx q[7], q[6]; -t q[6]; -cx q[7], q[3]; -tdg q[3]; -cx q[7], q[3]; -t q[7]; -t q[3]; -h q[3]; -h q[6]; -s q[0]; -s q[3]; -h q[8]; -cx q[8], q[5]; -tdg q[5]; -cx q[6], q[5]; -t q[5]; -cx q[8], q[5]; -tdg q[5]; -cx q[6], q[5]; -t q[5]; -cx q[6], q[8]; -tdg q[8]; -cx q[6], q[8]; -t q[6]; -t q[8]; -h q[8]; -cx q[0], q[9]; -h q[2]; -t q[3]; -h q[9]; -s q[1]; -h q[4]; -cx q[4], q[2]; -tdg q[2]; -cx q[5], q[2]; -t q[2]; -cx q[4], q[2]; -tdg q[2]; -cx q[5], q[2]; -t q[2]; -cx q[5], q[4]; -tdg q[4]; -cx q[5], q[4]; -t q[5]; -t q[4]; -h q[4]; -h q[6]; -h q[5]; -cx q[5], q[1]; -tdg q[1]; -cx q[6], q[1]; -t q[1]; -cx q[5], q[1]; -tdg q[1]; -cx q[6], q[1]; -t q[1]; -cx q[6], q[5]; -tdg q[5]; -cx q[6], q[5]; -t q[6]; -t q[5]; -h q[5]; -s q[7]; -s q[2]; -cx q[7], q[5]; -h q[2]; -s q[9]; -cx q[2], q[8]; -cx q[1], q[6]; diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index fd97f81a8..696ef29bf 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -1228,7 +1228,7 @@ TEST(DDPackageTest, CloseToIdentityWithGarbageInTheMiddle) { {true, false, true}, false)); } -TEST(PartialEquivalenceTest, CloseToIdentityFalse) { +TEST(DDPackageTest, CloseToIdentityFalse) { const auto nqubits = 2U; const auto dd = std::make_unique>(nqubits); // the first qubit has differing gates in the two circuits, @@ -1243,7 +1243,7 @@ TEST(PartialEquivalenceTest, CloseToIdentityFalse) { EXPECT_FALSE(dd->isCloseToIdentity(u1u2, 1.0E-10, garbage, false)); } -TEST(PartialEquivalenceTest, CloseToIdentityExamplePaper) { +TEST(DDPackageTest, CloseToIdentityExamplePaper) { const auto nqubits = 3U; const auto dd = std::make_unique>(nqubits); const auto controlledSwapGate = diff --git a/test/dd/test_partial_equivalence.cpp b/test/dd/test_partial_equivalence.cpp deleted file mode 100644 index f202af55a..000000000 --- a/test/dd/test_partial_equivalence.cpp +++ /dev/null @@ -1,368 +0,0 @@ -#include "dd/Benchmark.hpp" -#include "dd/Package.hpp" -#include "dd/Verification.hpp" - -#include "gtest/gtest.h" -#include -#include - -using namespace qc::literals; - -TEST(PartialEquivalenceTest, TrivialEquivalence) { - const auto nqubits = 2U; - const auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 1, 1, 1}, {1, -1, 1, -1}, {1, 1, -1, -1}, {1, -1, -1, 1}}; - const auto inputDD = dd->makeDDFromMatrix(inputMatrix); - - EXPECT_TRUE(partialEquivalenceCheckDD(inputDD, inputDD, 1, 1, *dd)); - EXPECT_TRUE(partialEquivalenceCheckDD(inputDD, inputDD, 2, 1, *dd)); - EXPECT_TRUE(partialEquivalenceCheckDD(inputDD, inputDD, 1, 2, *dd)); - EXPECT_TRUE(partialEquivalenceCheckDD(inputDD, inputDD, 2, 2, *dd)); - - const auto hGate = dd->makeGateDD(dd::H_MAT, 2, 1); - const auto cxGate = dd->makeGateDD(dd::X_MAT, 2, 1_pc, 0); - const auto bellMatrix = dd->multiply(cxGate, hGate); - EXPECT_FALSE(partialEquivalenceCheckDD(inputDD, bellMatrix, 1, 1, *dd)); -} - -TEST(PartialEquivalenceTest, BasicPartialEquivalenceChecking) { - const auto nqubits = 3U; - auto dd = std::make_unique>(nqubits); - // only the second qubit has differing gates in the two circuits, - // therefore they should be equivalent if we only measure the first qubit - const auto hGate = dd->makeGateDD(dd::H_MAT, 3, 1); - const auto xGate = dd->makeGateDD(dd::X_MAT, 3, 1); - const auto circuit1 = dd->multiply(xGate, hGate); - const auto circuit2 = dd->makeIdent(3); - - EXPECT_TRUE(partialEquivalenceCheckDD(circuit1, circuit2, 2, 1, *dd)); -} - -TEST(PartialEquivalenceTest, NotEquivalent) { - const auto nqubits = 2U; - const auto dd = std::make_unique>(nqubits); - // the first qubit has differing gates in the two circuits, - // therefore they should not be equivalent if we only measure the first qubit - const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 0); - const auto circuit1 = dd->multiply(xGate, hGate); - const auto circuit2 = dd->makeIdent(2); - EXPECT_FALSE(partialEquivalenceCheckDD(circuit1, circuit2, 2, 1, *dd)); -} - -TEST(PartialEquivalenceTest, ExamplePaper) { - const auto nqubits = 3U; - const auto dd = std::make_unique>(nqubits); - const auto controlledSwapGate = - dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 0, 2); - const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); - const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); - const auto controlledHGate = - dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - - const auto c1 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - const auto c2 = dd->multiply(controlledHGate, xGate); - - EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); -} - -TEST(PartialEquivalenceTest, DifferentNumberOfQubits) { - const auto nqubits = 3U; - const auto dd = std::make_unique>(nqubits); - const auto controlledSwapGate = - dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 0, 2); - const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); - const auto xGate = dd->makeGateDD(dd::X_MAT, 2, 1); - const auto controlledHGate = dd->makeGateDD(dd::H_MAT, 2, qc::Controls{1}, 0); - - const auto c1 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - const auto c2 = dd->multiply(controlledHGate, xGate); - - EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); - EXPECT_FALSE(partialEquivalenceCheckDD(c2, c1, 3, 3, *dd)); - EXPECT_FALSE(partialEquivalenceCheckDD(c2, dd::mEdge::zero(), 2, 1, *dd)); - EXPECT_FALSE(partialEquivalenceCheckDD(c2, dd::mEdge::one(), 2, 1, *dd)); - EXPECT_FALSE(partialEquivalenceCheckDD(dd::mEdge::one(), c1, 2, 1, *dd)); - EXPECT_TRUE( - partialEquivalenceCheckDD(dd::mEdge::one(), dd::mEdge::one(), 0, 1, *dd)); - EXPECT_TRUE( - partialEquivalenceCheckDD(dd::mEdge::one(), dd::mEdge::one(), 0, 0, *dd)); -} - -TEST(PartialEquivalenceTest, ComputeTableTest) { - const auto nqubits = 3U; - const auto dd = std::make_unique>(nqubits); - const auto controlledSwapGate = - dd->makeTwoQubitGateDD(dd::SWAP_MAT, nqubits, qc::Controls{1}, 2, 0); - const auto hGate = dd->makeGateDD(dd::H_MAT, nqubits, 0); - const auto zGate = dd->makeGateDD(dd::Z_MAT, nqubits, 2); - const auto xGate = dd->makeGateDD(dd::X_MAT, nqubits, 1); - const auto controlledHGate = - dd->makeGateDD(dd::H_MAT, nqubits, qc::Controls{1}, 0); - - const auto c1 = dd->multiply( - controlledSwapGate, - dd->multiply(hGate, dd->multiply(zGate, controlledSwapGate))); - const auto c2 = dd->multiply(controlledHGate, xGate); - - EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); - EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); - EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); - EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); - EXPECT_TRUE(partialEquivalenceCheckDD(c1, c2, 3, 1, *dd)); -} - -TEST(PartialEquivalenceTest, MQTBenchGrover3Qubits) { - const auto dd = std::make_unique>(3); - - const qc::QuantumComputation c1{ - "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_3.qasm"}; - const qc::QuantumComputation c2{ - "./circuits/grover-noancilla_indep_qiskit_3.qasm"}; - - // 3 measured qubits and 3 data qubits, full equivalence - EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); -} - -TEST(PartialEquivalenceTest, MQTBenchGrover7Qubits) { - const auto dd = std::make_unique>(7); - - const qc::QuantumComputation c1{ - "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt0_7.qasm"}; - const qc::QuantumComputation c2{ - "./circuits/grover-noancilla_nativegates_ibm_qiskit_opt1_7.qasm"}; - - // 7 measured qubits and 7 data qubits, full equivalence - EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); -} - -TEST(PartialEquivalenceTest, SliQECGrover22Qubits) { - const auto dd = std::make_unique>(12); - - const qc::QuantumComputation c1{ - "./circuits/Grover_1.qasm"}; // 11 qubits, 11 data qubits - qc::QuantumComputation c2{ - "./circuits/Grover_2.qasm"}; // 12 qubits, 11 data qubits - - // 11 measured qubits and 11 data qubits - c2.setLogicalQubitAncillary(11); - c2.setLogicalQubitGarbage(11); - - // adds 10 ancillary qubits -> total number of qubits is 22 - EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); -} - -TEST(PartialEquivalenceTest, SliQECAdd19Qubits) { - const auto dd = std::make_unique>(19); - - // full equivalence, 19 qubits - // but this test uses algorithm for partial equivalence, not the "zero - // ancillae" version - qc::QuantumComputation c1{"./circuits/add6_196_1.qasm"}; - qc::QuantumComputation c2{"./circuits/add6_196_2.qasm"}; - - // just for benchmarking reasons, we only measure 8 qubits - c1.setLogicalQubitsAncillary(8, 18); - c2.setLogicalQubitsAncillary(8, 18); - c1.setLogicalQubitsGarbage(8, 18); - c2.setLogicalQubitsGarbage(8, 18); - - // doesn't add ancillary qubits -> total number of qubits is 19 - EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); -} - -TEST(PartialEquivalenceTest, ExamplePaperDifferentQubitOrder) { - const auto nqubits = 3U; - auto dd = std::make_unique>(nqubits); - - qc::QuantumComputation c1{nqubits, 1}; - c1.cswap(1, 2, 0); - c1.h(2); - c1.z(0); - c1.cswap(1, 2, 0); - - qc::QuantumComputation c2{nqubits, 1}; - c2.x(1); - c2.ch(1, 2); - - c1.setLogicalQubitsGarbage(0, 1); - c2.setLogicalQubitsGarbage(0, 1); - - EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); -} - -TEST(PartialEquivalenceTest, ExamplePaperDifferentQubitOrderAndNumber) { - const auto nqubits = 4U; - auto dd = std::make_unique>(nqubits); - - qc::QuantumComputation c1{nqubits, 1}; - c1.cswap(1, 2, 0); - c1.h(2); - c1.z(0); - c1.cswap(1, 2, 0); - - qc::QuantumComputation c2{3, 1}; - c2.x(1); - c2.ch(1, 2); - - c1.setLogicalQubitsGarbage(0, 1); - c1.setLogicalQubitGarbage(3); - c1.setLogicalQubitAncillary(3); - - c2.setLogicalQubitsGarbage(0, 1); - EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); - EXPECT_TRUE(partialEquivalenceCheck(c2, c1, *dd)); -} - -TEST(PartialEquivalenceTest, ZeroAncillaSliQEC19Qubits) { - auto dd = std::make_unique>(19); - - // full equivalence, 10 qubits - const qc::QuantumComputation c1{"./circuits/entanglement_1.qasm"}; - const qc::QuantumComputation c2{"./circuits/entanglement_2.qasm"}; - - // calls zeroAncillaePartialEquivalenceCheck - EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); - - // full equivalence, 19 qubits - const qc::QuantumComputation c3{"./circuits/add6_196_1.qasm"}; - const qc::QuantumComputation c4{"./circuits/add6_196_2.qasm"}; - - // calls zeroAncillaePartialEquivalenceCheck - EXPECT_TRUE(partialEquivalenceCheck(c3, c4, *dd)); - - // full equivalence, 10 qubits - const qc::QuantumComputation c5{"./circuits/bv_1.qasm"}; - const qc::QuantumComputation c6{"./circuits/bv_2.qasm"}; - - // calls zeroAncillaePartialEquivalenceCheck - EXPECT_TRUE(partialEquivalenceCheck(c5, c6, *dd)); -} - -TEST(PartialEquivalenceTest, ZeroAncillaSliQECRandomCircuit) { - auto dd = std::make_unique>(10); - // full equivalence, 10 qubits - const qc::QuantumComputation c1{"./circuits/random_1.qasm"}; - const qc::QuantumComputation c2{"./circuits/random_2.qasm"}; - - // calls buildFunctionality for c2^(-1) concatenated with c1 - EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); -} - -TEST(PartialEquivalenceTest, SliQECPeriodFinding8Qubits) { - auto dd = std::make_unique>(8); - // 8 qubits, 3 data qubits - qc::QuantumComputation c1{"./circuits/period_finding_1.qasm"}; - // 8 qubits, 3 data qubits - qc::QuantumComputation c2{"./circuits/period_finding_2.qasm"}; - - // 3 measured qubits and 3 data qubits - - c2.setLogicalQubitsAncillary(3, 7); - c2.setLogicalQubitsGarbage(3, 7); - - c1.setLogicalQubitsAncillary(3, 7); - c1.setLogicalQubitsGarbage(3, 7); - - EXPECT_TRUE(partialEquivalenceCheck(c1, c2, *dd)); -} - -void partialEquivalencCheckingBenchmarks(const qc::Qubit minN, - const qc::Qubit maxN, - const size_t reps, - const bool addAncilla) { - std::mt19937 gen(55); - - for (qc::Qubit n = minN; n < maxN; n++) { - std::chrono::microseconds totalTime{0}; - std::size_t totalGates{0}; - for (size_t k = 0; k < reps; k++) { - qc::Qubit d{0}; - if (addAncilla) { - std::uniform_int_distribution nrDataQubits(1, n); - d = nrDataQubits(gen); - } else { - d = n; - } - std::uniform_int_distribution nrDataQubits(1, d); - const qc::Qubit m = nrDataQubits(gen); - - const auto [c1, c2] = dd::generateRandomBenchmark(n, d, m); - - auto dd = std::make_unique>(n); - - const auto start = std::chrono::high_resolution_clock::now(); - - const bool result = dd::partialEquivalenceCheck(c1, c2, *dd); - // Get ending timepoint - const auto stop = std::chrono::high_resolution_clock::now(); - const auto duration = - std::chrono::duration_cast(stop - start); - - EXPECT_TRUE(result); - - // std::cout << "\nnumber of qubits = " << n << "; data qubits = " << d - // << "; measured qubits = " << m - // << "; number of gates = " << c2.size() << "\n"; - // std::cout << "time: " << static_cast(duration.count()) / - // 1000000. - // << " seconds\n"; - totalTime += duration; - totalGates += c2.size(); - } - std::cout << "\nnumber of qubits = " << n << "; number of reps = " << reps - << "; average time = " - << (static_cast(totalTime.count()) / - static_cast(reps) / 1000000.) - << " seconds; average number of gates = " - << (static_cast(totalGates) / static_cast(reps)) - << "\n"; - } -} - -TEST(PartialEquivalenceTest, Benchmark) { - const size_t minN = 2; - const size_t maxN = 8; - const size_t reps = 10; - std::cout << "Partial equivalence check\n"; - partialEquivalencCheckingBenchmarks(minN, maxN, reps, true); -} - -TEST(PartialEquivalenceTest, ZeroAncillaBenchmark) { - const size_t minN = 3; - const size_t maxN = 15; - const size_t reps = 10; - std::cout << "Zero-ancilla partial equivalence check\n"; - partialEquivalencCheckingBenchmarks(minN, maxN, reps, false); -} - -TEST(PartialEquivalenceTest, InvalidInput) { - const auto nqubits = 4U; - const auto dd = std::make_unique>(nqubits); - - // the circuits don't have the same number of measured qubits - qc::QuantumComputation c1{nqubits, 1}; - c1.x(1); - - qc::QuantumComputation c2{nqubits, 1}; - c2.x(1); - - c1.setLogicalQubitsGarbage(0, 1); - c1.setLogicalQubitGarbage(3); - - c2.setLogicalQubitsGarbage(0, 1); - - EXPECT_FALSE(partialEquivalenceCheck(c1, c2, *dd)); - - // now they have the same number of measured qubits but a different - // permutation of garbage qubits - c2.setLogicalQubitGarbage(2); - EXPECT_THROW(partialEquivalenceCheck(c1, c2, *dd), std::invalid_argument); -} From 8a070c2480a5389850c6b738456a3260e096fd3d Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Wed, 21 Feb 2024 16:02:06 +0100 Subject: [PATCH 49/51] :fire: removed redundant includes --- test/dd/test_package.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 696ef29bf..4f36e57d5 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -1,17 +1,11 @@ -#include "Definitions.hpp" -#include "QuantumComputation.hpp" #include "dd/DDDefinitions.hpp" #include "dd/Export.hpp" -#include "dd/FunctionalityConstruction.hpp" #include "dd/GateMatrixDefinitions.hpp" #include "dd/Package.hpp" #include "dd/statistics/PackageStatistics.hpp" #include "operations/Control.hpp" -#include "operations/OpType.hpp" -#include "operations/StandardOperation.hpp" #include "gtest/gtest.h" -#include #include #include #include From c0f5431908cfdc97248807e0f3390ae46916dd67 Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Wed, 21 Feb 2024 16:26:00 +0100 Subject: [PATCH 50/51] =?UTF-8?q?=E2=9C=85=20added=20tests=20for=20adding?= =?UTF-8?q?=20multiple=20ancillaries=20and=20garbage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/unittests/test_qfr_functionality.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/unittests/test_qfr_functionality.cpp b/test/unittests/test_qfr_functionality.cpp index 8d1029551..40f5e0022 100644 --- a/test/unittests/test_qfr_functionality.cpp +++ b/test/unittests/test_qfr_functionality.cpp @@ -2424,6 +2424,24 @@ TEST_F(QFRFunctionality, testSettingAncillariesProperlyCreatesRegisters) { ASSERT_EQ(qc.getNancillae(), 0U); } +TEST_F(QFRFunctionality, testSettingSetMultipleAncillariesAndGarbage) { + // create an empty circuit and assert some properties about its registers + qc::QuantumComputation qc(3U); + const auto& ancRegs = qc.getANCregs(); + ASSERT_TRUE(ancRegs.empty()); + ASSERT_EQ(qc.getNqubitsWithoutAncillae(), 3U); + ASSERT_EQ(qc.getNancillae(), 0U); + + // set some ancillaries garbage and assert that the registers are created + // properly + qc.setLogicalQubitsAncillary(1U, 2U); + ASSERT_EQ(qc.getNqubitsWithoutAncillae(), 1U); + ASSERT_EQ(qc.getNancillae(), 2U); + qc.setLogicalQubitsGarbage(1U, 2U); + ASSERT_EQ(qc.getNgarbageQubits(), 2U); + ASSERT_EQ(qc.getNmeasuredQubits(), 1U); +} + TEST_F(QFRFunctionality, StripIdleQubitsInMiddleOfCircuit) { qc::QuantumComputation qc(5U); qc.setLogicalQubitAncillary(3U); From 72e1e7c4d9754676f0a5c3bc034dadd99a95a3fe Mon Sep 17 00:00:00 2001 From: Rebecca Ghidini Date: Fri, 15 Mar 2024 15:46:59 +0100 Subject: [PATCH 51/51] =?UTF-8?q?=F0=9F=94=A5=20removed=20functions=20for?= =?UTF-8?q?=20shifting=20rows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/mqt-core/dd/Package.hpp | 165 -------------------------------- test/dd/test_package.cpp | 162 ------------------------------- 2 files changed, 327 deletions(-) diff --git a/include/mqt-core/dd/Package.hpp b/include/mqt-core/dd/Package.hpp index 5d29ea6bc..3f297d6b3 100644 --- a/include/mqt-core/dd/Package.hpp +++ b/include/mqt-core/dd/Package.hpp @@ -2473,171 +2473,6 @@ template class Package { nodes[index] = r.p; return r; } - -public: - // only keeps the first 2^d columns - mEdge setColumnsToZero(const mEdge& e, const Qubit d) { - if (e.isTerminal()) { - return e; - } - // the matrix of the current DD has dimensions 2^n x 2^n - const auto n = e.p->v + 1; - - if (d >= n) { - return e; - } - - std::array edges{}; - edges[0] = setColumnsToZero(e.p->e[0], d); - edges[1] = mEdge::zero(); - edges[2] = setColumnsToZero(e.p->e[2], d); - edges[3] = mEdge::zero(); - - auto f = makeDDNode(e.p->v, edges); - f.w = cn.lookup(e.w * f.w); - return f; - } - - mEdge keepOnlyIthRow(const mEdge& e, const std::int64_t i) { - if (e.isZeroTerminal()) { - return e; - } - if (e.isTerminal()) { - if (i == 0) { - return e; - } - return mEdge::zero(); - } - // the matrix of the current DD has dimensions 2^n x 2^n - const auto n = e.p->v + 1; - const auto twoPowNMinusOne = 1 << (n - 1); - std::array edges{}; - if (i < twoPowNMinusOne) { - edges[0] = keepOnlyIthRow(e.p->e[0], i); - edges[1] = keepOnlyIthRow(e.p->e[1], i); - edges[2] = mEdge::zero(); - edges[3] = mEdge::zero(); - } else { - edges[0] = mEdge::zero(); - edges[1] = mEdge::zero(); - edges[2] = keepOnlyIthRow(e.p->e[2], i - twoPowNMinusOne); - edges[3] = keepOnlyIthRow(e.p->e[3], i - twoPowNMinusOne); - } - - auto f = makeDDNode(e.p->v, edges); - f.w = cn.lookup(e.w * f.w); - return f; - } - -private: - UnaryComputeTable shiftAllMatrixRows{}; - Qubit shiftAllMatrixRowsM{0}; - Qubit shiftAllMatrixRowsD{0}; - - /** - Equally divides the rows of the matrix represented by e (of size 2^n x 2^n) - into 2^g parts of size 2^m (where g = n - m). - For each part the (upperOffset + i)-th row is shifted by i*2^d columns. - **/ - mEdge shiftAllRowsRecursive(const mEdge& e, const Qubit m, const Qubit d, - std::int64_t upperOffset) { - if (e.isTerminal() && upperOffset == 0) { - return e; - } - if (e.isTerminal()) { - return mEdge::zero(); - } - if (upperOffset == 0 && m == 0) { - return e; - } - - // the matrix of the current DD has dimensions 2^n x 2^n - const auto n = e.p->v + 1; - if (upperOffset >= (1 << n) || upperOffset < 0) { - return mEdge::zero(); - } - - const mEdge eCopy{e.p, Complex::one()}; - // check if it's in the compute table with an edge weight of one - // only store elements in the compute table if the offset is 0 - if (upperOffset == 0) { - if (const auto* r = shiftAllMatrixRows.lookup(eCopy); r != nullptr) { - auto f = *r; - f.w = cn.lookup(e.w * f.w); - return f; - } - } - - if (d >= n && m >= n) { - return keepOnlyIthRow(e, upperOffset); - } - - std::array edges{}; - const auto originalUpperOffset = upperOffset; - - // if the current submatrix size is less than 2^m, - // then the offset of the lower half needs to be adapted - const bool adaptOffsetOfLowerMatrixHalf = n <= m; - edges[0] = shiftAllRowsRecursive(e.p->e[0], m, d, upperOffset); - if (n <= d) { - // CASE 1: this (sub)matrix has size < 2^d - // -> we need to keep all the columns of this submatrix - edges[1] = shiftAllRowsRecursive(e.p->e[1], m, d, upperOffset); - if (adaptOffsetOfLowerMatrixHalf) { - upperOffset -= (1 << (n - 1)); - } - edges[2] = shiftAllRowsRecursive(e.p->e[2], m, d, upperOffset); - edges[3] = shiftAllRowsRecursive(e.p->e[3], m, d, upperOffset); - } else { - const std::int64_t addedOffset{1 << (n - 1 - d)}; - if (upperOffset + addedOffset < (1 << m)) { - // CASE 2: this submatrix doesn't contain ancilla qubits - // -> we don't need to set any columns to zero - edges[1] = - shiftAllRowsRecursive(e.p->e[0], m, d, upperOffset + addedOffset); - - if (adaptOffsetOfLowerMatrixHalf) { - upperOffset -= (1 << (n - 1)); - } - edges[2] = shiftAllRowsRecursive(e.p->e[2], m, d, upperOffset); - edges[3] = - shiftAllRowsRecursive(e.p->e[2], m, d, upperOffset + addedOffset); - } else { - // CASE 3: the right half of the matrix represents the ancilla qubits, - // therefore it is set to zero - edges[1] = mEdge::zero(); - if (adaptOffsetOfLowerMatrixHalf) { - upperOffset -= (1 << (n - 1)); - } - edges[2] = shiftAllRowsRecursive(e.p->e[2], m, d, upperOffset); - edges[3] = mEdge::zero(); - } - } - - auto f = makeDDNode(e.p->v, edges); - // add to the compute table with a weight of 1 - if (originalUpperOffset == 0) { - shiftAllMatrixRows.insert(eCopy, f); - } - f.w = cn.lookup(e.w * f.w); - return f; - } - -public: - /** - Equally divides the rows of the matrix represented by e into parts - of size 2^m. - For each part we keep only the first 2^d columns - and the i-th row of each part is shifted by i*2^d columns. - **/ - mEdge shiftAllRows(const mEdge& e, const Qubit m, const Qubit d) { - if (shiftAllMatrixRowsM != m || shiftAllMatrixRowsD != d) { - shiftAllMatrixRows.clear(); - shiftAllMatrixRowsM = m; - shiftAllMatrixRowsD = d; - } - return shiftAllRowsRecursive(e, m, d, 0); - } }; } // namespace dd diff --git a/test/dd/test_package.cpp b/test/dd/test_package.cpp index 4f36e57d5..242622651 100644 --- a/test/dd/test_package.cpp +++ b/test/dd/test_package.cpp @@ -2324,165 +2324,3 @@ TEST(DDPackageTest, ReduceAncillaeRegression) { EXPECT_EQ(outputMatrix, expected); } - -TEST(DDPackageTest, DDShiftAllRows) { - const auto nqubits = 2U; - const auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 0, 0, 0}, {-1, 0, 0, 0}, {-1, 0, 0, 0}, {1, 0, 0, 0}}; - const auto inputDD = dd->makeDDFromMatrix(inputMatrix); - const auto outputMatrix = dd->shiftAllRows(inputDD, 1, 0); - const auto expectedMatrix = - dd::CMat{{1, 0, 0, 0}, {0, -1, 0, 0}, {-1, 0, 0, 0}, {0, 1, 0, 0}}; - EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); - const auto outputMatrix2 = dd->shiftAllRows(inputDD, 2, 0); - const auto expectedMatrix2 = - dd::CMat{{1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, -1, 0}, {0, 0, 0, 1}}; - EXPECT_EQ(outputMatrix2.getMatrix(), expectedMatrix2); -} - -TEST(DDPackageTest, DDShiftAllRows3QubitsPart0) { - const auto nqubits = 3U; - const auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 3, 3, 3, 3, 3, 3, 3}, {-1, 3, 3, 3, 3, 3, 3, 3}, - {-1, 3, 3, 3, 3, 3, 3, 3}, {1, 3, 3, 3, 3, 3, 3, 3}, - {1, 3, 3, 3, 3, 3, 3, 3}, {-1, 3, 3, 3, 3, 3, 3, 3}, - {-1, 3, 3, 3, 3, 3, 3, 3}, {1, 3, 3, 3, 3, 3, 3, 3}}; - const auto inputDD = dd->makeDDFromMatrix(inputMatrix); - - const auto outputMatrix = dd->shiftAllRows(inputDD, 2, 0); - const auto expectedMatrix = - dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, - {0, 0, -1, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, - {0, 0, -1, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0}}; - EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); - - const auto outputMatrix4 = dd->shiftAllRows(inputDD, 1, 0); - const auto expectedMatrix4 = - dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, - {-1, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, - {-1, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}}; - EXPECT_EQ(outputMatrix4.getMatrix(), expectedMatrix4); - - const auto outputMatrix2 = dd->shiftAllRows(inputDD, 3, 0); - const auto expectedMatrix2 = - dd::CMat{{1, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0}, - {0, 0, -1, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, -1, 0, 0}, - {0, 0, 0, 0, 0, 0, -1, 0}, {0, 0, 0, 0, 0, 0, 0, 1}}; - EXPECT_EQ(outputMatrix2.getMatrix(), expectedMatrix2); - - const auto inputMatrix2 = - dd::CMat{{1, 1, 3, 3, 3, 3, 3, 3}, {-1, 1, 3, 3, 3, 3, 3, 3}, - {-1, 1, 3, 3, 3, 3, 3, 3}, {1, 1, 3, 3, 3, 3, 3, 3}, - {1, 1, 3, 3, 3, 3, 3, 3}, {-1, 1, 3, 3, 3, 3, 3, 3}, - {-1, 1, 3, 3, 3, 3, 3, 3}, {1, 1, 3, 3, 3, 3, 3, 3}}; - const auto inputDD2 = dd->makeDDFromMatrix(inputMatrix2); - const auto outputMatrix3 = dd->shiftAllRows(inputDD2, 1, 1); - const auto expectedMatrix3 = - dd::CMat{{1, 1, 0, 0, 0, 0, 0, 0}, {0, 0, -1, 1, 0, 0, 0, 0}, - {-1, 1, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 0, 0, 0}, {0, 0, -1, 1, 0, 0, 0, 0}, - {-1, 1, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 0, 0}}; - EXPECT_EQ(outputMatrix3.getMatrix(), expectedMatrix3); -} - -TEST(DDPackageTest, DDShiftAllRows3QubitsPart1) { - const size_t nqubits = 3U; - const auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; - const auto inputDD = dd->makeDDFromMatrix(inputMatrix); - const dd::Qubit m = 2; - const dd::Qubit d = 1; - const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); - const auto expectedOutputMatrix = - dd->makeDDFromMatrix(dd::CMat{{1, 2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 2, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 2}, - {1, 2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 2, 0, 0}, - {0, 0, 0, 0, 0, 0, 1, 2}}); - EXPECT_EQ(outputMatrix, expectedOutputMatrix); -} - -TEST(DDPackageTest, DDShiftAllRows3QubitsPart2) { - const size_t nqubits = 3U; - const auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; - const auto inputDD = dd->makeDDFromMatrix(inputMatrix); - const dd::Qubit m = 1; - const dd::Qubit d = 2; - const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); - const auto expectedOutputMatrix = - dd->makeDDFromMatrix(dd::CMat{{1, 2, 3, 4, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 2, 3, 4}, - {1, 2, 3, 4, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 2, 3, 4}, - {1, 2, 3, 4, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 2, 3, 4}, - {1, 2, 3, 4, 0, 0, 0, 0}, - {0, 0, 0, 0, 1, 2, 3, 4}}); - - EXPECT_EQ(outputMatrix, expectedOutputMatrix); -} - -TEST(DDPackageTest, DDShiftAllRows3QubitsPart3) { - const size_t nqubits = 3U; - const auto dd = std::make_unique>(nqubits); - const auto inputMatrix = - dd::CMat{{1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}, - {1, 2, 3, 4, 5, 6, 7, 8}, {1, 2, 3, 4, 5, 6, 7, 8}}; - const auto inputDD = dd->makeDDFromMatrix(inputMatrix); - const dd::Qubit m = 1; - const dd::Qubit d = 1; - const auto outputMatrix = dd->shiftAllRows(inputDD, m, d); - const auto outputMatrixMatrix = outputMatrix.getMatrix(); - const auto expectedOutputMatrix = - dd->makeDDFromMatrix(dd::CMat{{1, 2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0}, - {1, 2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0}, - {1, 2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0}, - {1, 2, 0, 0, 0, 0, 0, 0}, - {0, 0, 1, 2, 0, 0, 0, 0}}); - EXPECT_EQ(outputMatrix, expectedOutputMatrix); -} - -TEST(DDPackageTest, DDShiftAllRows5Qubits) { - const auto nqubits = 5U; - const auto dd = std::make_unique>(nqubits); - const std::uint64_t n = 1 << nqubits; - std::vector> row10(n, 0); - std::vector> row01(n, 1); - for (std::uint64_t i = 0; i < n / 2; i++) { - row10[i] = 1; - row01[i] = 0; - } - // inputMatrix = [1, 1, ... 0, 0 ...]...[1, 1, ... 0, 0...]... - const dd::CMat inputMatrix(n, row10); - const auto inputDD = dd->makeDDFromMatrix(inputMatrix); - - const auto outputMatrix = dd->shiftAllRows(inputDD, 1, nqubits - 1); - dd::CMat expectedMatrix(n, row01); - for (std::uint64_t i = 0; i < n; i += 2) { - expectedMatrix[i] = row10; - } - // expectedMatrix = [1, 1, ... 0, 0 ...][0, 0, ... 1, 1 ...]... - EXPECT_EQ(outputMatrix.getMatrix(), expectedMatrix); -}