From 3eb872f235e12abbad87da2b3f634bd10bdc47d5 Mon Sep 17 00:00:00 2001 From: Daniel Strano Date: Sat, 10 Jul 2021 18:40:56 -0400 Subject: [PATCH] Revert "Reverse QPager::Compose() (debugged)" This reverts commit 3e033bdd12c19c5205dbc5f15f62b6f8e2845f2b. --- src/qpager.cpp | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/src/qpager.cpp b/src/qpager.cpp index 7b9dea4c0..2bb1d06dc 100644 --- a/src/qpager.cpp +++ b/src/qpager.cpp @@ -438,46 +438,7 @@ void QPager::CombineAndOpControlled( CombineAndOp(fn, bits); } -bitLenInt QPager::Compose(QPagerPtr toCopy) -{ - if (qubitCount >= toCopy->qubitCount) { - return Compose(toCopy, qubitCount); - } - - if ((qubitCount + toCopy->qubitCount) > maxQubits) { - throw std::invalid_argument( - "Cannot instantiate a QPager with greater capacity than environment variable QRACK_MAX_PAGING_QB."); - } - - // TODO: Avoid CombineEngines(); - toCopy->CombineEngines(); - - bitLenInt qpp = qubitsPerPage(); - bitLenInt tcqpp = toCopy->qubitCount; - - if ((qpp + tcqpp) > maxPageQubits) { - qpp = (maxPageQubits <= tcqpp) ? 1U : (maxPageQubits - tcqpp); - SeparateEngines(qpp, true); - } - - bitCapIntOcl i; - bitCapIntOcl maxI = (bitCapIntOcl)qPages.size(); - std::vector nQPages; - - QEnginePtr engine = toCopy->qPages[0]; - for (i = 0; i < maxI; i++) { - nQPages.push_back(std::dynamic_pointer_cast(engine->Clone())); - nQPages.back()->Compose(qPages[i], 0); - } - - qPages = nQPages; - - bitLenInt toRet = qubitCount; - - SetQubitCount(qubitCount + toCopy->qubitCount); - - return toRet; -} +bitLenInt QPager::Compose(QPagerPtr toCopy) { return Compose(toCopy, qubitCount); } bitLenInt QPager::Compose(QPagerPtr toCopy, bitLenInt start) {