Skip to content

Commit 0343b6b

Browse files
optimize stabilizer circuit gate application
1 parent 9d95a9f commit 0343b6b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

tensorcircuit/fgs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def onehot_matrix(i: int, j: int, N: int) -> Tensor:
2828

2929
# TODO(@refraction-ray): efficiency benchmark with jit
3030
# TODO(@refraction-ray): FGS mixed state support?
31-
# TODO(@refraction-ray): overlap?
3231
# TODO(@refraction-ray): fermionic logarithmic negativity
3332

3433

tensorcircuit/stabilizercircuit.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,12 @@ def apply_general_gate(
9696

9797
if name.lower() in self.gate_map:
9898
# self._stim_circuit.append(gate_map[name.lower()], list(index))
99-
instruction = f"{self.gate_map[name.lower()]} {' '.join(map(str, index))}"
99+
gn = self.gate_map[name.lower()]
100+
instruction = f"{gn} {' '.join(map(str, index))}"
100101
self._stim_circuit.append_from_stim_program_text(instruction)
101102
# append is much slower
102-
self.current_sim.do(stim.Circuit(instruction))
103+
# self.current_sim.do(stim.Circuit(instruction))
104+
getattr(self.current_sim, gn.lower())(*index)
103105
else:
104106
raise ValueError(f"Gate {name} is not supported in stabilizer simulation")
105107

0 commit comments

Comments
 (0)