Find file History
Strilanc and CirqBot Polish kak output and refactor optimizer package layout (#1155)
- Merge cirq/google/ and cirq/ into cirq/optimizers/
- Move cirq/ into cirq/optimizers
- Fix kak decomposition not optimizing single-qubit gates it outputs
- Refactor MergeSingleQubitGates to take flexible arguments
- Refactor into cirq.merge_single_qubit_gates_into_phased_x_z using cirq.MergeSingleQubitGates
- Simplify imports in several cirq/optimizers files
- Use `Callable[[Circuit], None]` instead of `cirq.Optimizer` in a few places (will eventually delete `cirq.Optimizer`, which is a contentless class)
- Delete some unused decomposition methods (controlled operation to gates)

Example code:

import cirq
c = cirq.Circuit.from_ops(cirq.CNOT(*cirq.LineQubit.range(2))) 


0: ───Z^0.75────X^0.5────S^-1───Y^-0.5───@───S^-1───Y^0.5───Y^0.5─────Z^-0.75───
1: ───X^-0.25───Y^-0.5───────────────────@───S^-1───Y^0.5───X^-0.25─────────────

0: ───────────────────────@──────────────────────
1: ───PhasedX(-0.5)^0.5───@───PhasedX(0.5)^0.5───

Still not perfect; the `PhasedX` is so close to a `Y` that it should probably round. But overall fine.
Latest commit 278f958 Nov 20, 2018


The software in this directory (Cirq/examples/) is not included in the packaged library. Anyone is free to copy, modify, use, or publish this example code.