Commit d2f8baa
authored
Fix
`Identity` is a special bloq: its controlled version is still an
identity, but with a larger register, ie. calling
`Identity(n).controlled(CtrlSpec(QAny(m)))` gets us `Identity(n+m)`
The old version of `ctrl_adder()` was using `Autopartition` which failed
during decomposition as `Autopartition` is not designed to merge
registers and pass them to the inner bloq.
This is fixed by this PR by replacing `Autopartition` with
`Partition(s)`.
This fix is functional but the resulting `show_bloq()` output is less
clean as the Partition steps are visible. An alternative (maybe better)
fix is to keep using `Autopartition` but mark the control registers as
`Unused()`, but It is weird conceptually to not use Identity(n+m) as the
controlled Identity.
This PR also adds a test covering this bug.Identity's ctrl_adder (#1781)1 parent a897b34 commit d2f8baa
2 files changed
Lines changed: 25 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
119 | | - | |
| 120 | + | |
120 | 121 | | |
121 | | - | |
122 | | - | |
123 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
124 | 131 | | |
125 | 132 | | |
126 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
109 | 122 | | |
110 | 123 | | |
111 | 124 | | |
0 commit comments