cirq-core 1.4.0.dev20240503144904__py3-none-any.whl → 1.4.0.dev20240507211136__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
@@ -1 +1 @@
1
- __version__ = "1.4.0.dev20240503144904"
1
+ __version__ = "1.4.0.dev20240507211136"
@@ -170,8 +170,15 @@ def tensor_expectation_value(
170
170
  )
171
171
  else:
172
172
  tn.rank_simplify(inplace=True)
173
- path_info = tn.contract(get='path-info')
174
- ram_gb = path_info.largest_intermediate * 128 / 8 / 1024 / 1024 / 1024
173
+ # TODO(#6586): revert when our minimum quimb version has bugfix for quimb#231
174
+ # Skip path-info evaluation when TensorNetwork consists of scalar Tensors.
175
+ # Avoid bug in quimb-1.8.0.
176
+ # Ref: https://github.com/jcmgray/quimb/issues/231
177
+ if tn.ind_map:
178
+ path_info = tn.contract(get='path-info')
179
+ ram_gb = path_info.largest_intermediate * 128 / 8 / 1024 / 1024 / 1024
180
+ else:
181
+ ram_gb = 0
175
182
  if ram_gb > max_ram_gb:
176
183
  raise MemoryError(f"We estimate that this contraction will take too much RAM! {ram_gb} GB")
177
184
  e_val = tn.contract(inplace=True)
cirq/ops/clifford_gate.py CHANGED
@@ -400,7 +400,11 @@ class CliffordGate(raw_types.Gate, CommonCliffordGates):
400
400
  # By definition, Clifford Gate should always return True.
401
401
  return True
402
402
 
403
- def __pow__(self, exponent) -> 'CliffordGate':
403
+ def __pow__(self, exponent: float) -> 'CliffordGate':
404
+ if exponent != int(exponent):
405
+ return NotImplemented
406
+ exponent = int(exponent)
407
+
404
408
  if exponent == -1:
405
409
  return CliffordGate.from_clifford_tableau(self.clifford_tableau.inverse())
406
410
  if exponent == 0:
@@ -409,18 +413,24 @@ class CliffordGate(raw_types.Gate, CommonCliffordGates):
409
413
  )
410
414
  if exponent == 1:
411
415
  return self
412
- if exponent > 0 and int(exponent) == exponent:
413
- base_tableau = self.clifford_tableau.copy()
414
- for _ in range(int(exponent) - 1):
415
- base_tableau = base_tableau.then(self.clifford_tableau)
416
- return CliffordGate.from_clifford_tableau(base_tableau)
417
- if exponent < 0 and int(exponent) == exponent:
418
- base_tableau = self.clifford_tableau.copy()
419
- for _ in range(int(-exponent) - 1):
420
- base_tableau = base_tableau.then(self.clifford_tableau)
421
- return CliffordGate.from_clifford_tableau(base_tableau.inverse())
422
416
 
423
- return NotImplemented
417
+ base_tableau = self.clifford_tableau.copy()
418
+ if exponent < 0:
419
+ base_tableau = base_tableau.inverse()
420
+ exponent = abs(exponent)
421
+
422
+ # https://cp-algorithms.com/algebra/binary-exp.html
423
+ aux = qis.CliffordTableau(
424
+ num_qubits=self.clifford_tableau.n
425
+ ) # this tableau collects the odd terms
426
+ while exponent > 1:
427
+ if exponent & 1:
428
+ aux = aux.then(base_tableau)
429
+ base_tableau = base_tableau.then(base_tableau)
430
+ exponent >>= 1
431
+
432
+ base_tableau = base_tableau.then(aux)
433
+ return CliffordGate.from_clifford_tableau(base_tableau)
424
434
 
425
435
  def __repr__(self) -> str:
426
436
  return f"Clifford Gate with Tableau:\n {self.clifford_tableau._str_full_()}"
@@ -129,7 +129,9 @@ class StabilizerState(
129
129
 
130
130
  class CliffordTableau(StabilizerState):
131
131
  """Tableau representation of a stabilizer state
132
- (based on Aaronson and Gottesman 2006).
132
+
133
+ References:
134
+ - [Aaronson and Gottesman](https://arxiv.org/abs/quant-ph/0406196)
133
135
 
134
136
  The tableau stores the stabilizer generators of
135
137
  the state using three binary arrays: xs, zs, and rs.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.4.0.dev20240503144904
3
+ Version: 1.4.0.dev20240507211136
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,7 +4,7 @@ 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=aRBGSolIrotnVt5Uy7_ohSdefCEVNK1cN8LfIKIi1Rs,40
7
+ cirq/_version.py,sha256=QrKLG_FMbxnWAqJFgyAxbZ5uJW3ElLXJ7Qfx4kkExHg,40
8
8
  cirq/_version_test.py,sha256=yYS6xm5-nuBRQJa9R3n41WdvFtVyY7Lb5Q8bea3VgBI,133
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=9g_JQMmfBzTuV-3s2flUbXIgcLjs4K7LjAFFgngdG1U,13204
@@ -127,7 +127,7 @@ cirq/contrib/quimb/grid_circuits.py,sha256=vuMiMaVXsJi-8ZwPnGcKJVVVYlXGi3O-CCwRV
127
127
  cirq/contrib/quimb/grid_circuits_test.py,sha256=0Pl_wea4E_HDa9zaKkmazltFdorB4QsaL2rmMrDv8Sw,3223
128
128
  cirq/contrib/quimb/mps_simulator.py,sha256=wz7Et54hzoShXtxrXrJ2T2Im5c_hvz7N-SCaAQ3G7qk,24705
129
129
  cirq/contrib/quimb/mps_simulator_test.py,sha256=6sjC95Ba4WCFoI6zlJmZCYi8GFwI58wkpXQdAoF2Sms,17007
130
- cirq/contrib/quimb/state_vector.py,sha256=WziCD7uMeh-cHI6F6DJCjqFKOtji_us2rf0vQhvtnvc,6686
130
+ cirq/contrib/quimb/state_vector.py,sha256=kMKNYJ3LLBhQXUCp2jXxCVrp6YLi-PDbrLGoPw7FDqA,6990
131
131
  cirq/contrib/quimb/state_vector_test.py,sha256=Jwuk_9hL00OA-WDRBafGY16ZHiBJQ18Dn8Bx2l8AAoc,5800
132
132
  cirq/contrib/quirk/__init__.py,sha256=B8cZpO41P5mzkn-4rLJF9SRoVm-MLBmhuFMxObbICc4,704
133
133
  cirq/contrib/quirk/export_to_quirk.py,sha256=DLZU0AcDGJhulrYlOcy2_ac9ITiqZ9bBz8a6ZZwFv8Y,3837
@@ -269,7 +269,7 @@ cirq/ops/boolean_hamiltonian.py,sha256=hjmzBvWiZnb18JfdhId-dVxt2VmbyAbqMSFAPWV7s
269
269
  cirq/ops/boolean_hamiltonian_test.py,sha256=1ey5yfYZPKZDsfM3jpCPAOpbPs_y8i4K_WvDK2d5_4Y,8518
270
270
  cirq/ops/classically_controlled_operation.py,sha256=bMqKutwzqbvN2r7mOVOI12HTPDGSJLkhQQgfAcTtbDU,9166
271
271
  cirq/ops/classically_controlled_operation_test.py,sha256=MNU0Adff4kTosqsrQ3PUT3ARcZee_PkchT6u0xDl8Qg,48039
272
- cirq/ops/clifford_gate.py,sha256=xTAGYR24u__ctlY2fNsWYTQcJof4euRYMGN8cdERV2E,39235
272
+ cirq/ops/clifford_gate.py,sha256=ARbHGptZxQo6kX9QTrh_kZ89N7lW6V3GQSE3o-1kixU,39366
273
273
  cirq/ops/clifford_gate_test.py,sha256=NF_if1X8LCMA9hy0vBO7lxvVPdumlvMMnI2XRQ-RLpk,37472
274
274
  cirq/ops/common_channels.py,sha256=mVGEta2wnaWOhRCXQO6gUj9Zll3rtXqpY-PRYcJ8m1U,38282
275
275
  cirq/ops/common_channels_test.py,sha256=EL_PxbqD3KPC8ioihiukhmW8bUdclqqigKoFyUQpmIM,29690
@@ -873,7 +873,7 @@ cirq/protocols/json_test_data/sympy.pi.repr,sha256=ZQS0my0esr3dWTZ3mWlqgR63uorPC
873
873
  cirq/qis/__init__.py,sha256=C_gnZt9CNWEE0I1IAZE0liNVIv-aphUohIHJih-szDg,1836
874
874
  cirq/qis/channels.py,sha256=AxKgLUbWLrb1pz9xLtSpYm_stjN-IWOwLFYC9YZSons,12798
875
875
  cirq/qis/channels_test.py,sha256=iqkSyfvx_c2ZpJKAVEsFyZRmKpzNrJsyFjHbaJUMqcQ,14454
876
- cirq/qis/clifford_tableau.py,sha256=Ik1ogTElaB3nJCPCGj1yqxMdpu404AbZjkVOVYZOins,25305
876
+ cirq/qis/clifford_tableau.py,sha256=X25eCXWEUWzoB-x6cna4LdLMFVNxUiIEUxKHJkkc2aE,25353
877
877
  cirq/qis/clifford_tableau_test.py,sha256=Z-5YSysJw2H3AfgZxhptvUMr5GUjUFgPcAUdcust9Qk,18441
878
878
  cirq/qis/measures.py,sha256=-e2mStl9882z4mbLwWtbdmmdJilmf6Ex2b_jSXhMX3c,12194
879
879
  cirq/qis/measures_test.py,sha256=3LTTGdvuFfZWmFyWFeUHpg1yGc9z0VE8j7Kd7J7y8i4,10092
@@ -1169,8 +1169,8 @@ cirq/work/sampler.py,sha256=JEAeQQRF3bqlO9AkOf4XbrTATDI5f5JgyM_FAUCNxao,19751
1169
1169
  cirq/work/sampler_test.py,sha256=B2ZsuqGT854gQtBIAh8k0LiG9Vj5wSzcGvkxOUoTcW4,13217
1170
1170
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1171
1171
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1172
- cirq_core-1.4.0.dev20240503144904.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1173
- cirq_core-1.4.0.dev20240503144904.dist-info/METADATA,sha256=1q92xeT06NabUO28q1QHb2Hl_hyEjoHxlaC2mXXrAzk,2098
1174
- cirq_core-1.4.0.dev20240503144904.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
1175
- cirq_core-1.4.0.dev20240503144904.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1176
- cirq_core-1.4.0.dev20240503144904.dist-info/RECORD,,
1172
+ cirq_core-1.4.0.dev20240507211136.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1173
+ cirq_core-1.4.0.dev20240507211136.dist-info/METADATA,sha256=n3Wsa7j8G0ljepCXIJKXPjp3dYHhguHVLEC-TSsMJ4w,2098
1174
+ cirq_core-1.4.0.dev20240507211136.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
1175
+ cirq_core-1.4.0.dev20240507211136.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1176
+ cirq_core-1.4.0.dev20240507211136.dist-info/RECORD,,