Skip to content

Comments

Implement Gates and Circuit#73

Merged
masa10-f merged 36 commits intomasterfrom
gates
Aug 1, 2025
Merged

Implement Gates and Circuit#73
masa10-f merged 36 commits intomasterfrom
gates

Conversation

@masa10-f
Copy link
Collaborator

Before submitting, please check the following:

  • Make sure you have tests for the new code and that test passes (run pytest)
  • If applicable, add a line to the [unreleased] part of CHANGELOG.md, following keep-a-changelog.
  • Format added code by ruff
  • Type checking by mypy and pyright
  • Make sure the checks (github actions) pass.
  • Check that the docs compile without errors (run make html in ./docs/ - you may need to install dependency for sphinx docs, see docs/requirements.txt.)

Then, please fill in below:

Description of the change:

I have implemented

  • gates.py which has a variety of gate classes compatible with the qiskit gate convention.
  • Added Circuit module and converter to GraphState.

I have also implemented unit test for gates. A test for circuit will be implemented after implementing circuit simulator class.

Related issue:

@masa10-f masa10-f mentioned this pull request Jul 23, 2025
@masato-fuk
Copy link
Contributor

masato-fuk commented Jul 24, 2025

Remained task

  • resolve sphinx build error
  • check equations are properly build

@masato-fuk
Copy link
Contributor

I guess Circuit.apply_macro_gate is not a smart way......

@masa10-f masa10-f self-assigned this Jul 25, 2025
@masa10-f masa10-f marked this pull request as ready for review July 25, 2025 13:08
@masa10-f masa10-f requested a review from Copilot July 25, 2025 13:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a comprehensive quantum gate system and circuit representation for the graphix_zx library. The implementation includes both low-level unit gates (J, CZ, PhaseGadget) and high-level macro gates that decompose into unit gates, along with circuit classes to organize and execute quantum operations.

Key changes:

  • Added a complete gate hierarchy with abstract base classes and concrete implementations for common quantum gates
  • Implemented circuit classes to manage sequences of quantum operations
  • Added conversion functionality from circuits to graph states with gflow
  • Provided comprehensive unit tests to verify gate decompositions and matrix representations

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
graphix_zx/gates.py Implements the complete gate system with unit gates (J, CZ, PhaseGadget) and macro gates that decompose to unit gates
graphix_zx/circuit.py Provides circuit classes for organizing quantum operations and conversion to graph states
tests/test_gate.py Unit tests verifying gate decompositions match expected matrix representations
docs/source/circuit.rst Documentation for the new circuit and gate modules
docs/source/references.rst Updated documentation index to include circuit module
docs/source/matrix_utility.rst Minor documentation title correction

@masa10-f masa10-f requested a review from EarlMilktea July 25, 2025 13:14
@EarlMilktea
Copy link
Collaborator

@masa10-f

Could you first resolve basic unknown types (don't have to be all, it's impossible in the first place) reported by pyright to make my review smoother?

@masa10-f
Copy link
Collaborator Author

@EarlMilktea
I have resolved pyright information warnings in 0172358

@masa10-f masa10-f requested a review from EarlMilktea July 30, 2025 12:29
@masa10-f
Copy link
Collaborator Author

I have also added a test for circuit module in 29024b3

@masa10-f masa10-f requested a review from EarlMilktea August 1, 2025 05:04
@masa10-f masa10-f merged commit ae73570 into master Aug 1, 2025
20 checks passed
@masa10-f masa10-f deleted the gates branch August 1, 2025 22:33
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.

3 participants