Skip to content

Comments

Implement Feedforward modules#40

Merged
masa10-f merged 24 commits intomasterfrom
feedforward
May 1, 2025
Merged

Implement Feedforward modules#40
masa10-f merged 24 commits intomasterfrom
feedforward

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:

Added feedforward.py and focus_flow.py modules.

The former provides type aliases of feedforward mapping and some utility functions. The latter offers gflow focusing algorithm.

Related issue:

@masa10-f masa10-f self-assigned this Apr 25, 2025
@masa10-f masa10-f added the enhancement New feature or request label Apr 25, 2025
@masa10-f masa10-f mentioned this pull request Apr 7, 2025
@masa10-f masa10-f requested a review from Copilot April 26, 2025 13:17
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 introduces two new modules to support feedforward corrections and a focusing algorithm while adding a new utility function to compute odd neighbors in a graph state.

  • Added odd_neighbors in graphstate.py to compute the symmetric difference of neighboring nodes.
  • Implemented focus_flow.py with functions is_focused and focus_gflow to process flowlike objects.
  • Added feedforward.py which provides type aliases and helper functions for feedforward correction and causality checking.

Reviewed Changes

Copilot reviewed 3 out of 7 changed files in this pull request and generated no comments.

File Description
graphix_zx/graphstate.py Added the odd_neighbors function to compute odd neighboring nodes.
graphix_zx/focus_flow.py Implemented focus flow algorithm using graph state information.
graphix_zx/feedforward.py Provided feedforward correction functions and related type aliases.
Files not reviewed (4)
  • docs/source/feedforward.rst: Language not supported
  • docs/source/focus_flow.rst: Language not supported
  • docs/source/graphstate.rst: Language not supported
  • docs/source/references.rst: Language not supported
Comments suppressed due to low confidence (3)

graphix_zx/graphstate.py:848

  • [nitpick] The local variable name 'odd_neighbors' in the odd_neighbors function shadows the function name and might be unclear. Consider renaming it (e.g., 'result') or adding a clarifying comment.
        odd_neighbors ^= graphstate.neighbors(node)

graphix_zx/focus_flow.py:200

  • [nitpick] The use of the symmetric difference assignment (^=) on gflow[target] may be non-intuitive. Adding a comment to explain the intended operation could improve readability.
    gflow[target] ^= gflow[minimal_in_s_k]

graphix_zx/focus_flow.py:1

  • The focus flow algorithm is a key new component; ensure that comprehensive tests are added to cover both typical and edge-case scenarios.
'''Focus flow algorithm.

@masa10-f masa10-f marked this pull request as ready for review April 26, 2025 13:59
@masa10-f masa10-f requested a review from EarlMilktea April 30, 2025 01:14
@masa10-f masa10-f merged commit 1042405 into master May 1, 2025
21 checks passed
@masa10-f masa10-f deleted the feedforward branch May 1, 2025 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants