Skip to content

PBC transformations for C#15756

Merged
alexanderivrii merged 9 commits intoQiskit:mainfrom
Cryoris:pbc-trafo-for-c
Mar 18, 2026
Merged

PBC transformations for C#15756
alexanderivrii merged 9 commits intoQiskit:mainfrom
Cryoris:pbc-trafo-for-c

Conversation

@Cryoris
Copy link
Copy Markdown
Collaborator

@Cryoris Cryoris commented Mar 5, 2026

Summary

Adds the Litinski transformation to the C API, via qk_transpiler_pass_standalone_litinski_transformation. Depending on when #15502 merges, we can also add that pass to the C API for feature parity here.

Details and comments

Based on top of #15720 and #15754.

The logic is quite straightforward, the main additions are in the tests. We might want to add some simpler way of constructing PBC circuits than with the ZX arrays, similar as the test does here.

@Cryoris Cryoris added this to the 2.4.0 milestone Mar 5, 2026
@Cryoris Cryoris requested a review from a team as a code owner March 5, 2026 01:51
@Cryoris Cryoris added Changelog: Added Add an "Added" entry in the GitHub Release changelog. C API Related to the C API fault tolerance related to fault tolerance compilation labels Mar 5, 2026
@github-project-automation github-project-automation Bot moved this to Ready in Qiskit 2.4 Mar 5, 2026
@qiskit-bot
Copy link
Copy Markdown
Collaborator

One or more of the following people are relevant to this code:

  • @Cryoris
  • @Qiskit/terra-core
  • @ajavadia
  • @mtreinish

@jakelishman
Copy link
Copy Markdown
Member

Quick q: how tf did we manage to trigger an Azure failure on this PR? hahaha

@Cryoris
Copy link
Copy Markdown
Collaborator Author

Cryoris commented Mar 5, 2026

Very good question lol, it says it's a merge conflict but that would look differently, no?

@ShellyGarion
Copy link
Copy Markdown
Member

would you like to update this PR following #15502 ?

Copy link
Copy Markdown
Member

@ShellyGarion ShellyGarion left a comment

Choose a reason for hiding this comment

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

Some minor comments on the names.

Comment thread crates/cext/src/transpiler/passes/convert_to_pbc.rs Outdated
Comment thread crates/cext/src/transpiler/passes/convert_to_pauli_rotations.rs
Comment thread crates/cext/src/transpiler/passes/mod.rs Outdated
Comment thread test/c/test_pbc.c
Comment thread crates/cext/src/transpiler/passes/litinski_transformation.rs Outdated
Ok(dag) => dag,
Err(_) => panic!("Internal Circuit -> DAG conversion failed"),
};
// TODO: Potentially propagate exit code to the user
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is this still a TODO ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yep, but this is for after this PR since it requires changing different files to return other things than PyResult

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this TODO comment helps for now, so I am in favor of removing it.

Comment thread releasenotes/notes/pbc-transformations-c-7dc8230831d133c3.yaml
Comment thread test/c/test_pbc.c Outdated
Comment thread crates/cext/src/circuit_library/pbc.rs Outdated
Comment thread crates/cext/src/circuit_library/pbc.rs Outdated
Comment thread crates/cext/src/circuit.rs Outdated
Comment thread test/c/test_circuit.c Outdated
@ShellyGarion
Copy link
Copy Markdown
Member

Note: this PR should be updated after #15690 is merged!

@Cryoris
Copy link
Copy Markdown
Collaborator Author

Cryoris commented Mar 11, 2026

FYI I'll wait on updating this PR until after #15754 is merged to avoid further mixups

Comment thread crates/cext/src/transpiler/passes/litinski_transformation.rs Outdated
Comment thread crates/cext/src/transpiler/passes/convert_to_pbc.rs Outdated
Copy link
Copy Markdown
Member

@alexanderivrii alexanderivrii left a comment

Choose a reason for hiding this comment

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

Thanks Julien. I especially like the C-based testing. Left a few small comments.

Comment thread crates/cext/src/transpiler/passes/litinski_transformation.rs
Comment thread crates/cext/src/transpiler/passes/litinski_transformation.rs Outdated
Ok(dag) => dag,
Err(_) => panic!("Internal Circuit -> DAG conversion failed"),
};
// TODO: Potentially propagate exit code to the user
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this TODO comment helps for now, so I am in favor of removing it.

Comment thread crates/cext/src/transpiler/passes/convert_to_pauli_rotations.rs
Comment thread test/c/test_pbc.c
Comment thread test/c/test_pbc.c Outdated
Comment thread test/c/test_pbc.c Outdated
Comment thread test/c/test_pbc.c Outdated
Comment thread test/c/test_pbc.c Outdated
Comment thread test/c/test_pbc.c Outdated
- additional test if litinski is noop
- update test names
- remove some idle code
Copy link
Copy Markdown
Member

@alexanderivrii alexanderivrii left a comment

Choose a reason for hiding this comment

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

Thanks for quick updates, LGTM!

@alexanderivrii alexanderivrii added this pull request to the merge queue Mar 18, 2026
Merged via the queue into Qiskit:main with commit dd994d0 Mar 18, 2026
25 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to Done in Qiskit 2.4 Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C API Related to the C API Changelog: Added Add an "Added" entry in the GitHub Release changelog. fault tolerance related to fault tolerance compilation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants