diff --git a/_autosummary/tqec.plaquette.frozendefaultdict.FrozenDefaultDict.html b/_autosummary/tqec.plaquette.frozendefaultdict.FrozenDefaultDict.html index a6d6872c..b32534fc 100644 --- a/_autosummary/tqec.plaquette.frozendefaultdict.FrozenDefaultDict.html +++ b/_autosummary/tqec.plaquette.frozendefaultdict.FrozenDefaultDict.html @@ -152,7 +152,10 @@

tqec.plaquette.frozendefaultdict.FrozenDefaultDict

keys()

-

values()

+

map_keys(callable)

+

+ +

values()

diff --git a/_autosummary/tqec.plaquette.plaquette.Plaquettes.html b/_autosummary/tqec.plaquette.plaquette.Plaquettes.html index d823369a..e1e6151f 100644 --- a/_autosummary/tqec.plaquette.plaquette.Plaquettes.html +++ b/_autosummary/tqec.plaquette.plaquette.Plaquettes.html @@ -136,10 +136,13 @@

tqec.plaquette.plaquette.Plaquettes

__init__(collection)

-

repeat(repetitions)

+

map_indices(callable)

-

with_updated_plaquettes(plaquettes_to_update)

+

repeat(repetitions)

+

+ +

with_updated_plaquettes(plaquettes_to_update)

diff --git a/_autosummary/tqec.plaquette.plaquette.RepeatedPlaquettes.html b/_autosummary/tqec.plaquette.plaquette.RepeatedPlaquettes.html index 6798254f..98059565 100644 --- a/_autosummary/tqec.plaquette.plaquette.RepeatedPlaquettes.html +++ b/_autosummary/tqec.plaquette.plaquette.RepeatedPlaquettes.html @@ -129,13 +129,16 @@

tqec.plaquette.plaquette.RepeatedPlaquettes

__init__(collection, repetitions)

-

num_rounds(k)

+

map_indices(callable)

-

repeat(repetitions)

+

num_rounds(k)

-

with_updated_plaquettes(plaquettes_to_update)

+

repeat(repetitions)

+

+ +

with_updated_plaquettes(plaquettes_to_update)

diff --git a/_modules/tqec/plaquette/frozendefaultdict.html b/_modules/tqec/plaquette/frozendefaultdict.html index 862cd67a..9f620a01 100644 --- a/_modules/tqec/plaquette/frozendefaultdict.html +++ b/_modules/tqec/plaquette/frozendefaultdict.html @@ -173,20 +173,24 @@

Source code for tqec.plaquette.frozendefaultdict

return ( isinstance(other, FrozenDefaultDict) and ( - not operator.xor( - self._default_factory is None, other._default_factory is None + (self._default_factory is None and other._default_factory is None) + or ( + self._default_factory is not None + and other._default_factory is not None + and (self._default_factory() == other._default_factory()) ) ) - and ( - self._default_factory is not None - and other._default_factory is not None - and (self._default_factory() == other._default_factory()) - ) and self._dict == other._dict ) def has_default_factory(self) -> bool: - return self._default_factory is not None
+ return self._default_factory is not None + + def map_keys(self, callable: Callable[[K], K]) -> FrozenDefaultDict[K, V]: + return FrozenDefaultDict( + {callable(k): v for k, v in self.items()}, + default_factory=self._default_factory, + ) diff --git a/_modules/tqec/plaquette/plaquette.html b/_modules/tqec/plaquette/plaquette.html index 76b14e16..e368454c 100644 --- a/_modules/tqec/plaquette/plaquette.html +++ b/_modules/tqec/plaquette/plaquette.html @@ -86,7 +86,7 @@

Source code for tqec.plaquette.plaquette

 import hashlib
 from collections import defaultdict
 from dataclasses import dataclass, field
-from typing import Mapping
+from typing import Callable, Mapping
 
 from typing_extensions import override
 
@@ -240,6 +240,9 @@ 

Source code for tqec.plaquette.plaquette

     ) -> Plaquettes:
         return Plaquettes(self.collection | plaquettes_to_update)
 
+    def map_indices(self, callable: Callable[[int], int]) -> Plaquettes:
+        return Plaquettes(self.collection.map_keys(callable))
+
     def __eq__(self, rhs: object) -> bool:
         return isinstance(rhs, Plaquettes) and self.collection == rhs.collection
 
diff --git a/_sources/_autosummary/tqec.plaquette.frozendefaultdict.FrozenDefaultDict.rst.txt b/_sources/_autosummary/tqec.plaquette.frozendefaultdict.FrozenDefaultDict.rst.txt
index abd46bb8..cdf243e9 100644
--- a/_sources/_autosummary/tqec.plaquette.frozendefaultdict.FrozenDefaultDict.rst.txt
+++ b/_sources/_autosummary/tqec.plaquette.frozendefaultdict.FrozenDefaultDict.rst.txt
@@ -18,6 +18,7 @@ tqec.plaquette.frozendefaultdict.FrozenDefaultDict
       ~FrozenDefaultDict.has_default_factory
       ~FrozenDefaultDict.items
       ~FrozenDefaultDict.keys
+      ~FrozenDefaultDict.map_keys
       ~FrozenDefaultDict.values
    
    
diff --git a/_sources/_autosummary/tqec.plaquette.plaquette.Plaquettes.rst.txt b/_sources/_autosummary/tqec.plaquette.plaquette.Plaquettes.rst.txt
index 0512a94b..9b28574f 100644
--- a/_sources/_autosummary/tqec.plaquette.plaquette.Plaquettes.rst.txt
+++ b/_sources/_autosummary/tqec.plaquette.plaquette.Plaquettes.rst.txt
@@ -14,6 +14,7 @@ tqec.plaquette.plaquette.Plaquettes
    .. autosummary::
    
       ~Plaquettes.__init__
+      ~Plaquettes.map_indices
       ~Plaquettes.repeat
       ~Plaquettes.with_updated_plaquettes
    
diff --git a/_sources/_autosummary/tqec.plaquette.plaquette.RepeatedPlaquettes.rst.txt b/_sources/_autosummary/tqec.plaquette.plaquette.RepeatedPlaquettes.rst.txt
index ac7c1172..aa56b1f3 100644
--- a/_sources/_autosummary/tqec.plaquette.plaquette.RepeatedPlaquettes.rst.txt
+++ b/_sources/_autosummary/tqec.plaquette.plaquette.RepeatedPlaquettes.rst.txt
@@ -14,6 +14,7 @@ tqec.plaquette.plaquette.RepeatedPlaquettes
    .. autosummary::
    
       ~RepeatedPlaquettes.__init__
+      ~RepeatedPlaquettes.map_indices
       ~RepeatedPlaquettes.num_rounds
       ~RepeatedPlaquettes.repeat
       ~RepeatedPlaquettes.with_updated_plaquettes
diff --git a/media/detectors/detector_computation_illustration.html b/media/detectors/detector_computation_illustration.html
index 021c117a..cfedd02f 100644
--- a/media/detectors/detector_computation_illustration.html
+++ b/media/detectors/detector_computation_illustration.html
@@ -264,8 +264,8 @@ 

Pre-computing flows" + "" ] }, "execution_count": 6, @@ -565,10 +565,10 @@ "execution_count": 7, "metadata": { "execution": { - "iopub.execute_input": "2024-10-22T06:26:28.507801Z", - "iopub.status.busy": "2024-10-22T06:26:28.507472Z", - "iopub.status.idle": "2024-10-22T06:26:28.511497Z", - "shell.execute_reply": "2024-10-22T06:26:28.510905Z" + "iopub.execute_input": "2024-10-22T07:35:36.351979Z", + "iopub.status.busy": "2024-10-22T07:35:36.351570Z", + "iopub.status.idle": "2024-10-22T07:35:36.355561Z", + "shell.execute_reply": "2024-10-22T07:35:36.354983Z" } }, "outputs": [ @@ -587,7 +587,7 @@ " " ], "text/plain": [ - "" + "" ] }, "execution_count": 7, @@ -633,10 +633,10 @@ "execution_count": 8, "metadata": { "execution": { - "iopub.execute_input": "2024-10-22T06:26:28.513413Z", - "iopub.status.busy": "2024-10-22T06:26:28.512998Z", - "iopub.status.idle": "2024-10-22T06:26:28.516826Z", - "shell.execute_reply": "2024-10-22T06:26:28.516376Z" + "iopub.execute_input": "2024-10-22T07:35:36.357335Z", + "iopub.status.busy": "2024-10-22T07:35:36.357050Z", + "iopub.status.idle": "2024-10-22T07:35:36.360824Z", + "shell.execute_reply": "2024-10-22T07:35:36.360360Z" } }, "outputs": [ @@ -655,7 +655,7 @@ " " ], "text/plain": [ - "" + "" ] }, "execution_count": 8, @@ -707,10 +707,10 @@ "execution_count": 9, "metadata": { "execution": { - "iopub.execute_input": "2024-10-22T06:26:28.518670Z", - "iopub.status.busy": "2024-10-22T06:26:28.518310Z", - "iopub.status.idle": "2024-10-22T06:26:28.522031Z", - "shell.execute_reply": "2024-10-22T06:26:28.521580Z" + "iopub.execute_input": "2024-10-22T07:35:36.362740Z", + "iopub.status.busy": "2024-10-22T07:35:36.362406Z", + "iopub.status.idle": "2024-10-22T07:35:36.366338Z", + "shell.execute_reply": "2024-10-22T07:35:36.365844Z" } }, "outputs": [ @@ -729,7 +729,7 @@ " " ], "text/plain": [ - "" + "" ] }, "execution_count": 9, @@ -774,10 +774,10 @@ "execution_count": 10, "metadata": { "execution": { - "iopub.execute_input": "2024-10-22T06:26:28.523842Z", - "iopub.status.busy": "2024-10-22T06:26:28.523488Z", - "iopub.status.idle": "2024-10-22T06:26:28.560994Z", - "shell.execute_reply": "2024-10-22T06:26:28.560340Z" + "iopub.execute_input": "2024-10-22T07:35:36.368126Z", + "iopub.status.busy": "2024-10-22T07:35:36.367792Z", + "iopub.status.idle": "2024-10-22T07:35:36.398017Z", + "shell.execute_reply": "2024-10-22T07:35:36.397536Z" } }, "outputs": [], @@ -802,10 +802,10 @@ "execution_count": 11, "metadata": { "execution": { - "iopub.execute_input": "2024-10-22T06:26:28.563165Z", - "iopub.status.busy": "2024-10-22T06:26:28.562826Z", - "iopub.status.idle": "2024-10-22T06:26:28.566697Z", - "shell.execute_reply": "2024-10-22T06:26:28.566206Z" + "iopub.execute_input": "2024-10-22T07:35:36.400146Z", + "iopub.status.busy": "2024-10-22T07:35:36.399678Z", + "iopub.status.idle": "2024-10-22T07:35:36.403274Z", + "shell.execute_reply": "2024-10-22T07:35:36.402715Z" } }, "outputs": [ @@ -848,10 +848,10 @@ "execution_count": 12, "metadata": { "execution": { - "iopub.execute_input": "2024-10-22T06:26:28.568627Z", - "iopub.status.busy": "2024-10-22T06:26:28.568297Z", - "iopub.status.idle": "2024-10-22T06:26:28.578516Z", - "shell.execute_reply": "2024-10-22T06:26:28.577911Z" + "iopub.execute_input": "2024-10-22T07:35:36.405126Z", + "iopub.status.busy": "2024-10-22T07:35:36.404765Z", + "iopub.status.idle": "2024-10-22T07:35:36.414270Z", + "shell.execute_reply": "2024-10-22T07:35:36.413785Z" } }, "outputs": [ @@ -899,10 +899,10 @@ "execution_count": 13, "metadata": { "execution": { - "iopub.execute_input": "2024-10-22T06:26:28.580622Z", - "iopub.status.busy": "2024-10-22T06:26:28.580257Z", - "iopub.status.idle": "2024-10-22T06:26:28.585156Z", - "shell.execute_reply": "2024-10-22T06:26:28.584613Z" + "iopub.execute_input": "2024-10-22T07:35:36.416076Z", + "iopub.status.busy": "2024-10-22T07:35:36.415742Z", + "iopub.status.idle": "2024-10-22T07:35:36.420561Z", + "shell.execute_reply": "2024-10-22T07:35:36.420032Z" } }, "outputs": [