Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate split dtype to join #817

Merged
merged 34 commits into from
Apr 10, 2024
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8d31061
Ensure dtypes get used when joining typed registers.
fdmalone Mar 21, 2024
e97cff3
Fix tests.
fdmalone Mar 22, 2024
bd8027e
Update for black?
fdmalone Mar 22, 2024
b15ce91
Ensure dtypes get used when joining typed registers.
fdmalone Mar 21, 2024
a937349
Fix tests.
fdmalone Mar 22, 2024
dae08f0
Update for black?
fdmalone Mar 22, 2024
f3eed5e
Don't rely on soq reg.
fdmalone Mar 22, 2024
776ec28
WIP testing.
fdmalone Mar 22, 2024
60183cd
Add bloq autotesting + update report card.
fdmalone Mar 22, 2024
b4e28ea
Merge branch 'propagate_split_dtype_to_join' of github.com:fdmalone/Q…
fdmalone Mar 22, 2024
019812b
Fix interop.
fdmalone Mar 24, 2024
8b2b1b5
Better typed show_bloqs.
fdmalone Mar 24, 2024
08b514b
Fixes.
fdmalone Mar 25, 2024
f01af84
Fix lint errors.
fdmalone Mar 25, 2024
7b42be7
Merge branch 'main' into propagate_split_dtype_to_join
fdmalone Mar 25, 2024
b49171e
Fix formatting.
fdmalone Mar 25, 2024
5d1adec
Fix test failures.
fdmalone Mar 25, 2024
da2f1b7
Fix formatting.
fdmalone Mar 25, 2024
819f9df
Merge branch 'main' into propagate_split_dtype_to_join
fdmalone Mar 29, 2024
6d9ab70
Merge branch 'main' into propagate_split_dtype_to_join
fdmalone Apr 5, 2024
1080ea1
Clean cirq_bloq_interop typing.
fdmalone Apr 5, 2024
7d10c75
Remove prints.
fdmalone Apr 5, 2024
281dcf8
Safer casting.
fdmalone Apr 5, 2024
b620f4f
Safer checking.
fdmalone Apr 6, 2024
c52390b
Remove print.
fdmalone Apr 6, 2024
2de1b34
Format / lint.
fdmalone Apr 6, 2024
2c79572
Only cast Fxp.
fdmalone Apr 6, 2024
f78ce7a
Custom hash for _QReg for single-qubit lookup.
fdmalone Apr 8, 2024
31519a8
Address review comments.
fdmalone Apr 10, 2024
bbf40c3
Add assertion.
fdmalone Apr 10, 2024
a8cc8be
Move location of assert.
fdmalone Apr 10, 2024
5259aa9
Merge branch 'main' into propagate_split_dtype_to_join
fdmalone Apr 10, 2024
86d4429
Move assert back.
fdmalone Apr 10, 2024
5ba5cb7
Merge branch 'propagate_split_dtype_to_join' of github.com:fdmalone/Q…
fdmalone Apr 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions qualtran/cirq_interop/_cirq_to_bloq.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,12 @@ def _ensure_in_reg_exists(
soqs_to_join[qreg.qubits[0]] = soq
elif len(in_reg_qubits) == 1 and qreg.qubits and qreg.qubits[0] in in_reg_qubits:
# Cast single QBit registers to the appropriate single-bit register dtype.
assert isinstance(
soq.reg.dtype, QBit
), f"Found non-QBit type register which shouldn't happen: {soq.reg.name} {soq.reg.dtype}"
if not isinstance(in_reg.dtype, QBit):
err_msg = (
"Found non-QBit type register which shouldn't happen: "
f"{soq.reg.name} {soq.reg.dtype}"
)
assert isinstance(soq.reg.dtype, QBit), err_msg
Copy link
Collaborator

Choose a reason for hiding this comment

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

The assertion probably does belon above since in both the if / else cases we assume that soq.reg.dtype is of type QBit ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Reverted

qreg_to_qvar[in_reg] = bb.add(Cast(QBit(), in_reg.dtype), reg=soq)
else:
qreg_to_qvar[qreg] = soq
Expand Down
Loading