pyqrack-complex128 1.64.0__py3-none-macosx_15_0_arm64.whl → 1.71.0__py3-none-macosx_15_0_arm64.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 pyqrack-complex128 might be problematic. Click here for more details.

@@ -244,7 +244,6 @@ class QrackAceBackend:
244
244
  self.long_range_columns = long_range_columns
245
245
  self.long_range_rows = long_range_rows
246
246
  self.is_transpose = is_transpose
247
- self.correction_bias = correction_bias
248
247
 
249
248
  fppow = 5
250
249
  if "QRACK_FPPOW" in os.environ:
@@ -60,6 +60,7 @@ class QrackSimulator:
60
60
  isHostPointer=(
61
61
  True if os.environ.get("PYQRACK_HOST_POINTER_DEFAULT_ON") else False
62
62
  ),
63
+ isSparse=False,
63
64
  noise=0,
64
65
  pyzxCircuit=None,
65
66
  qiskitCircuit=None,
@@ -99,6 +100,7 @@ class QrackSimulator:
99
100
  isCpuGpuHybrid,
100
101
  isOpenCL,
101
102
  isHostPointer,
103
+ isSparse
102
104
  )
103
105
 
104
106
  self._throw_if_error()
@@ -1053,9 +1055,16 @@ class QrackSimulator:
1053
1055
  Returns:
1054
1056
  Measurement result of all qubits.
1055
1057
  """
1056
- result = Qrack.qrack_lib.MAll(self.sid)
1058
+ num_q = self.num_qubits()
1059
+ num_words = (num_q + 63) // 64
1060
+ _r = (ctypes.c_ulonglong * num_words)()
1061
+ Qrack.qrack_lib.MAllLong(self.sid, _r)
1057
1062
  self._throw_if_error()
1058
- return result
1063
+ r = 0
1064
+ for w in range(num_words):
1065
+ r <<= 64
1066
+ r |= _r[w]
1067
+ return r
1059
1068
 
1060
1069
  def measure_pauli(self, b, q):
1061
1070
  """Pauli Measurement gate
@@ -2125,9 +2134,7 @@ class QrackSimulator:
2125
2134
  def decompose(self, q):
2126
2135
  """Decompose system
2127
2136
 
2128
- Decompose the given qubit out of the system.
2129
- Warning: The qubit subsystem state must be separable, or the behavior
2130
- of this method is undefined.
2137
+ Factorize a set of contiguous bits with minimal fidelity loss.
2131
2138
 
2132
2139
  Args:
2133
2140
  q: qubit id
@@ -2137,7 +2144,7 @@ class QrackSimulator:
2137
2144
  RuntimeError: QrackSimulator with isTensorNetwork=True option cannot decompose()! (Turn off just this option, in the constructor.)
2138
2145
 
2139
2146
  Returns:
2140
- State of the systems.
2147
+ Decomposed subsystem simulator.
2141
2148
  """
2142
2149
  if self.is_tensor_network:
2143
2150
  raise RuntimeError(
@@ -2154,10 +2161,8 @@ class QrackSimulator:
2154
2161
  def dispose(self, q):
2155
2162
  """Dispose qubits
2156
2163
 
2157
- Minimally decompose a set of contiguous bits from the separably
2158
- composed unit, and discard the separable bits.
2159
- Warning: The qubit subsystem state must be separable, or the behavior
2160
- of this method is undefined.
2164
+ Factorize a set of contiguous bits with minimal fidelity loss,
2165
+ and discard the separable bits.
2161
2166
 
2162
2167
  Args:
2163
2168
  q: qubit
@@ -2165,9 +2170,6 @@ class QrackSimulator:
2165
2170
  Raises:
2166
2171
  RuntimeError: QrackSimulator raised an exception.
2167
2172
  RuntimeError: QrackSimulator with isTensorNetwork=True option cannot dispose()! (Turn off just this option, in the constructor.)
2168
-
2169
- Returns:
2170
- State of the systems.
2171
2173
  """
2172
2174
  if self.is_tensor_network:
2173
2175
  raise RuntimeError(
@@ -2285,6 +2287,72 @@ class QrackSimulator:
2285
2287
  self._throw_if_error()
2286
2288
  return list(probs)
2287
2289
 
2290
+ def out_rdm(self, q):
2291
+ """Get reduced density matrix
2292
+
2293
+ Returns the raw reduced density matrix of the simulator, for the qubit list.
2294
+ Warning: State vector or is not always the internal representation leading
2295
+ to sub-optimal performance of the method.
2296
+
2297
+ Raises:
2298
+ RuntimeError: QrackSimulator raised an exception.
2299
+
2300
+ Returns:
2301
+ flat list structure representing the reduced density matrix.
2302
+ """
2303
+ amp_count = 1 << len(q)
2304
+ sqr_amp_count = amp_count * amp_count
2305
+ flat_rdm = self._qrack_complex_byref([complex(0, 0)] * sqr_amp_count)
2306
+ Qrack.qrack_lib.OutReducedDensityMatrix(self.sid, len(q), self._ulonglong_byref(q), flat_rdm)
2307
+ self._throw_if_error()
2308
+ return [complex(r, i) for r, i in self._pairwise(flat_rdm)]
2309
+
2310
+ def highest_prob_perm(self):
2311
+ """Get the permutation (bit string) with the highest probability
2312
+
2313
+ Returns the single highest-probability bit string in the Hilbert space
2314
+
2315
+ Raises:
2316
+ RuntimeError: QrackSimulator raised an exception.
2317
+
2318
+ Returns:
2319
+ Highest probability dimension index
2320
+ """
2321
+ num_q = self.num_qubits()
2322
+ num_words = (num_q + 63) // 64
2323
+ _r = (ctypes.c_ulonglong * num_words)()
2324
+ Qrack.qrack_lib.HighestProbAll(self.sid, _r)
2325
+ self._throw_if_error()
2326
+ r = 0
2327
+ for w in range(num_words):
2328
+ r <<= 64
2329
+ r |= _r[w]
2330
+ return r
2331
+
2332
+ def highest_n_prob_perm(self, n):
2333
+ """Get the top n permutations (bit strings) with the highest probability
2334
+
2335
+ Returns the top n highest-probability bit strings in the Hilbert space
2336
+
2337
+ Raises:
2338
+ RuntimeError: QrackSimulator raised an exception.
2339
+
2340
+ Returns:
2341
+ Top n highest probability dimension indices
2342
+ """
2343
+ num_q = self.num_qubits()
2344
+ num_words = (num_q + 63) // 64
2345
+ _r = (ctypes.c_ulonglong * (num_words * n))()
2346
+ Qrack.qrack_lib.HighestProbAllN(self.sid, n, _r)
2347
+ self._throw_if_error()
2348
+ r = [0] * n
2349
+ for i in range(n):
2350
+ r[i] = 0
2351
+ for w in range(num_words):
2352
+ r[i] <<= 64
2353
+ r[i] |= _r[(i * num_words) + w]
2354
+ return r
2355
+
2288
2356
  def prob_all(self, q):
2289
2357
  """Probabilities of all subset permutations
2290
2358
 
@@ -87,19 +87,22 @@ class QrackSystem:
87
87
  CFUNCTYPE(c_ulonglong, c_double, c_double),
88
88
  ]
89
89
 
90
- # These next two methods need to have c_double pointers, if PyQrack is built with fp64.
90
+ # These next few methods need to have c_double pointers, if PyQrack is built with fp64.
91
91
  self.qrack_lib.InKet.restype = None
92
92
  self.qrack_lib.OutKet.restype = None
93
93
  self.qrack_lib.OutProbs.restype = None
94
+ self.qrack_lib.OutReducedDensityMatrix.restype = None
94
95
 
95
96
  if self.fppow < 6:
96
97
  self.qrack_lib.InKet.argtypes = [c_ulonglong, POINTER(c_float)]
97
98
  self.qrack_lib.OutKet.argtypes = [c_ulonglong, POINTER(c_float)]
98
99
  self.qrack_lib.OutProbs.argtypes = [c_ulonglong, POINTER(c_float)]
100
+ self.qrack_lib.OutReducedDensityMatrix.argtypes = [c_ulonglong, c_ulonglong, POINTER(c_ulonglong), POINTER(c_float)]
99
101
  else:
100
102
  self.qrack_lib.InKet.argtypes = [c_ulonglong, POINTER(c_double)]
101
103
  self.qrack_lib.OutKet.argtypes = [c_ulonglong, POINTER(c_double)]
102
104
  self.qrack_lib.OutProbs.argtypes = [c_ulonglong, POINTER(c_double)]
105
+ self.qrack_lib.OutReducedDensityMatrix.argtypes = [c_ulonglong, c_ulonglong, POINTER(c_ulonglong), POINTER(c_double)]
103
106
 
104
107
  self.qrack_lib.init.restype = c_ulonglong
105
108
  self.qrack_lib.init.argtypes = []
@@ -108,10 +111,10 @@ class QrackSystem:
108
111
  self.qrack_lib.get_error.argtypes = [c_ulonglong]
109
112
 
110
113
  self.qrack_lib.init_count.restype = c_ulonglong
111
- self.qrack_lib.init_count.argtypes = [c_ulonglong, c_bool]
114
+ self.qrack_lib.init_count.argtypes = [c_ulonglong, c_bool, c_bool]
112
115
 
113
116
  self.qrack_lib.init_count_pager.restype = c_ulonglong
114
- self.qrack_lib.init_count_pager.argtypes = [c_ulonglong, c_bool]
117
+ self.qrack_lib.init_count_pager.argtypes = [c_ulonglong, c_bool, c_bool]
115
118
 
116
119
  self.qrack_lib.init_count_type.restype = c_ulonglong
117
120
  self.qrack_lib.init_count_type.argtypes = [
@@ -126,6 +129,7 @@ class QrackSystem:
126
129
  c_bool,
127
130
  c_bool,
128
131
  c_bool,
132
+ c_bool
129
133
  ]
130
134
 
131
135
  self.qrack_lib.init_count_stabilizer.restype = c_ulonglong
@@ -155,6 +159,12 @@ class QrackSystem:
155
159
 
156
160
  # pseudo-quantum
157
161
 
162
+ self.qrack_lib.HighestProbAll.restype = None
163
+ self.qrack_lib.HighestProbAll.argtypes = [c_ulonglong, POINTER(c_ulonglong)]
164
+
165
+ self.qrack_lib.HighestProbAllN.restype = None
166
+ self.qrack_lib.HighestProbAllN.argtypes = [c_ulonglong, c_ulonglong, POINTER(c_ulonglong)]
167
+
158
168
  self.qrack_lib.ProbAll.restype = None
159
169
  if self.fppow == 5:
160
170
  self.qrack_lib.ProbAll.argtypes = [
@@ -790,6 +800,9 @@ class QrackSystem:
790
800
  self.qrack_lib.MAll.restype = c_ulonglong
791
801
  self.qrack_lib.MAll.argtypes = [c_ulonglong]
792
802
 
803
+ self.qrack_lib.MAllLong.restype = None
804
+ self.qrack_lib.MAllLong.argtypes = [c_ulonglong, POINTER(c_ulonglong)]
805
+
793
806
  self.qrack_lib.Measure.restype = c_ulonglong
794
807
  self.qrack_lib.Measure.argtypes = [
795
808
  c_ulonglong,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyqrack-complex128
3
- Version: 1.64.0
3
+ Version: 1.71.0
4
4
  Summary: pyqrack - Pure Python vm6502q/qrack Wrapper
5
5
  Home-page: https://github.com/vm6502q/pyqrack
6
6
  Author: Daniel Strano
@@ -41,7 +41,7 @@ Provides-Extra: dev
41
41
  Requires-Dist: pytest>=7.3.1; extra == "dev"
42
42
 
43
43
  # pyqrack
44
- [![Downloads](https://pepy.tech/badge/pyqrack)](https://pepy.tech/project/pyqrack) [![Downloads](https://pepy.tech/badge/pyqrack/month)](https://pepy.tech/project/pyqrack) [![Downloads](https://static.pepy.tech/badge/pyqrack/week)](https://pepy.tech/project/pyqrack)
44
+ [![Downloads](https://pepy.tech/badge/pyqrack-complex128)](https://pepy.tech/project/pyqrack-complex128) [![Downloads](https://pepy.tech/badge/pyqrack-complex128/month)](https://pepy.tech/project/pyqrack-complex128) [![Downloads](https://static.pepy.tech/badge/pyqrack-complex128/week)](https://pepy.tech/project/pyqrack-complex128)
45
45
 
46
46
  Pure Python bindings for the pure C++11/OpenCL Qrack quantum computer simulator library
47
47
 
@@ -1,23 +1,23 @@
1
1
  pyqrack/__init__.py,sha256=3tBwfCCD-zQjQ2g1EUZdggKdn-3b2uSFTbT7LS0YLaU,785
2
2
  pyqrack/neuron_activation_fn.py,sha256=fQTTFfsvwcot_43Vopacot47IV2Rxk8pelUyuzwpXPs,593
3
3
  pyqrack/pauli.py,sha256=wg500wDOwdIU4lEVJoMmjtbAdmtakZYzLPjdzC2rwUQ,654
4
- pyqrack/qrack_ace_backend.py,sha256=9p90dJXqFwc-hjclIexXZzNv-zYTWyg6vk9qYMjifXY,49439
4
+ pyqrack/qrack_ace_backend.py,sha256=Prw1NhVVt0csbHiJeW8MJI9rl1P1YS63sXM5quoNPrI,49392
5
5
  pyqrack/qrack_circuit.py,sha256=vDCKGbcEHJDFUKprjCpWgit8lXFnMrPimKHURD2_Hj4,19538
6
6
  pyqrack/qrack_neuron.py,sha256=UiJdjAGB6usjAGHWSosSFCUUeIkhh3MtZbsaxfsIsNw,9043
7
7
  pyqrack/qrack_neuron_torch_layer.py,sha256=Bs5BLC2GFevfSpo_jSJ2AZl-hfDRJmzlGN9pFw1CtoQ,6160
8
- pyqrack/qrack_simulator.py,sha256=2z4zGNPvDvVz2ctjeJl3jxUnKu0CxkABHvW5zxdUHa8,143781
8
+ pyqrack/qrack_simulator.py,sha256=PSrcEIlzCt33WXjoEo5dZdmzx9zR90QI_Dw9LTphjMg,146030
9
9
  pyqrack/qrack_stabilizer.py,sha256=O-7VJ9Vw4h25PK_kesSjIqHXGSo8lLrQLIyGgmzG7Co,2124
10
10
  pyqrack/quimb_circuit_type.py,sha256=Sk-Tmn38kUYmAkJJ75btWuhYZyTXOOezmowFhfdiGDc,621
11
11
  pyqrack/qrack_system/__init__.py,sha256=-oZ9dsb1hixsnrkUJRY_C5DzQ_l6MtifF_Z465BgqV4,334
12
- pyqrack/qrack_system/qrack_system.py,sha256=FWEMiBfDDoNIAo8jbqFR9MkvRGr6rOU_frvKGMgnTO8,42943
13
- pyqrack/qrack_system/qrack_cl_precompile/qrack_cl_precompile,sha256=h4uBJXqkbvmsBeOvwif3bFqO5-7mBwZilC__mwCPaa8,36224
14
- pyqrack/qrack_system/qrack_lib/libqrack_pinvoke.9.22.0.dylib,sha256=N-C8yc6ByFTNiydaLoPhvDdnVMkEQ_ILrIpS-zhVncA,2857456
15
- pyqrack/qrack_system/qrack_lib/libqrack_pinvoke.dylib,sha256=N-C8yc6ByFTNiydaLoPhvDdnVMkEQ_ILrIpS-zhVncA,2857456
12
+ pyqrack/qrack_system/qrack_system.py,sha256=3NFejSMePILaND-h3bdwRrX-WuhdZj-Uzt-8i90_xQE,43719
13
+ pyqrack/qrack_system/qrack_cl_precompile/qrack_cl_precompile,sha256=WQ9ogDtySxTbg9Fv6wBClCanD5AWqZthx-wz0oulE2g,36224
14
+ pyqrack/qrack_system/qrack_lib/libqrack_pinvoke.9.30.0.dylib,sha256=Co9x5O5OOa_ae0RfZwGjJU9UF66eo0oAgD7QCjq40GY,3573904
15
+ pyqrack/qrack_system/qrack_lib/libqrack_pinvoke.dylib,sha256=Co9x5O5OOa_ae0RfZwGjJU9UF66eo0oAgD7QCjq40GY,3573904
16
16
  pyqrack/stats/__init__.py,sha256=Hla85my2fY_roR9lIjGBVpEG7ySOTMwjWa8D6-kgCnY,276
17
17
  pyqrack/stats/load_quantized_data.py,sha256=z12u9F7Nt3P-i44nY1xxvso_klS6WIHS3iqq7R2_lqE,1184
18
18
  pyqrack/stats/quantize_by_range.py,sha256=UM0_7jJDdQ7g30cR3UQAxkbzkqrmsy1oUfqg0h11FUY,2270
19
- pyqrack_complex128-1.64.0.dist-info/LICENSE,sha256=HxB-7SaWTuewAk1nz-3_3FUD6QhgX73kNT_taKVUTq8,1069
20
- pyqrack_complex128-1.64.0.dist-info/METADATA,sha256=Jc1J3ecSm2BivCTY5a2S5JtOiV3zX5NQvZFn73xFZas,5903
21
- pyqrack_complex128-1.64.0.dist-info/WHEEL,sha256=uKwoxROtjcnx4Gbh9Fbsan8Fm8wY5xdQpS0Bc4agBqM,106
22
- pyqrack_complex128-1.64.0.dist-info/top_level.txt,sha256=YE_3q9JTGRLMilNg2tGP1y7uU-Dx8PDao2OhwoIbv8E,8
23
- pyqrack_complex128-1.64.0.dist-info/RECORD,,
19
+ pyqrack_complex128-1.71.0.dist-info/LICENSE,sha256=HxB-7SaWTuewAk1nz-3_3FUD6QhgX73kNT_taKVUTq8,1069
20
+ pyqrack_complex128-1.71.0.dist-info/METADATA,sha256=Yq0zOTctDAg5NFPy0FUeLfRbUVHkmlKr0OdMqaUptgY,5969
21
+ pyqrack_complex128-1.71.0.dist-info/WHEEL,sha256=uKwoxROtjcnx4Gbh9Fbsan8Fm8wY5xdQpS0Bc4agBqM,106
22
+ pyqrack_complex128-1.71.0.dist-info/top_level.txt,sha256=YE_3q9JTGRLMilNg2tGP1y7uU-Dx8PDao2OhwoIbv8E,8
23
+ pyqrack_complex128-1.71.0.dist-info/RECORD,,