cirq-core 1.5.0.dev20250325193835__py3-none-any.whl → 1.5.0.dev20250326013841__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, 10, 0): # pragma: no cover
28
28
  'of cirq (e.g. "python -m pip install cirq==1.1.*")'
29
29
  )
30
30
 
31
- __version__ = "1.5.0.dev20250325193835"
31
+ __version__ = "1.5.0.dev20250326013841"
cirq/_version_test.py CHANGED
@@ -3,4 +3,4 @@ import cirq
3
3
 
4
4
 
5
5
  def test_version():
6
- assert cirq.__version__ == "1.5.0.dev20250325193835"
6
+ assert cirq.__version__ == "1.5.0.dev20250326013841"
@@ -83,8 +83,8 @@ def _validate_input(
83
83
 
84
84
  if all(q == ops.I for q in pauli_str):
85
85
  raise ValueError(
86
- "Empty Pauli strings or Pauli strings consisting"
87
- "only of Pauli I are not allowed. Please provide"
86
+ "Empty Pauli strings or Pauli strings consisting "
87
+ "only of Pauli I are not allowed. Please provide "
88
88
  "valid input Pauli strings."
89
89
  )
90
90
  if pauli_str.coefficient.imag != 0:
@@ -36,13 +36,9 @@ def _create_ghz(number_of_qubits: int, qubits: Sequence[cirq.Qid]) -> cirq.Circu
36
36
  def _generate_random_pauli_string(qubits: Sequence[cirq.Qid], enable_coeff: bool = False):
37
37
  pauli_ops = [cirq.I, cirq.X, cirq.Y, cirq.Z]
38
38
 
39
- # Ensure at least one non-identity.
40
- operators = {q: cirq.I(q) for q in qubits} # Start with all identities
41
- # Choose a random subset of qubits to have non-identity operators
42
- non_identity_qubits = random.sample(qubits, random.randint(1, len(qubits)))
43
- for q in non_identity_qubits:
44
- operators[q] = random.choice([cirq.X, cirq.Y, cirq.Z])(q) # Only non-identity ops
45
39
  operators = {q: random.choice(pauli_ops) for q in qubits}
40
+ # Ensure at least one non-identity.
41
+ operators[random.choice(qubits)] = random.choice(pauli_ops[1:])
46
42
 
47
43
  if enable_coeff:
48
44
  coefficient = (2 * random.random() - 1) * 100
@@ -461,8 +457,8 @@ def test_all_pauli_strings_are_pauli_i() -> None:
461
457
 
462
458
  with pytest.raises(
463
459
  ValueError,
464
- match="Empty Pauli strings or Pauli strings consisting"
465
- "only of Pauli I are not allowed. Please provide"
460
+ match="Empty Pauli strings or Pauli strings consisting "
461
+ "only of Pauli I are not allowed. Please provide "
466
462
  "valid input Pauli strings.",
467
463
  ):
468
464
  measure_pauli_strings(
@@ -173,13 +173,12 @@ class TensoredConfusionMatrices:
173
173
  return in_vars + out_vars
174
174
 
175
175
  def _confusion_matrix(self, qubits: Sequence['cirq.Qid']) -> np.ndarray:
176
- ein_input = []
176
+ ein_input: List[np.ndarray | List[int]] = []
177
177
  for qs, cm in zip(self.measure_qubits, self.confusion_matrices):
178
178
  ein_input.extend([cm.reshape((2, 2) * len(qs)), self._get_vars(qs)])
179
179
  ein_out = self._get_vars(qubits)
180
180
 
181
- # TODO(#5757): remove type ignore when numpy has proper override signature.
182
- ret = np.einsum(*ein_input, ein_out).reshape((2 ** len(qubits),) * 2) # type: ignore
181
+ ret = np.einsum(*ein_input, ein_out).reshape((2 ** len(qubits),) * 2)
183
182
  return ret / ret.sum(axis=1)
184
183
 
185
184
  def confusion_matrix(self, qubits: Optional[Sequence['cirq.Qid']] = None) -> np.ndarray:
@@ -153,7 +153,6 @@ def targeted_left_multiply(
153
153
 
154
154
  all_indices = set(input_indices + data_indices + tuple(output_indices))
155
155
 
156
- # TODO(#5757): remove type ignore when numpy has proper override signature.
157
156
  return np.einsum(
158
157
  left_matrix,
159
158
  input_indices,
@@ -164,10 +163,8 @@ def targeted_left_multiply(
164
163
  # but this is a workaround for a bug in numpy:
165
164
  # https://github.com/numpy/numpy/issues/10926
166
165
  optimize=len(all_indices) >= 26,
167
- # And this is workaround for *another* bug!
168
- # Supposed to be able to just say 'old=old'.
169
- **({'out': out} if out is not None else {}),
170
- ) # type: ignore
166
+ out=out,
167
+ )
171
168
 
172
169
 
173
170
  @dataclasses.dataclass
@@ -412,7 +409,6 @@ def partial_trace(tensor: np.ndarray, keep_indices: Sequence[int]) -> np.ndarray
412
409
  keep_map = dict(zip(keep_indices, sorted(keep_indices)))
413
410
  left_indices = [keep_map[i] if i in keep_set else i for i in range(ndim)]
414
411
  right_indices = [ndim + i if i in keep_set else i for i in left_indices]
415
- # TODO(#5757): remove type ignore when numpy has proper override signature.
416
412
  return np.einsum(tensor, left_indices + right_indices)
417
413
 
418
414
 
cirq/qis/states.py CHANGED
@@ -677,7 +677,6 @@ def density_matrix_from_state_vector(
677
677
  sum_inds = np.array(range(n_qubits))
678
678
  sum_inds[indices] += n_qubits
679
679
 
680
- # TODO(#5757): remove type ignore when numpy has proper override signature.
681
680
  rho = np.einsum(
682
681
  state_vector,
683
682
  list(range(n_qubits)),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.5.0.dev20250325193835
3
+ Version: 1.5.0.dev20250326013841
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=Qq3ZcfgD-Nb81cEppQdJqhAyrVqXKtfXZYGXT0p-Wh0,34718
4
4
  cirq/_doc.py,sha256=yDyWUD_2JDS0gShfGRb-rdqRt9-WeL7DhkqX7np0Nko,2879
5
5
  cirq/_import.py,sha256=p9gMHJscbtDDkfHOaulvd3Aer0pwUF5AXpL89XR8dNw,8402
6
6
  cirq/_import_test.py,sha256=6K_v0riZJXOXUphHNkGA8MY-JcmGlezFaGmvrNhm3OQ,1015
7
- cirq/_version.py,sha256=QrQ3VlvpYa_8PWRE4kiGgaYjRNItx7beSqJxMw4vefY,1206
8
- cirq/_version_test.py,sha256=fS-UN2mbD5OT12fp1do049VlxC1TwWJh2hBIcbrgTgk,147
7
+ cirq/_version.py,sha256=8oTTttHZjJdni2fil1IL3AxrTdbx--IpmLGgHJbBllk,1206
8
+ cirq/_version_test.py,sha256=_4FkRqiKPZUTNl6NRxcoEF7J9kuLyBwhHpoFhNsdf88,147
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=p-vEOa-8GQ2cFIAdze-kd6C1un1uRvtujVPljVKaHBg,13557
11
11
  cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
@@ -96,8 +96,8 @@ cirq/contrib/paulistring/optimize.py,sha256=qhBOGxLYovUua_xVqXWgVDPRRmv4VOmyFgKV
96
96
  cirq/contrib/paulistring/optimize_test.py,sha256=jie0UomSCIj90TMv3MIi4hd32iTjttQ8-zr7ZDs0tug,3560
97
97
  cirq/contrib/paulistring/pauli_string_dag.py,sha256=vg0994h84zHIejSdwfqR-mdwmHOWWOAOOcGuStfKPdk,1106
98
98
  cirq/contrib/paulistring/pauli_string_dag_test.py,sha256=rlwbuh0DvFv1GlJIqEG1OI_geY77dzxo4bb7qqDkz8M,1125
99
- cirq/contrib/paulistring/pauli_string_measurement_with_readout_mitigation.py,sha256=ULhFIH8LBbDNHpPd0ulXTCm-hGqpbZBxrQLolSKfBg4,15675
100
- cirq/contrib/paulistring/pauli_string_measurement_with_readout_mitigation_test.py,sha256=srkjiczY5WLfwzltmc0cn0J6atZyJ8qWL-oiUZuGPDI,21717
99
+ cirq/contrib/paulistring/pauli_string_measurement_with_readout_mitigation.py,sha256=1Vuvng02ocNUziCgE9XjYrTQIAxSfvM4eqY0Hc6LZpk,15677
100
+ cirq/contrib/paulistring/pauli_string_measurement_with_readout_mitigation_test.py,sha256=AqQTKNuPLFDrB7XUHWAZDi6y8B9-Bf0-iAGg3TXnSBo,21436
101
101
  cirq/contrib/paulistring/pauli_string_optimize.py,sha256=81MDk6rKl0jmw7DXFkA02YmluiXLLznuuCTvca7mVoY,2815
102
102
  cirq/contrib/paulistring/pauli_string_optimize_test.py,sha256=f1BWjg8IGw5ChXFYNVhYKNIrFul8PgvpnOEadkRm-3Q,2897
103
103
  cirq/contrib/paulistring/recombine.py,sha256=SU6DNj3Y9Wicf9pMP3IYzdWV7Fuz1DA_1v2AtUVnuF4,4355
@@ -190,7 +190,7 @@ cirq/experiments/qubit_characterizations.py,sha256=hhbs_6aCLb4co0Y6TNJGiSmmjE8sm
190
190
  cirq/experiments/qubit_characterizations_test.py,sha256=b_ONqxyW6s01Ts8T65BEdb4e8Xy24Qp4zTGXWesL0ic,9733
191
191
  cirq/experiments/random_quantum_circuit_generation.py,sha256=tTgo1mEbLhY8i9VzR-p6xPqnv-O62TlJyW8AGj4V56M,28269
192
192
  cirq/experiments/random_quantum_circuit_generation_test.py,sha256=zOWsLLcYefG0yA1rKn-hwdNjNANBXDaKg4vAUXPIwHk,16522
193
- cirq/experiments/readout_confusion_matrix.py,sha256=5yS7VXDe9LHYn_6YRYek-HZ9ftEBmCTn5__TYSUONGQ,20875
193
+ cirq/experiments/readout_confusion_matrix.py,sha256=frHnyfCQtspjsxyW1bX-yPXOgOFENSwNVKLKtQSv67s,20805
194
194
  cirq/experiments/readout_confusion_matrix_test.py,sha256=ETvKHVuJWvq8KuL0l6w22UOfZHhBNH-TVeWAKqjSQEc,10632
195
195
  cirq/experiments/single_qubit_readout_calibration.py,sha256=x6fF6GqU1D4YY05YvW1DFlTlbjC12_bfj7W2psd75-U,14722
196
196
  cirq/experiments/single_qubit_readout_calibration_test.py,sha256=_002QXj2rIFHkH3vw9iTVMh45vCPuCI_fTqOUK8uMe4,7718
@@ -260,7 +260,7 @@ cirq/linalg/predicates.py,sha256=Q8BTlR4EvPg2KP9VodK78UEWYJbSCOTqRahn1DnFmSc,120
260
260
  cirq/linalg/predicates_test.py,sha256=UVDkNH2ujI80JwJwsDjbTgyALZUQJAVVCoFN1T_LLf0,21503
261
261
  cirq/linalg/tolerance.py,sha256=yHYVSHx2aoRci1aac9ZiM8OH1Bvy1Em-Rybnar701nE,1870
262
262
  cirq/linalg/tolerance_test.py,sha256=wnmuXIGEn_mugGoNm3AigSgjV2DMFdj8xpgRTMBbO7A,2355
263
- cirq/linalg/transformations.py,sha256=5iNg4IOcYqfqDTYo5i983IxweyHiMwcHW8jdk9hpG34,32303
263
+ cirq/linalg/transformations.py,sha256=cUZWPZJq6DISQ4rS02KSObmNwqLHYxIkNCfYijgJLoA,31986
264
264
  cirq/linalg/transformations_test.py,sha256=GsqD8_X0N88ECKr44t0O9wAJ6-uJJi0wExivn0Okf7M,25333
265
265
  cirq/neutral_atoms/__init__.py,sha256=VoQBkmZ5m4TPxjxShRixjqJbnc-IAnAWkGOPu8MBS5o,813
266
266
  cirq/neutral_atoms/convert_to_neutral_atom_gates.py,sha256=SsXFh1-NoBGqp4yX8-jIbIw-AK40baA-qh-iTL1wS6Q,1070
@@ -905,7 +905,7 @@ cirq/qis/measures_test.py,sha256=3LTTGdvuFfZWmFyWFeUHpg1yGc9z0VE8j7Kd7J7y8i4,100
905
905
  cirq/qis/noise_utils.py,sha256=wakkdQdBzOUWCf71sCxMCWwfPPAnJi5bNYsXDzGzkx0,3680
906
906
  cirq/qis/noise_utils_test.py,sha256=6r99DBN_2bImZbuOIB2A9ZdvyipqDopXsoxV-8OUK_I,3391
907
907
  cirq/qis/quantum_state_representation.py,sha256=5ybXGqjGSpSZqOn9q6OW6IBOmJs8KQekv5fFZZMCqZQ,3238
908
- cirq/qis/states.py,sha256=xrkYZR2UOkxTf0GouQ0p1-aiQRYmJheiEk7fxPR8Kog,41967
908
+ cirq/qis/states.py,sha256=1hhW0U6EF_C8MocBPV-017JEYc6uTUvqZucgqI8rMkA,41887
909
909
  cirq/qis/states_test.py,sha256=I4fHt5drqG0C36bvmU-H7DfY3zOC8CfiZFzKJvSOnFs,31813
910
910
  cirq/sim/__init__.py,sha256=J209uAbjmgzER-48Q-FkRUWQ1FlG6-1c7GK11owZIW4,3452
911
911
  cirq/sim/classical_simulator.py,sha256=orp2WY15HNCJk60Aosq7igO3bjKcWjAAOeU_CiPK_98,9349
@@ -1206,8 +1206,8 @@ cirq/work/sampler.py,sha256=bE5tmVkcR6cZZMLETxDfHehdsYUMbx2RvBeIBetehI4,19187
1206
1206
  cirq/work/sampler_test.py,sha256=hL2UWx3dz2ukZVNxWftiKVvJcQoLplLZdQm-k1QcA40,13282
1207
1207
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1208
1208
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1209
- cirq_core-1.5.0.dev20250325193835.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1210
- cirq_core-1.5.0.dev20250325193835.dist-info/METADATA,sha256=nWzeAGl8vEG4VGQzXpw9GBPCAGGK9nD-l9BGa9OgXjw,4817
1211
- cirq_core-1.5.0.dev20250325193835.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1212
- cirq_core-1.5.0.dev20250325193835.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1213
- cirq_core-1.5.0.dev20250325193835.dist-info/RECORD,,
1209
+ cirq_core-1.5.0.dev20250326013841.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1210
+ cirq_core-1.5.0.dev20250326013841.dist-info/METADATA,sha256=e6_72WE_aqQDP7QP1T8LmPCAD9NZsx3HBzGzccUwYIU,4817
1211
+ cirq_core-1.5.0.dev20250326013841.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1212
+ cirq_core-1.5.0.dev20250326013841.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1213
+ cirq_core-1.5.0.dev20250326013841.dist-info/RECORD,,