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

cirq.unitary does not work for controlled QubitizationWalkOperator operator #1495

Open
anurudhp opened this issue Nov 12, 2024 · 0 comments
Open
Labels
bug Something isn't working cirq_interop Issues related to Cirq interop

Comments

@anurudhp
Copy link
Contributor

example code:

import cirq
from qualtran.bloqs.for_testing.qubitization_walk_test import get_uniform_pauli_qubitized_walk

_, walk = get_uniform_pauli_qubitized_walk(4)
bloq = walk.controlled()

cbloq = bloq.as_composite_bloq()

sim = cirq.Simulator()
_ = sim.simulate(cbloq.to_cirq_circuit())

raises

TypeError: Simulator doesn't support Controlled(subbloq=QubitizationWalkOperator(block_encoding=SelectBlockEncoding(select=SelectPauliLCU(selection_bitsize=2, target_bitsize=4, select_unitaries=(cirq.DensePauliString('XYII', coefficient=(1+0j)), cirq.DensePauliString('IYZI', coefficient=(1+0j)), cirq.DensePauliString('IIZX', coefficient=(1+0j)), cirq.DensePauliString('YIIX', coefficient=(1+0j))), control_val=None), prepare=PrepareUniformSuperpositionTest(n=4, cvs=(), qlambda=4.0))), ctrl_spec=CtrlSpec(qdtypes=(QBit(),), cvs=(array(1),))).on(cirq.NamedQubit('ctrl'), cirq.NamedQubit('selection0'), cirq.NamedQubit('selection1'), cirq.NamedQubit('target0'), cirq.NamedQubit('target1'), cirq.NamedQubit('target2'), cirq.NamedQubit('target3'))

But decomposing once results in a simulable circuit:

_ = sim.simulate(cbloq.flatten_once().to_cirq_circuit())

I suspect it is some interop issue b/w cirq and GateWithRegisters. Could be related to #1488

@mpharrigan mpharrigan added bug Something isn't working cirq_interop Issues related to Cirq interop labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cirq_interop Issues related to Cirq interop
Projects
None yet
Development

No branches or pull requests

2 participants