From 2f125cf447a0acbfd605e7aa1a5ee0f0a69773d0 Mon Sep 17 00:00:00 2001 From: Adrian Roman Date: Fri, 15 Nov 2024 13:25:49 +0200 Subject: [PATCH] Better restore state function for the clifford simulator (for the cases when one does not have to restore multiple times). --- QCSim/Clifford.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/QCSim/Clifford.h b/QCSim/Clifford.h index f609e33..420ead4 100644 --- a/QCSim/Clifford.h +++ b/QCSim/Clifford.h @@ -531,6 +531,13 @@ namespace QC { stabilizerGenerators = savedStabilizerGenerators; } + void RestoreSavedStateDestructive() + { + destabilizerGenerators.swap(savedDestabilizerGenerators); + stabilizerGenerators.swap(savedStabilizerGenerators); + ClearSavedState(); + } + void ClearSavedState() { savedDestabilizerGenerators.clear();