Skip to content

Commit

Permalink
♻️ Use NamedTuple
Browse files Browse the repository at this point in the history
  • Loading branch information
EarlMilktea committed Nov 1, 2024
1 parent 611075d commit 65de939
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions graphix/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import dataclasses
import math
from typing import NamedTuple

from graphix import utils
from graphix.fundamentals import Axis, Plane, Sign
Expand All @@ -17,8 +18,7 @@ class Domains:
t_domain: set[int]


@dataclasses.dataclass(frozen=True)
class Measurement:
class Measurement(NamedTuple):
"""An MBQC measurement.
:param angle: the angle of the measurement. Should be between [0, 2)
Expand All @@ -45,8 +45,7 @@ def isclose(self, other: Measurement, rel_tol: float = 1e-09, abs_tol: float = 0
return math.isclose(self.angle, other.angle, rel_tol=rel_tol, abs_tol=abs_tol) and self.plane == other.plane


@dataclasses.dataclass(frozen=True)
class PauliMeasurement:
class PauliMeasurement(NamedTuple):
"""Pauli measurement."""

axis: Axis
Expand Down

0 comments on commit 65de939

Please sign in to comment.