{"push_id":4096023810,"size":58,"distinct_size":2,"ref":"refs/heads/commute","head":"ed33c9f6e561832170695ff4044656b9b76da555","before":"455622771fb7e8bb6f923024f99f6a89582d4b5e","commits":[{"sha":"8481f78b468c6335b1ba3b5cfeee457246d4feda","author":{"name":"Craig Gidney","email":"31271383ec794216294f53c566356fa369f09530@google.com"},"message":"Add `cirq.scatter_plot_normalized_kak_interaction_coefficients` (#2117)\n\nThis PR also:\r\n\r\n- Marks `plt.show()` lines as not needing to be covered\r\n- Fixes a deprecation warning w.r.t. `np.asscalar`\r\n- Allows `plt.show()` to be called in doctested example code\r\n- Allows `cirq.kak_decompose` to be called on objects with a `_unitary_` method, such as `cirq.Circuit`.\r\n\r\nPlotting KAK interaction coefficients visually is something I've found really handy for understanding two qubit operation decomposition. I put together this flexible method for doing so.\r\n\r\nExample:\r\n\r\n```python\r\nimport cirq\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\n\r\nax = None\r\nfor y in np.linspace(0, 0.5, 10):\r\n    a, b = cirq.LineQubit.range(2)\r\n    circuits = [\r\n        cirq.Circuit.from_ops(\r\n            cirq.CZ(a, b)**0.5,\r\n            cirq.X(a)**y, cirq.X(b)**x,\r\n            cirq.CZ(a, b)**0.5,\r\n            cirq.X(a)**x, cirq.X(b)**y,\r\n            cirq.CZ(a, b) ** 0.5,\r\n        )\r\n        for x in np.linspace(0, 1, 100)\r\n    ]\r\n\r\n    ax = cirq.scatter_plot_normalized_kak_interaction_coefficients(\r\n        circuits,\r\n        s=1,\r\n        ax=ax,\r\n        include_frame=ax is None,\r\n        label=f'y={y:0.2f}')\r\nax.legend()\r\nplt.show()\r\n```\r\n\r\n![image](https://user-images.githubusercontent.com/79941/65005029-5c40b180-d8b3-11e9-8393-25a5c5bde871.png)\r\n\r\n![image](https://user-images.githubusercontent.com/79941/65005043-64005600-d8b3-11e9-9b05-efd8c7155cde.png)","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/8481f78b468c6335b1ba3b5cfeee457246d4feda"},{"sha":"ab5f69be6369829f8651393377a08f727875b502","author":{"name":"Craig Gidney","email":"31271383ec794216294f53c566356fa369f09530@google.com"},"message":"Add cirq.ArithmeticOperation helper class (#2127)\n\nThis is a helper class to make it easier to implement arithmetic operations. These operations are not NISQ-y, but people have asked if cirq can do them efficiently a few times in the past. The answer was that it's *possible*, by implementing an `_apply_unitary_` operation, but it's not so convenient to write that method. Now we have a convenient way to do it.\r\n\r\nHere is how you would implement an adder using this class:\r\n\r\n```python\r\nclass Add(cirq.ArithmeticOperation):\r\n    def __init__(self, target_register, input_register):\r\n        self.target_register = target_register\r\n        self.input_register = input_register\r\n\r\n    def registers(self):\r\n        return self.target_register, self.input_register\r\n\r\n    def with_registers(self, *new_registers):\r\n        return Add(*new_registers)\r\n\r\n    def apply(self, target_value, input_value):\r\n        return target_value + input_value\r\n```\r\n\r\nThe fact that the output is an int instead of a list of two ints, and also that the output may be larger than the register range, is all fixed up automatically. int gets wrapped into List[int], List[int] gets padded up to max length assuming on changes in later registers, and each result gets modded into range. I originally tried a version with all these things explicit, but it was generally quite a pain to have to constantly deal with sizing and remembering to list unchanged values.\r\n\r\nA fun feature is that, because the input register is not modified (phase kickback notwithstanding), the input register can be set to a list of qubits *or* to a classical constant:\r\n\r\nWith a constant:\r\n\r\n```python\r\ncirq.unitary(\r\n    Add(target_register=cirq.LineQubit.range(2),\r\n        input_register=1))\r\n```\r\n\r\n```\r\n[[0, 0, 0, 1],\r\n [1, 0, 0, 0],\r\n [0, 1, 0, 0],\r\n [0, 0, 1, 0]]\r\n```\r\n\r\nWith another register:\r\n\r\n```python\r\nc = cirq.Circuit.from_ops(\r\n   cirq.X(cirq.LineQubit(3)),\r\n   cirq.X(cirq.LineQubit(2)),\r\n   cirq.X(cirq.LineQubit(6)),\r\n   cirq.measure(*cirq.LineQubit.range(4, 8), key='before:in'),\r\n   cirq.measure(*cirq.LineQubit.range(4), key='before:out'),\r\n\r\n   Add(target_register=cirq.LineQubit.range(4),\r\n       input_register=cirq.LineQubit.range(4, 8)),\r\n\r\n   cirq.measure(*cirq.LineQubit.range(4, 8), key='after:in'),\r\n   cirq.measure(*cirq.LineQubit.range(4), key='after:out'),\r\n)\r\nprint(cirq.sample(c).data)\r\n```\r\n\r\n```\r\n   before:in  before:out  after:in  after:out\r\n0          2           3         2          5\r\n```","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/ab5f69be6369829f8651393377a08f727875b502"},{"sha":"3c9c18fea7eb7e9d32abc7a4cb7ff36327fadd0f","author":{"name":"Kevin J. Sung","email":"684948d99c148f0e073889deb03df4da73485bfd@users.noreply.github.com"},"message":"Make Duration JSON serializable (#2130)\n\n* make duration JSON serializable\r\n\r\n* add test\r\n\r\n* run format script\r\n\r\n* format\r\n\r\n* fix json tests","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/3c9c18fea7eb7e9d32abc7a4cb7ff36327fadd0f"},{"sha":"aaaedbeac3c8bfe11281a3a8b0a52c3bc5d08f1e","author":{"name":"AJ Hanus","email":"5f8d23a750f45449df8ad09e5d106502c8ec9d04@gmail.com"},"message":"Added a docstring to paulistring module. (#2133)\n\nFixes: #2022","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/aaaedbeac3c8bfe11281a3a8b0a52c3bc5d08f1e"},{"sha":"cdf79fd1b11a070174eda5ab59354d246375f1c8","author":{"name":"Matthew Neeley","email":"335c91217492d9eb9b627f3f9ed5c8b84eacbcea@google.com"},"message":"Make sweepable.to_resolvers a generator (#2101)","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/cdf79fd1b11a070174eda5ab59354d246375f1c8"},{"sha":"284499ddf3b50faea1ac9a15e28bb6b9fe306d58","author":{"name":"KevinVillela","email":"ffb4761cba839470133bee36aeb139f58d7dbaa9@villela.com"},"message":"Implement Quantum Volume HOG portion (#2112)\n\n* Implement the Heavy Output Generation portion of the Quantum Volume benchmarking algorithm.\r\n\r\n* Formatting.\r\n\r\n* Update Copyright year to 2019\r\n\r\n* Fix heavy output set generator and add random seed arguments.\r\n\r\n* Small style changes\r\n\r\n* Formatting, jeeeeez.\r\n\r\n* Move to an examples/advanced directory and improve random seeding code\r\n\r\n* Remove math import\r\n\r\n* Moar updates to RNG\r\n\r\n* Convert amplitudes to probabilities\r\n\r\n* Change prob to amp","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/284499ddf3b50faea1ac9a15e28bb6b9fe306d58"},{"sha":"4a80184dc1a365bcad4b8014c3b0b2af6693702c","author":{"name":"MichaelBroughton","email":"19d455ae450ace6b94b70c64337f6094bdab51b3@users.noreply.github.com"},"message":"Add ability to slice sweeps (#2132)\n\nFixes #2106 .\r\nSince we are producing iterators, I found pythons `itertools.islice` will only allow for positive slicing/access indices. If we are OK producing and using lists I could quickly change things to allow for negative indices as well (the code would also be way shorter)","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/4a80184dc1a365bcad4b8014c3b0b2af6693702c"},{"sha":"2e6764360c3d3630f1395640f91de79687739b91","author":{"name":"Craig Gidney","email":"31271383ec794216294f53c566356fa369f09530@google.com"},"message":"Define cirq.Moment.__pow__ (#2136)\n\n- A moment has an powered version when each of its operations has a powered version\r\n- Rewrite circuit inverse to delegate to moment inverse\r\n- Move `cirq/protocols/inverse.py` to `cirq/protocols/inverse_protocol.py` to fix a mypy complaint","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/2e6764360c3d3630f1395640f91de79687739b91"},{"sha":"be1869ba6d4c086d59c92d67a5a18a055533efda","author":{"name":"Bryan A. O'Gorman","email":"648abcc0bd75493bf0731cf487517aa01d614680@gmail.com"},"message":"Create contrib/routing (#2087)","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/be1869ba6d4c086d59c92d67a5a18a055533efda"},{"sha":"d7f9210209e3a8aedef8a53e362ff8d6e56cacd3","author":{"name":"Nathan Shammah","email":"2bc0f52f302436b6603160ad2ba843ff06d77385@gmail.com"},"message":"Delete repeated `Product` import in `study/__init__.py` (#2145)\n\nRemove a repeated import for the `Product` class defined in `study/sweeps.py`.","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/d7f9210209e3a8aedef8a53e362ff8d6e56cacd3"},{"sha":"76fbe935f43e618a46bc99b02bba233b84b31f09","author":{"name":"Matthew Neeley","email":"335c91217492d9eb9b627f3f9ed5c8b84eacbcea@google.com"},"message":"Add OpTree protocol (#2140)\n\nDefining OP_TREE using a protocol lets us create a recursive type, which is not possible with type aliases alone. This means downstream operations can preserve more type information, which is good but reveals a problem with `flatten_op_tree` returning a Union type due to the `preserve_moments` option. To work around this I've split it up into two functions instead. Another possibility would be to remove the `preserve_moments` option on `flatten_op_tree` and just add a second function for the non-default case (which is a tiny minority of callsites).","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/76fbe935f43e618a46bc99b02bba233b84b31f09"},{"sha":"c599288cb55712435040c6e88ce4f3e9d15245c2","author":{"name":"Kevin J. Sung","email":"684948d99c148f0e073889deb03df4da73485bfd@users.noreply.github.com"},"message":"Make _NamedConstantXmonDevice JSON serializable (#2131)","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/c599288cb55712435040c6e88ce4f3e9d15245c2"},{"sha":"0b141c4871699a0810650b65fcd689976366049a","author":{"name":"Adam Zalcman","email":"6ea80763c35842cbde1a8536935b153f08a9c01b@users.noreply.github.com"},"message":"XEB fidelity estimator for large circuits (#2114)","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/0b141c4871699a0810650b65fcd689976366049a"},{"sha":"8b0b8473fa09e49786a8c94cf59b60e621df9103","author":{"name":"Adam Zalcman","email":"6ea80763c35842cbde1a8536935b153f08a9c01b@users.noreply.github.com"},"message":"Cleanup unused type imports (#2157)","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/8b0b8473fa09e49786a8c94cf59b60e621df9103"},{"sha":"10e03000f0ff0569df095350d737c437656135f7","author":{"name":"Kevin J. Sung","email":"684948d99c148f0e073889deb03df4da73485bfd@users.noreply.github.com"},"message":"Handle tuple input in cross entropy fidelity estimator (#2159)\n\nA tuple doesn't behave as desired when used as an index into a numpy array.","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/10e03000f0ff0569df095350d737c437656135f7"},{"sha":"40caeb8b0529bcfcd55e8ab710c961efc8d488d3","author":{"name":"Kevin J. Sung","email":"684948d99c148f0e073889deb03df4da73485bfd@users.noreply.github.com"},"message":"Allow random circuit generator to be seeded (#2155)","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/40caeb8b0529bcfcd55e8ab710c961efc8d488d3"},{"sha":"63556253e8ffc207ea5279fb7835a91df2c05b8e","author":{"name":"Kevin J. Sung","email":"684948d99c148f0e073889deb03df4da73485bfd@users.noreply.github.com"},"message":"Add atol parameter to wavefunction and density matrix utils (#2149)\n\nFixes #2148","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/63556253e8ffc207ea5279fb7835a91df2c05b8e"},{"sha":"0f8518cf6813040b43e8eb3778e8a7163d0b1230","author":{"name":"Kevin J. Sung","email":"684948d99c148f0e073889deb03df4da73485bfd@users.noreply.github.com"},"message":"Set PRNG to np.random if seed is None in cirq.testing.random_circuit (#2161)","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/0f8518cf6813040b43e8eb3778e8a7163d0b1230"},{"sha":"498200c3ce4a5f4007c8e2e11013777ad21bc02e","author":{"name":"Craig Gidney","email":"31271383ec794216294f53c566356fa369f09530@google.com"},"message":"Add Quantum Fourier Transform (#2135)\n\n- Add PhaseGradientGate, QuantumFourierTransformGate, and QFT method\r\n- QFT does not define _apply_unitary_ or _unitary_ because the most efficient way to get them is actually via the decomposition\r\n- Add exponent_qubit_index to CircuitDiagramInfo\r\n- Update ControlledOperation _circuit_diagram_info_ to forward exponent_qubit_index\r\n- Add _circuit_diagram_info_ to _InverseCompositeGate\r\n- Update phase_estimator example to use built-in QFT\r\n- Update hhl example to use built-in QFT\r\n- Add `big_endian_bits` option to `ApplyUnitaryArgs.subspace_index`\r\n\r\nThis one had snuck into a couple examples as redundant code. It's also one that I've seen people ask about.","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/498200c3ce4a5f4007c8e2e11013777ad21bc02e"},{"sha":"91a0dd14ff2ef265d8bf965fdfd428149977ed45","author":{"name":"Kevin J. Sung","email":"684948d99c148f0e073889deb03df4da73485bfd@users.noreply.github.com"},"message":"Change compute_amplitudes input format from 2-d array of bools to 1-d array of ints (#2158)\n\nFixes #2151","distinct":false,"url":"https://api.github.com/repos/bryano/Cirq/commits/91a0dd14ff2ef265d8bf965fdfd428149977ed45"}]}
{"actor":{"display_login":"bryano"}}