diff --git a/QCSim/Clifford.h b/QCSim/Clifford.h index bfb9e44..e06d271 100644 --- a/QCSim/Clifford.h +++ b/QCSim/Clifford.h @@ -340,6 +340,24 @@ namespace QC { return h.PhaseSign; } + void SaveState() + { + savedDestabilizerGenerators = destabilizerGenerators; + savedStabilizerGenerators = stabilizerGenerators; + } + + void RestoreSavedState() + { + destabilizerGenerators.swap(savedDestabilizerGenerators); + stabilizerGenerators.swap(savedStabilizerGenerators); + } + + void ClearSavedState() + { + savedDestabilizerGenerators.clear(); + savedStabilizerGenerators.clear(); + } + private: inline static bool XOR(bool a, bool b) { @@ -529,6 +547,9 @@ namespace QC { std::vector destabilizerGenerators; std::vector stabilizerGenerators; + std::vector savedDestabilizerGenerators; + std::vector savedStabilizerGenerators; + std::default_random_engine gen; std::bernoulli_distribution rnd; };