pyqrack-cpu 1.32.19__tar.gz → 1.32.21__tar.gz
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-cpu might be problematic. Click here for more details.
- {pyqrack_cpu-1.32.19/pyqrack_cpu.egg-info → pyqrack_cpu-1.32.21}/PKG-INFO +1 -1
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack/qrack_circuit.py +50 -8
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21/pyqrack_cpu.egg-info}/PKG-INFO +1 -1
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/setup.py +3 -3
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/LICENSE +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/MANIFEST.in +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/README.md +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyproject.toml +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack/__init__.py +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack/pauli.py +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack/qrack_simulator.py +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack/qrack_system/qrack_system.py +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack/util/__init__.py +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack/util/convert_qiskit_circuit_to_qasm_experiment.py +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack_cpu.egg-info/SOURCES.txt +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack_cpu.egg-info/dependency_links.txt +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack_cpu.egg-info/not-zip-safe +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack_cpu.egg-info/requires.txt +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/pyqrack_cpu.egg-info/top_level.txt +0 -0
- {pyqrack_cpu-1.32.19 → pyqrack_cpu-1.32.21}/setup.cfg +0 -0
|
@@ -12,7 +12,7 @@ _IS_QISKIT_AVAILABLE = True
|
|
|
12
12
|
try:
|
|
13
13
|
from qiskit.circuit.quantumcircuit import QuantumCircuit
|
|
14
14
|
from qiskit.compiler.transpiler import transpile
|
|
15
|
-
from qiskit.circuit.library import UCGate
|
|
15
|
+
from qiskit.circuit.library import U3Gate, UCGate
|
|
16
16
|
import numpy as np
|
|
17
17
|
import math
|
|
18
18
|
except ImportError:
|
|
@@ -31,6 +31,23 @@ try:
|
|
|
31
31
|
except ImportError:
|
|
32
32
|
_IS_TENSORCIRCUIT_AVAILABLE = False
|
|
33
33
|
|
|
34
|
+
|
|
35
|
+
def euler_angles_1q(m):
|
|
36
|
+
phase = (m[0][0] * m[1][1] - m[0][1] * m[1][0]) ** (-1.0/2.0)
|
|
37
|
+
U = [[phase * m[0][0], phase * m[0][1]], [phase * m[1][0], phase * m[1][1]]]
|
|
38
|
+
|
|
39
|
+
theta = 2 * math.atan2(abs(U[1][0]), abs(U[0][0]))
|
|
40
|
+
|
|
41
|
+
# Find phi and lambda
|
|
42
|
+
phiplambda = 2 * np.angle(U[1][1])
|
|
43
|
+
phimlambda = 2 * np.angle(U[1][0])
|
|
44
|
+
|
|
45
|
+
phi = (phiplambda + phimlambda) / 2.0
|
|
46
|
+
lamb = (phiplambda - phimlambda) / 2.0
|
|
47
|
+
|
|
48
|
+
return theta, phi, lamb
|
|
49
|
+
|
|
50
|
+
|
|
34
51
|
class QrackCircuit:
|
|
35
52
|
"""Class that exposes the QCircuit class of Qrack
|
|
36
53
|
|
|
@@ -200,6 +217,19 @@ class QrackCircuit:
|
|
|
200
217
|
|
|
201
218
|
return out
|
|
202
219
|
|
|
220
|
+
def file_gate_count(filename):
|
|
221
|
+
"""File gate count
|
|
222
|
+
|
|
223
|
+
Return the count of gates in a QrackCircuit file
|
|
224
|
+
|
|
225
|
+
Args:
|
|
226
|
+
filename: Name of file
|
|
227
|
+
"""
|
|
228
|
+
tokens = []
|
|
229
|
+
with open(filename, 'r') as file:
|
|
230
|
+
tokens = file.read().split()
|
|
231
|
+
return int(tokens[1])
|
|
232
|
+
|
|
203
233
|
def file_to_qiskit_circuit(filename):
|
|
204
234
|
"""Convert an output file to a Qiskit circuit
|
|
205
235
|
|
|
@@ -286,13 +316,25 @@ class QrackCircuit:
|
|
|
286
316
|
payloads[key] = np.array(op)
|
|
287
317
|
|
|
288
318
|
gate_list = []
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
319
|
+
control_pow = 1 << control_count
|
|
320
|
+
pLen = len(payloads)
|
|
321
|
+
if (pLen == 1) or ((control_pow - pLen) > (1 << 15)):
|
|
322
|
+
for c, p in payloads.items():
|
|
323
|
+
theta, phi, lam = euler_angles_1q(p)
|
|
324
|
+
if control_count > 0:
|
|
325
|
+
circ.append(
|
|
326
|
+
U3Gate(theta, phi, lam).control(num_ctrl_qubits=control_count, ctrl_state=c),
|
|
327
|
+
controls + [target]
|
|
328
|
+
)
|
|
329
|
+
else:
|
|
330
|
+
circ.append(U3Gate(theta, phi, lam), [target])
|
|
331
|
+
else:
|
|
332
|
+
for j in range(control_pow):
|
|
333
|
+
if j in payloads:
|
|
334
|
+
gate_list.append(payloads[j])
|
|
335
|
+
else:
|
|
336
|
+
gate_list.append(np.array([[1, 0],[0, 1]]))
|
|
337
|
+
circ.append(UCGate(gate_list), controls + [target])
|
|
296
338
|
|
|
297
339
|
return circ
|
|
298
340
|
|
|
@@ -4,7 +4,7 @@ import os
|
|
|
4
4
|
from setuptools import setup
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
VERSION = "1.32.
|
|
7
|
+
VERSION = "1.32.21"
|
|
8
8
|
|
|
9
9
|
# Read long description from README.
|
|
10
10
|
README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.md')
|
|
@@ -50,14 +50,14 @@ setup(
|
|
|
50
50
|
"Programming Language :: Python :: 3.10",
|
|
51
51
|
"Programming Language :: Python :: 3.11",
|
|
52
52
|
"Programming Language :: Python :: 3.12",
|
|
53
|
-
"Topic :: Scientific/Engineering"
|
|
53
|
+
"Topic :: Scientific/Engineering",
|
|
54
54
|
],
|
|
55
55
|
keywords="pyqrack qrack simulator quantum gpu",
|
|
56
56
|
install_requires=[],
|
|
57
57
|
setup_requires=[],
|
|
58
58
|
extras_require={
|
|
59
59
|
"dev": [
|
|
60
|
-
"pytest>=7.3.1"
|
|
60
|
+
"pytest>=7.3.1",
|
|
61
61
|
],
|
|
62
62
|
},
|
|
63
63
|
include_package_data=True,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|