cirq-core 1.6.0.dev20250722041606__py3-none-any.whl → 1.6.0.dev20250722060449__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cirq-core might be problematic. Click here for more details.

cirq/_version.py CHANGED
@@ -28,4 +28,4 @@ if sys.version_info < (3, 11, 0): # pragma: no cover
28
28
  'of Cirq (e.g. "python -m pip install cirq==1.5.0")'
29
29
  )
30
30
 
31
- __version__ = "1.6.0.dev20250722041606"
31
+ __version__ = "1.6.0.dev20250722060449"
cirq/_version_test.py CHANGED
@@ -3,4 +3,4 @@ import cirq
3
3
 
4
4
 
5
5
  def test_version() -> None:
6
- assert cirq.__version__ == "1.6.0.dev20250722041606"
6
+ assert cirq.__version__ == "1.6.0.dev20250722060449"
cirq/ops/matrix_gates.py CHANGED
@@ -22,7 +22,7 @@ import numpy as np
22
22
 
23
23
  from cirq import _import, linalg, protocols
24
24
  from cirq._compat import proper_repr
25
- from cirq.ops import global_phase_op, identity, phased_x_z_gate, raw_types
25
+ from cirq.ops import global_phase_op, phased_x_z_gate, raw_types
26
26
 
27
27
  if TYPE_CHECKING:
28
28
  import cirq
@@ -170,8 +170,8 @@ class MatrixGate(raw_types.Gate):
170
170
  return NotImplemented
171
171
  # The above algorithms ignore phase, but phase is important to maintain if the gate is
172
172
  # controlled. Here, we add it back in with a global phase op.
173
- ident = identity.IdentityGate(qid_shape=self._qid_shape).on(*qubits) # Preserve qid order
174
- u = protocols.unitary(Circuit(ident, *decomposed)).reshape(self._matrix.shape)
173
+ circuit = Circuit(*decomposed)
174
+ u = circuit.unitary(qubit_order=qubits, qubits_that_should_be_present=qubits)
175
175
  phase_delta = linalg.phase_delta(u, self._matrix)
176
176
  # Phase delta is on the complex unit circle, so if real(phase_delta) >= 1, that means
177
177
  # no phase delta. (>1 is rounding error).
@@ -413,3 +413,16 @@ def test_matrixgate_name_serialization():
413
413
  gate_after_serialization3 = cirq.read_json(json_text=cirq.to_json(gate3))
414
414
  assert gate3._name == ''
415
415
  assert gate_after_serialization3._name == ''
416
+
417
+
418
+ def test_decompose_when_qubits_not_in_ascending_order():
419
+ # Previous code for preserving global phase would misorder qubits
420
+ q0, q1 = cirq.LineQubit.range(2)
421
+ circuit1 = cirq.Circuit()
422
+ matrix = cirq.testing.random_unitary(4, random_state=0)
423
+ circuit1.append(cirq.MatrixGate(matrix).on(q1, q0))
424
+ u1 = cirq.unitary(circuit1)
425
+ decomposed = cirq.decompose(circuit1)
426
+ circuit2 = cirq.Circuit(decomposed)
427
+ u2 = cirq.unitary(circuit2)
428
+ np.testing.assert_allclose(u1, u2, atol=1e-14)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cirq-core
3
- Version: 1.6.0.dev20250722041606
3
+ Version: 1.6.0.dev20250722060449
4
4
  Summary: A framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
5
5
  Home-page: http://github.com/quantumlib/cirq
6
6
  Author: The Cirq Developers
@@ -4,8 +4,8 @@ cirq/_compat_test.py,sha256=emXpdD5ZvwLRlFAoQB8YatmZyU3b4e9jg6FppMTUhkU,33900
4
4
  cirq/_doc.py,sha256=BrnoABo1hk5RgB3Cgww4zLHUfiyFny0F1V-tOMCbdaU,2909
5
5
  cirq/_import.py,sha256=ixBu4EyGl46Ram2cP3p5eZVEFDW5L2DS-VyTjz4N9iw,8429
6
6
  cirq/_import_test.py,sha256=oF4izzOVZLc7NZ0aZHFcGv-r01eiFFt_JORx_x7_D4s,1089
7
- cirq/_version.py,sha256=9nRK75OBSnRLgvqZx_6GZra2OeWGWSqAmRTkenzHHTc,1206
8
- cirq/_version_test.py,sha256=txKPsk8dyJHomB1i-2VhHX7-RZHtL8rgxBb-gVZ3nhk,155
7
+ cirq/_version.py,sha256=EcZa_ZaPto_BO-qiBisQ-pq5BeODOB_T_vPRyzI5Cxw,1206
8
+ cirq/_version_test.py,sha256=PwWpQQ3wbr8l7ianH_rnV0MFP16YhOFOCrVMTM-drKg,155
9
9
  cirq/conftest.py,sha256=wSDKNdIQRDfLnXvOCWD3erheOw8JHRhdfQ53EyTUIXg,1239
10
10
  cirq/json_resolver_cache.py,sha256=A5DIgFAY1hUNt9vai_C3-gGBv24116CJMzQxMcXOax4,13726
11
11
  cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
@@ -319,8 +319,8 @@ cirq/ops/kraus_channel.py,sha256=uSLq2AG72zbwzcbiEETFOAZ35KNR9U9KIFO31HYzLKA,507
319
319
  cirq/ops/kraus_channel_test.py,sha256=FhgCyCKa4bIgGc4yAQbqDKB80910TEVVWRknyyGbILg,4955
320
320
  cirq/ops/linear_combinations.py,sha256=AQA0aFDuHXks44fFtevrc2Zl1chleSlf1A0LkmrZrW8,39883
321
321
  cirq/ops/linear_combinations_test.py,sha256=EYqrWlFFThv8dl5B_9yIckEn_z3-Nfzh7rdVzGpIVWM,67351
322
- cirq/ops/matrix_gates.py,sha256=w-yDz2ZmIDiSTLO6Qhp6NrJJFJOJIjrt3okK7rRcZ68,10309
323
- cirq/ops/matrix_gates_test.py,sha256=5ZVdkTODOXKv5fi3xDqJA0gc9cYBMTd-KuKHyK-dxHI,14261
322
+ cirq/ops/matrix_gates.py,sha256=or8Kc3kP1NFjLbAHemmrZIqYFgEeeteMogNVEzYjosk,10238
323
+ cirq/ops/matrix_gates_test.py,sha256=MEK1VsaAv2Li_aYhFIfD53gytCNo854l5-BXL9yZBFs,14770
324
324
  cirq/ops/measure_util.py,sha256=iT7vrYLTo6L4z4_Zdm-8e8iiiKyQgF2v9Ui74Tg52aw,7261
325
325
  cirq/ops/measure_util_test.py,sha256=WrbR2jr_bFXxpQe8n3ANLAKYo1hcf-SlgsFOi-ULRXU,5343
326
326
  cirq/ops/measurement_gate.py,sha256=i7ThYTd1xdzOG274jzFnzqEz5Qmv6wggcubWa-3FDZE,11874
@@ -1224,8 +1224,8 @@ cirq/work/sampler.py,sha256=rxbMWvrhu3gfNSBjZKozw28lLKVvBAS_1EGyPdYe8Xg,19041
1224
1224
  cirq/work/sampler_test.py,sha256=SsMrRvLDYELyOAWLKISjkdEfrBwLYWRsT6D8WrsLM3Q,13533
1225
1225
  cirq/work/zeros_sampler.py,sha256=Fs2JWwq0n9zv7_G5Rm-9vPeHUag7uctcMOHg0JTkZpc,2371
1226
1226
  cirq/work/zeros_sampler_test.py,sha256=lQLgQDGBLtfImryys2HzQ2jOSGxHgc7-koVBUhv8qYk,3345
1227
- cirq_core-1.6.0.dev20250722041606.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1228
- cirq_core-1.6.0.dev20250722041606.dist-info/METADATA,sha256=tXjfxPgW07rxp87WIlM7PZj2tL8MT6GzE4te6h8HnS4,4857
1229
- cirq_core-1.6.0.dev20250722041606.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1230
- cirq_core-1.6.0.dev20250722041606.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1231
- cirq_core-1.6.0.dev20250722041606.dist-info/RECORD,,
1227
+ cirq_core-1.6.0.dev20250722060449.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1228
+ cirq_core-1.6.0.dev20250722060449.dist-info/METADATA,sha256=KXy-MZjTnnSAnOZcSu-CmL4hIWVacvLzA_DlY7a15W0,4857
1229
+ cirq_core-1.6.0.dev20250722060449.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1230
+ cirq_core-1.6.0.dev20250722060449.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1231
+ cirq_core-1.6.0.dev20250722060449.dist-info/RECORD,,