Skip to content

Add C1PastCliffordNode#306

Merged
ihincks merged 9 commits intomainfrom
c1-past-clifford
Feb 23, 2026
Merged

Add C1PastCliffordNode#306
ihincks merged 9 commits intomainfrom
c1-past-clifford

Conversation

@joshuasn
Copy link
Collaborator

Summary

This PR adds C1PastCliffordNode, required for local Clifford twirling. The node works similarly to the PauliPastCliffordNode, except that the lookup tables contain a sentinel -1 where C1 x C1 are promoted to C2.

Details and comments

I used Claude Opus 4.6.

Copy link
Collaborator

@ihincks ihincks left a comment

Choose a reason for hiding this comment

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

LG, minor comments

return table


C1_PAST_CLIFFORD_LOOKUP_TABLES = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will increase import time. I'd be curious to see a benchmark to see if we want to hardcode lookup tables.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I hardcoded the lookup tables, it was ~0.02s faster.

Comment on lines +143 to +145
raise SamplexRuntimeError(
f"C1 values did not remain local after conjugation by {self._op_name!r}."
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We plan for build() to make this situation impossible, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah this shouldn't happen. With the way it's setup in in #308 the this is possible to hit if you have a left dressed box with one entangler then a right dressed box with another entangler both with different local C1 twirling groups.

from samplomatic.virtual_registers.c1_register import C1_TO_TABLEAU


class TestLookupTables:
Copy link
Collaborator

Choose a reason for hiding this comment

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

can this please be moved to test/unit/tables?

joshuasn and others added 3 commits February 23, 2026 14:57
Co-authored-by: Ian Hincks <ian.hincks@gmail.com>
Co-authored-by: Ian Hincks <ian.hincks@gmail.com>
@ihincks ihincks enabled auto-merge (squash) February 23, 2026 18:32
@ihincks ihincks merged commit 37e9a3c into main Feb 23, 2026
8 checks passed
@ihincks ihincks deleted the c1-past-clifford branch February 23, 2026 18:37
joshuasn added a commit that referenced this pull request Mar 6, 2026
## Summary

Following #306 and #307, this PR adds local Clifford twirling. This can
be enabled by setting the new `twirling_group` argument of the
`generate_preset_pass_manager` or the `group` argument of the `Twirl`
annotation to `local_c1`.

## Details and comments

A lot of the building stage is forward looking to support RZZ twirling.
As the two-qubit entanglers are Hermitian, there is a single local C1
subgroup. For non-Hermitian gates, we can do the same thing but would
need different subgroups for left- and right-dressed boxes.

I used Claude Ops 4.6.

---------

Co-authored-by: Ian Hincks <ian.hincks@gmail.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.

2 participants