Skip to content

Commit

Permalink
better format
Browse files Browse the repository at this point in the history
  • Loading branch information
ziofil committed Nov 14, 2024
1 parent c57a72f commit a63c66f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 47 deletions.
52 changes: 6 additions & 46 deletions mrmustard/physics/new_wires.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,62 +230,22 @@ def __init__(
self.classical_wires = set()

for i, m in enumerate(sorted(modes_out_bra)):
self.quantum_wires.add(
QuantumWire(
mode=m,
is_out=True,
is_ket=False,
index=i,
)
)
self.quantum_wires.add(QuantumWire(mode=m, is_out=True, is_ket=False, index=i))
n = len(modes_out_bra)
for i, m in enumerate(sorted(modes_in_bra)):
self.quantum_wires.add(
QuantumWire(
mode=m,
is_out=False,
is_ket=False,
index=n + i,
)
)
self.quantum_wires.add(QuantumWire(mode=m, is_out=False, is_ket=False, index=n + i))
n += len(modes_in_bra)
for i, m in enumerate(sorted(modes_out_ket)):
self.quantum_wires.add(
QuantumWire(
mode=m,
is_out=True,
is_ket=True,
index=n + i,
)
)
self.quantum_wires.add(QuantumWire(mode=m, is_out=True, is_ket=True, index=n + i))
n += len(modes_out_ket)
for i, m in enumerate(sorted(modes_in_ket)):
self.quantum_wires.add(
QuantumWire(
mode=m,
is_out=False,
is_ket=True,
index=n + i,
)
)
self.quantum_wires.add(QuantumWire(mode=m, is_out=False, is_ket=True, index=n + i))
n += len(modes_in_ket)
for i, m in enumerate(sorted(classical_out)):
self.classical_wires.add(
ClassicalWire(
mode=m,
is_out=True,
index=n + i,
)
)
self.classical_wires.add(ClassicalWire(mode=m, is_out=True, index=n + i))
n += len(classical_out)
for i, m in enumerate(sorted(classical_in)):
self.classical_wires.add(
ClassicalWire(
mode=m,
is_out=False,
index=n + i,
)
)
self.classical_wires.add(ClassicalWire(mode=m, is_out=False, index=n + i))

def copy(self) -> Wires:
return deepcopy(self)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_physics/test_wires.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import pytest
from ipywidgets import HTML

from mrmustard.physics.new_wires import Wires, Repr
from mrmustard.physics.new_wires import Repr, Wires


class TestWires:
Expand Down

0 comments on commit a63c66f

Please sign in to comment.