Results 121 comments of Dax Fohl

Turns out this was a bug in `align_right`, not related to simulation or circuit construction.

> which must include all the ancillae The word "must" could mean different things here. Should this be interpreted as "it needs to (but it doesn't)" or "it seems to...

Okay, so is it that cirq's `all_qubits` includes ancillae by default, and needs a flag to exclude them? Or is it that the conversion from qualtran format to cirq format...

FWIW I've been thinking the same thing for Cirq. Things like `ControlledGate(CZ, [1,1,1])` end up being a pain in decomposition and require special handling in `ControlledGate._decompose_`, which could be avoided...

Yeah I was thinking in Cirq it might be nice to have a `canonicalize` method on `ControlledGate` that would return `self.subgate.controlled(self.controls)`. Especially in decomposition, we could try that first, which...

With the flurry of these, I went through my PRs and labeled everything that could possibly be considered breaking, and added a comment to each summarizing the change: https://github.com/pulls?q=repo%3Aquantumlib%2FCirq+author%3Adaxfohl+merged%3A%3E2024+label%3A%22BREAKING+CHANGE%22. I...

I think this is here: https://github.com/quantumlib/Cirq/blob/d74e0dce73adf45f15b873bf28236ef355d960ce/cirq-core/cirq/sim/simulator.py#L986-L992 This is the code that splits the circuit into a unitary ("predicate/matching") prefix and a non-unitary suffix, so that the result of the unitary...

I was going to say an even easier fix would be to ensure anything that touches a measurement key should go in the suffix. But it turns out that's actually...

The reason is in that quote. So for example, if you run a simulation with 100 iterations of a unitary circuit with terminal measurements, then this splitting up allows it...

I'm pretty sure the problem is here: https://github.com/quantumlib/Qualtran/blob/a49abdcb6727d8d83a96fb1b19ef93cf57e10fcc/qualtran/bloqs/arithmetic/addition.py#L162 https://github.com/quantumlib/Qualtran/blob/a49abdcb6727d8d83a96fb1b19ef93cf57e10fcc/qualtran/bloqs/arithmetic/addition.py#L175 Python doesn't have tail-call optimization, so this is just going to push every recursive call onto the stack. Obviously with large...