-
Notifications
You must be signed in to change notification settings - Fork 11
PR Draft for Qudit inferface #31
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
base: master
Are you sure you want to change the base?
Conversation
@@ -13,7 +13,8 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is very old and deprecated, so no need to take care of the module
@@ -217,15 +217,15 @@ def train_qml_vag( | |||
c.exp( # type: ignore | |||
i, | |||
(i + 1) % 10, | |||
unitary=array_to_tensor(G._swap_matrix), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same to this file, no need to care about files in applications
self, nqubits: int, inputs: Tensor = None, tableau_inputs: Tensor = None | ||
self, | ||
nqubits: int, | ||
dim: Optional[int] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn;t support qudit anyway,no need to add
@@ -79,6 +51,31 @@ class AbstractCircuit: | |||
mpogates = mpogates | |||
gate_aliases = gate_aliases | |||
|
|||
def _validate_dim(self, dim: Optional[int]) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is set dim instead of validate dim?
from . import gates | ||
|
||
gmod = gates.get_gate_module(int(getattr(self, "_d", 2))) | ||
self._gmod = gmod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the circuit class should be tested with python multiprocessing, to see whether there is subtle issues
for g in sgates: | ||
setattr( | ||
cls, g, cls.apply_general_gate_delayed(gatef=getattr(gates, g), name=g) | ||
cls, g, cls.apply_general_gate_delayed(gatef=cls._named_stub(g), name=g) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this for, _named_stub always raise error?
# --- Default behavior: Register and export qubit gates when importing tensorcircuit.gates --- | ||
try: | ||
_DEFAULT_GATE_MODULE: types.ModuleType = set_gates_for(2, export=True) | ||
except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
catch what exception here?
return mod | ||
|
||
|
||
def set_gates_for(dim: Optional[int] = None, export: bool = True) -> types.ModuleType: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont allow export for clarity? the qudit gates can only be accessed from a predefined variable assigned by set_gates_for instead of global export, so that we can avoid global namesapce rewriting
No description provided.