From ff4e5d61bdb99fb2ac284366145134f313ecf45e Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Wed, 6 Nov 2024 18:17:16 -0500 Subject: [PATCH] Fix QUnitMulti --- include/qunitmulti.hpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/include/qunitmulti.hpp b/include/qunitmulti.hpp index 12e7f1ac3..5ccdc91fa 100644 --- a/include/qunitmulti.hpp +++ b/include/qunitmulti.hpp @@ -121,18 +121,23 @@ class QUnitMulti : public QUnit { return toRet; } - virtual void Detach(bitLenInt start, bitLenInt length, QUnitPtr dest) + virtual bool Detach( + bitLenInt start, bitLenInt length, QUnitPtr dest, bool isTry = false, real1_f tol = TRYDECOMPOSE_EPSILON) { - Detach(start, length, std::dynamic_pointer_cast(dest)); + return Detach(start, length, std::dynamic_pointer_cast(dest), isTry, tol); } - virtual void Detach(bitLenInt start, bitLenInt length, QUnitMultiPtr dest) + virtual bool Detach( + bitLenInt start, bitLenInt length, QUnitMultiPtr dest, bool isTry = false, real1_f tol = TRYDECOMPOSE_EPSILON) { if (!length) { - return; + return true; } - QUnit::Detach(start, length, dest); + const bool result = QUnit::Detach(start, length, dest, isTry, tol); + RedistributeQEngines(); + + return result; } virtual QInterfacePtr EntangleInCurrentBasis(