Skip to content

Refactor BaseM #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions graphix/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,19 @@ class N(_KindChecker):


@dataclasses.dataclass
class M(_KindChecker):
"""Measurement command. By default the plane is set to 'XY', the angle to 0, empty domains and identity vop."""
class BaseM:
"""Base class for measurement command.

This class does not contain any data except for the node to measure.
"""
Comment on lines +54 to +58
Copy link
Contributor

@thierry-martinez thierry-martinez Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation added in commit ad18270 and later deleted in #205 was more informative. I believe we should revert to that version.

Suggested change
class BaseM:
"""Base class for measurement command.
This class does not contain any data except for the node to measure.
"""
class BaseM:
"""Base measurement command.
Represent a measurement of a node. In MBQC, a measure is an instance of `M`,
with given plane, angles, and domains. In the context of blind computations,
the server only knows which node is measured, and the parameters are given
by the :class:`graphix.simulator.MeasureMethod` provided by the client.
"""

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally trimmed them to ensure that no outdated info. is left.
Of course willing to revert to the original after discussion.


node: Node


@dataclasses.dataclass
class M(BaseM, _KindChecker):
"""Measurement command. By default the plane is set to 'XY', the angle to 0, empty domains and identity vop."""

plane: Plane = Plane.XY
angle: float = 0.0
s_domain: set[Node] = dataclasses.field(default_factory=set)
Expand Down Expand Up @@ -137,8 +146,6 @@ class T(_KindChecker):
Command = Union[N, M, E, C, X, Z, S, T]
Correction = Union[X, Z]

BaseM = M


@dataclasses.dataclass
class MeasureUpdate:
Expand Down
Loading