Skip to content

Conversation

@WeiguoMa
Copy link
Contributor

No description provided.

@WeiguoMa WeiguoMa marked this pull request as ready for review August 14, 2025 09:24
@WeiguoMa WeiguoMa marked this pull request as draft August 14, 2025 09:26
import networkx as nx
import numpy as np
import tensorflow as tf

Copy link
Member

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

c.exp( # type: ignore
i,
(i + 1) % 10,
unitary=array_to_tensor(G._swap_matrix),
Copy link
Member

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,
Copy link
Member

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

mpogates = mpogates
gate_aliases = gate_aliases

def _validate_dim(self, dim: Optional[int]) -> None:
Copy link
Member

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
Copy link
Member

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)
Copy link
Member

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:
Copy link
Member

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:
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants