Skip to content

Fix Hadamard gate docstrings and type hints#317

Open
yurekami wants to merge 1 commit into
mit-han-lab:mainfrom
yurekami:fix/issue-306-hadamard-docstrings
Open

Fix Hadamard gate docstrings and type hints#317
yurekami wants to merge 1 commit into
mit-han-lab:mainfrom
yurekami:fix/issue-306-hadamard-docstrings

Conversation

@yurekami
Copy link
Copy Markdown

Summary

  • Fix hadamard() and shadamard() docstrings: Changed wires type from Union[List[int], int] to int since these are single-qubit gates (num_wires = 1)
  • Fix chadamard() docstring: Clarified it's a controlled gate requiring a list of 2 qubits (control and target)
  • Fix bug: chadamard() was referencing undefined mat_dict instead of _hadamard_mat_dict

Test plan

  • Verify type hints match the num_wires attribute in class definitions
  • Run existing tests to ensure no regressions

Fixes #306

🤖 Generated with Claude Code

- hadamard(): Change wires type from Union[List[int], int] to int
  (single-qubit gate)
- shadamard(): Change wires type from Union[List[int], int] to int
  (single-qubit gate)
- chadamard(): Change wires type to List[int] and update docstring
  to clarify it's a controlled gate requiring 2 qubits
- Fix bug: chadamard() was using undefined mat_dict instead of
  _hadamard_mat_dict

Fixes mit-han-lab#306

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

Hadamard gate on multiple wires causes error

1 participant