pyqrack-cuda 1.35.6__tar.gz → 1.35.9__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.
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/Makefile +1 -1
- {pyqrack_cuda-1.35.6/pyqrack_cuda.egg-info → pyqrack_cuda-1.35.9}/PKG-INFO +1 -1
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack/qrack_simulator.py +57 -63
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack/qrack_system/qrack_system.py +2 -2
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack_cuda.egg-info/SOURCES.txt +0 -2
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/setup.py +2 -2
- pyqrack_cuda-1.35.6/pyqrack/util/__init__.py +0 -8
- pyqrack_cuda-1.35.6/pyqrack/util/convert_qiskit_circuit_to_qasm_experiment.py +0 -61
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/LICENSE +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/MANIFEST.in +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/README.md +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyproject.toml +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack/__init__.py +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack/pauli.py +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack/qrack_circuit.py +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack_cuda.egg-info/requires.txt +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/pyqrack_cuda.egg-info/top_level.txt +0 -0
- {pyqrack_cuda-1.35.6 → pyqrack_cuda-1.35.9}/setup.cfg +0 -0
@@ -18,7 +18,7 @@ help:
|
|
18
18
|
build-deps:
|
19
19
|
ifneq ($(OS),Windows_NT)
|
20
20
|
ifeq ($(QRACK_PRESENT),)
|
21
|
-
git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout
|
21
|
+
git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout 1f3b62725624749f1b4b2c36f3503e5c204fa152; cd ..
|
22
22
|
endif
|
23
23
|
mkdir -p qrack/build
|
24
24
|
ifeq ($(UNAME_S),Linux)
|
@@ -15,9 +15,7 @@ _IS_QISKIT_AVAILABLE = True
|
|
15
15
|
try:
|
16
16
|
from qiskit.circuit.quantumcircuit import QuantumCircuit
|
17
17
|
from qiskit.compiler import transpile
|
18
|
-
from qiskit.qobj.qasm_qobj import QasmQobjExperiment
|
19
18
|
from qiskit.quantum_info.operators.symplectic.clifford import Clifford
|
20
|
-
from .util import convert_qiskit_circuit_to_qasm_experiment
|
21
19
|
except ImportError:
|
22
20
|
_IS_QISKIT_AVAILABLE = False
|
23
21
|
|
@@ -3265,7 +3263,7 @@ class QrackSimulator:
|
|
3265
3263
|
non_clifford_gates.append(op)
|
3266
3264
|
g = g + 1
|
3267
3265
|
|
3268
|
-
basis_gates = ["rz", "h", "x", "y", "z", "sx", "sxdg", "
|
3266
|
+
basis_gates = ["rz", "h", "x", "y", "z", "sx", "sxdg", "s", "sdg", "t", "tdg", "cx", "cy", "cz", "swap"]
|
3269
3267
|
try:
|
3270
3268
|
circ = transpile(clifford_circ, basis_gates=basis_gates, optimization_level=2)
|
3271
3269
|
except:
|
@@ -3337,7 +3335,7 @@ class QrackSimulator:
|
|
3337
3335
|
sqrt_ni = np.sqrt(-1j)
|
3338
3336
|
sqrt1_2 = 1 / math.sqrt(2)
|
3339
3337
|
ident = np.eye(2, dtype=np.complex128)
|
3340
|
-
# passable_gates = ["unitary", "rz", "h", "x", "y", "z", "sx", "sxdg", "
|
3338
|
+
# passable_gates = ["unitary", "rz", "h", "x", "y", "z", "sx", "sxdg", "s", "sdg", "t", "tdg"]
|
3341
3339
|
|
3342
3340
|
passed_swaps = []
|
3343
3341
|
for i in range(0, circ.width()):
|
@@ -3565,7 +3563,7 @@ class QrackSimulator:
|
|
3565
3563
|
circ.data.insert(j, copy.deepcopy(c.data[0]))
|
3566
3564
|
j -= 1
|
3567
3565
|
|
3568
|
-
basis_gates=["u", "rz", "h", "x", "y", "z", "sx", "sxdg", "
|
3566
|
+
basis_gates=["u", "rz", "h", "x", "y", "z", "sx", "sxdg", "s", "sdg", "t", "tdg", "cx", "cy", "cz", "swap"]
|
3569
3567
|
circ = transpile(circ, basis_gates=basis_gates, optimization_level=2)
|
3570
3568
|
|
3571
3569
|
#Eliminate unused ancillae
|
@@ -3662,150 +3660,150 @@ class QrackSimulator:
|
|
3662
3660
|
return
|
3663
3661
|
|
3664
3662
|
if (name == 'u1') or (name == 'p'):
|
3665
|
-
self._sim.u(operation.qubits[0], 0, 0, float(operation.params[0]))
|
3663
|
+
self._sim.u(operation.qubits[0]._index, 0, 0, float(operation.params[0]))
|
3666
3664
|
elif name == 'u2':
|
3667
3665
|
self._sim.u(
|
3668
|
-
operation.qubits[0],
|
3666
|
+
operation.qubits[0]._index,
|
3669
3667
|
math.pi / 2,
|
3670
3668
|
float(operation.params[0]),
|
3671
3669
|
float(operation.params[1]),
|
3672
3670
|
)
|
3673
3671
|
elif (name == 'u3') or (name == 'u'):
|
3674
3672
|
self._sim.u(
|
3675
|
-
operation.qubits[0],
|
3673
|
+
operation.qubits[0]._index,
|
3676
3674
|
float(operation.params[0]),
|
3677
3675
|
float(operation.params[1]),
|
3678
3676
|
float(operation.params[2]),
|
3679
3677
|
)
|
3680
3678
|
elif (name == 'unitary') and (len(operation.qubits) == 1):
|
3681
|
-
self._sim.mtrx(operation.params[0].flatten(), operation.qubits[0])
|
3679
|
+
self._sim.mtrx(operation.params[0].flatten(), operation.qubits[0]._index)
|
3682
3680
|
elif name == 'r':
|
3683
3681
|
self._sim.u(
|
3684
|
-
operation.qubits[0],
|
3682
|
+
operation.qubits[0]._index,
|
3685
3683
|
float(operation.params[0]),
|
3686
3684
|
float(operation.params[1]) - math.pi / 2,
|
3687
3685
|
(-1 * float(operation.params[1])) + math.pi / 2,
|
3688
3686
|
)
|
3689
3687
|
elif name == 'rx':
|
3690
|
-
self._sim.r(Pauli.PauliX, float(operation.params[0]), operation.qubits[0])
|
3688
|
+
self._sim.r(Pauli.PauliX, float(operation.params[0]), operation.qubits[0]._index)
|
3691
3689
|
elif name == 'ry':
|
3692
|
-
self._sim.r(Pauli.PauliY, float(operation.params[0]), operation.qubits[0])
|
3690
|
+
self._sim.r(Pauli.PauliY, float(operation.params[0]), operation.qubits[0]._index)
|
3693
3691
|
elif name == 'rz':
|
3694
|
-
self._sim.r(Pauli.PauliZ, float(operation.params[0]), operation.qubits[0])
|
3692
|
+
self._sim.r(Pauli.PauliZ, float(operation.params[0]), operation.qubits[0]._index)
|
3695
3693
|
elif name == 'h':
|
3696
|
-
self._sim.h(operation.qubits[0])
|
3694
|
+
self._sim.h(operation.qubits[0]._index)
|
3697
3695
|
elif name == 'x':
|
3698
|
-
self._sim.x(operation.qubits[0])
|
3696
|
+
self._sim.x(operation.qubits[0]._index)
|
3699
3697
|
elif name == 'y':
|
3700
|
-
self._sim.y(operation.qubits[0])
|
3698
|
+
self._sim.y(operation.qubits[0]._index)
|
3701
3699
|
elif name == 'z':
|
3702
|
-
self._sim.z(operation.qubits[0])
|
3700
|
+
self._sim.z(operation.qubits[0]._index)
|
3703
3701
|
elif name == 's':
|
3704
|
-
self._sim.s(operation.qubits[0])
|
3702
|
+
self._sim.s(operation.qubits[0]._index)
|
3705
3703
|
elif name == 'sdg':
|
3706
|
-
self._sim.adjs(operation.qubits[0])
|
3704
|
+
self._sim.adjs(operation.qubits[0]._index)
|
3707
3705
|
elif name == 'sx':
|
3708
3706
|
self._sim.mtrx(
|
3709
3707
|
[(1 + 1j) / 2, (1 - 1j) / 2, (1 - 1j) / 2, (1 + 1j) / 2],
|
3710
|
-
operation.qubits[0],
|
3708
|
+
operation.qubits[0]._index,
|
3711
3709
|
)
|
3712
3710
|
elif name == 'sxdg':
|
3713
3711
|
self._sim.mtrx(
|
3714
3712
|
[(1 - 1j) / 2, (1 + 1j) / 2, (1 + 1j) / 2, (1 - 1j) / 2],
|
3715
|
-
operation.qubits[0],
|
3713
|
+
operation.qubits[0]._index,
|
3716
3714
|
)
|
3717
3715
|
elif name == 't':
|
3718
|
-
self._sim.t(operation.qubits[0])
|
3716
|
+
self._sim.t(operation.qubits[0]._index)
|
3719
3717
|
elif name == 'tdg':
|
3720
|
-
self._sim.adjt(operation.qubits[0])
|
3718
|
+
self._sim.adjt(operation.qubits[0]._index)
|
3721
3719
|
elif name == 'cu1':
|
3722
3720
|
self._sim.mcu(
|
3723
|
-
operation.qubits[0:1], operation.qubits[1], 0, 0, float(operation.params[0])
|
3721
|
+
[q._index for q in operation.qubits[0:1]], operation.qubits[1]._index, 0, 0, float(operation.params[0])
|
3724
3722
|
)
|
3725
3723
|
elif name == 'cu2':
|
3726
3724
|
self._sim.mcu(
|
3727
|
-
operation.qubits[0:1],
|
3728
|
-
operation.qubits[1],
|
3725
|
+
[q._index for q in operation.qubits[0:1]],
|
3726
|
+
operation.qubits[1]._index,
|
3729
3727
|
math.pi / 2,
|
3730
3728
|
float(operation.params[0]),
|
3731
3729
|
float(operation.params[1]),
|
3732
3730
|
)
|
3733
3731
|
elif (name == 'cu3') or (name == 'cu'):
|
3734
3732
|
self._sim.mcu(
|
3735
|
-
operation.qubits[0:1],
|
3736
|
-
operation.qubits[1],
|
3733
|
+
[q._index for q in operation.qubits[0:1]],
|
3734
|
+
operation.qubits[1]._index,
|
3737
3735
|
float(operation.params[0]),
|
3738
3736
|
float(operation.params[1]),
|
3739
3737
|
float(operation.params[2]),
|
3740
3738
|
)
|
3741
3739
|
elif name == 'cx':
|
3742
|
-
self._sim.mcx(operation.qubits[0:1], operation.qubits[1])
|
3740
|
+
self._sim.mcx([q._index for q in operation.qubits[0:1]], operation.qubits[1]._index)
|
3743
3741
|
elif name == 'cy':
|
3744
|
-
self._sim.mcy(operation.qubits[0:1], operation.qubits[1])
|
3742
|
+
self._sim.mcy([q._index for q in operation.qubits[0:1]], operation.qubits[1]._index)
|
3745
3743
|
elif name == 'cz':
|
3746
|
-
self._sim.mcz(operation.qubits[0:1], operation.qubits[1])
|
3744
|
+
self._sim.mcz([q._index for q in operation.qubits[0:1]], operation.qubits[1]._index)
|
3747
3745
|
elif name == 'ch':
|
3748
|
-
self._sim.mch(operation.qubits[0:1], operation.qubits[1])
|
3746
|
+
self._sim.mch([q._index for q in operation.qubits[0:1]], operation.qubits[1]._index)
|
3749
3747
|
elif name == 'cp':
|
3750
3748
|
self._sim.mcmtrx(
|
3751
|
-
operation.qubits[0:1],
|
3749
|
+
[q._index for q in operation.qubits[0:1]],
|
3752
3750
|
[
|
3753
3751
|
1,
|
3754
3752
|
0,
|
3755
3753
|
0,
|
3756
3754
|
math.cos(float(operation.params[0])) + 1j * math.sin(float(operation.params[0])),
|
3757
3755
|
],
|
3758
|
-
operation.qubits[1],
|
3756
|
+
operation.qubits[1]._index,
|
3759
3757
|
)
|
3760
3758
|
elif name == 'csx':
|
3761
3759
|
self._sim.mcmtrx(
|
3762
|
-
operation.qubits[0:1],
|
3760
|
+
[q._index for q in operation.qubits[0:1]],
|
3763
3761
|
[(1 + 1j) / 2, (1 - 1j) / 2, (1 - 1j) / 2, (1 + 1j) / 2],
|
3764
|
-
operation.qubits[1],
|
3762
|
+
operation.qubits[1]._index,
|
3765
3763
|
)
|
3766
3764
|
elif name == 'csxdg':
|
3767
3765
|
self._sim.mcmtrx(
|
3768
|
-
operation.qubits[0:1],
|
3766
|
+
[q._index for q in operation.qubits[0:1]],
|
3769
3767
|
[(1 - 1j) / 2, (1 + 1j) / 2, (1 + 1j) / 2, (1 - 1j) / 2],
|
3770
|
-
operation.qubits[1],
|
3768
|
+
operation.qubits[1]._index,
|
3771
3769
|
)
|
3772
3770
|
elif name == 'dcx':
|
3773
|
-
self._sim.mcx(operation.qubits[0:1], operation.qubits[1])
|
3774
|
-
self._sim.mcx(operation.qubits[1:2], operation.qubits[0])
|
3771
|
+
self._sim.mcx([q._index for q in operation.qubits[0:1]], operation.qubits[1]._index)
|
3772
|
+
self._sim.mcx(operation.qubits[1:2]._index, operation.qubits[0]._index)
|
3775
3773
|
elif name == 'ccx':
|
3776
|
-
self._sim.mcx(operation.qubits[0:2], operation.qubits[2])
|
3774
|
+
self._sim.mcx([q._index for q in operation.qubits[0:2]], operation.qubits[2]._index)
|
3777
3775
|
elif name == 'ccy':
|
3778
|
-
self._sim.mcy(operation.qubits[0:2], operation.qubits[2])
|
3776
|
+
self._sim.mcy([q._index for q in operation.qubits[0:2]], operation.qubits[2]._index)
|
3779
3777
|
elif name == 'ccz':
|
3780
|
-
self._sim.mcz(operation.qubits[0:2], operation.qubits[2])
|
3778
|
+
self._sim.mcz([q._index for q in operation.qubits[0:2]], operation.qubits[2]._index)
|
3781
3779
|
elif name == 'mcx':
|
3782
|
-
self._sim.mcx(operation.qubits[0:-1], operation.qubits[-1])
|
3780
|
+
self._sim.mcx([q._index for q in operation.qubits[0:-1]], operation.qubits[-1]._index)
|
3783
3781
|
elif name == 'mcy':
|
3784
|
-
self._sim.mcy(operation.qubits[0:-1], operation.qubits[-1])
|
3782
|
+
self._sim.mcy([q._index for q in operation.qubits[0:-1]], operation.qubits[-1]._index)
|
3785
3783
|
elif name == 'mcz':
|
3786
|
-
self._sim.mcz(operation.qubits[0:-1], operation.qubits[-1])
|
3784
|
+
self._sim.mcz([q._index for q in operation.qubits[0:-1]], operation.qubits[-1]._index)
|
3787
3785
|
elif name == 'swap':
|
3788
|
-
self._sim.swap(operation.qubits[0], operation.qubits[1])
|
3786
|
+
self._sim.swap(operation.qubits[0]._index, operation.qubits[1]._index)
|
3789
3787
|
elif name == 'iswap':
|
3790
|
-
self._sim.iswap(operation.qubits[0], operation.qubits[1])
|
3788
|
+
self._sim.iswap(operation.qubits[0]._index, operation.qubits[1]._index)
|
3791
3789
|
elif name == 'iswap_dg':
|
3792
|
-
self._sim.adjiswap(operation.qubits[0], operation.qubits[1])
|
3790
|
+
self._sim.adjiswap(operation.qubits[0]._index, operation.qubits[1]._index)
|
3793
3791
|
elif name == 'cswap':
|
3794
3792
|
self._sim.cswap(
|
3795
|
-
operation.qubits[0:1], operation.qubits[1], operation.qubits[2]
|
3793
|
+
[q._index for q in operation.qubits[0:1]], operation.qubits[1]._index, operation.qubits[2]._index
|
3796
3794
|
)
|
3797
3795
|
elif name == 'mcswap':
|
3798
3796
|
self._sim.cswap(
|
3799
|
-
operation.qubits[:-2], operation.qubits[-2], operation.qubits[-1]
|
3797
|
+
[q._index for q in operation.qubits[:-2]], operation.qubits[-2]._index, operation.qubits[-1]._index
|
3800
3798
|
)
|
3801
3799
|
elif name == 'reset':
|
3802
3800
|
qubits = operation.qubits
|
3803
3801
|
for qubit in qubits:
|
3804
|
-
if self._sim.m(qubit):
|
3805
|
-
self._sim.x(qubit)
|
3802
|
+
if self._sim.m(qubit._index):
|
3803
|
+
self._sim.x(qubit._index)
|
3806
3804
|
elif name == 'measure':
|
3807
3805
|
qubits = operation.qubits
|
3808
|
-
clbits = operation.
|
3806
|
+
clbits = operation.clbits
|
3809
3807
|
cregbits = (
|
3810
3808
|
operation.register
|
3811
3809
|
if hasattr(operation, 'register')
|
@@ -3892,7 +3890,6 @@ class QrackSimulator:
|
|
3892
3890
|
measure_clbit = [clbit for clbit in sample_clbits]
|
3893
3891
|
|
3894
3892
|
# Sample and convert to bit-strings
|
3895
|
-
data = []
|
3896
3893
|
if num_samples == 1:
|
3897
3894
|
sample = self._sim.m_all()
|
3898
3895
|
result = 0
|
@@ -3902,12 +3899,13 @@ class QrackSimulator:
|
|
3902
3899
|
result |= qubit_outcome << index
|
3903
3900
|
measure_results = [result]
|
3904
3901
|
else:
|
3905
|
-
measure_results = self._sim.measure_shots(measure_qubit, num_samples)
|
3902
|
+
measure_results = self._sim.measure_shots([q._index for q in measure_qubit], num_samples)
|
3906
3903
|
|
3904
|
+
data = []
|
3907
3905
|
for sample in measure_results:
|
3908
3906
|
for index in range(len(measure_qubit)):
|
3909
3907
|
qubit_outcome = (sample >> index) & 1
|
3910
|
-
clbit = measure_clbit[index]
|
3908
|
+
clbit = measure_clbit[index]._index
|
3911
3909
|
clmask = 1 << clbit
|
3912
3910
|
self._classical_memory = (self._classical_memory & (~clmask)) | (
|
3913
3911
|
qubit_outcome << clbit
|
@@ -3923,12 +3921,9 @@ class QrackSimulator:
|
|
3923
3921
|
"Before trying to run_qiskit_circuit() with QrackSimulator, you must install Qiskit!"
|
3924
3922
|
)
|
3925
3923
|
|
3926
|
-
if isinstance(experiment, QuantumCircuit):
|
3927
|
-
experiment = convert_qiskit_circuit_to_qasm_experiment(experiment)
|
3928
|
-
|
3929
3924
|
instructions = []
|
3930
|
-
if isinstance(experiment,
|
3931
|
-
instructions = experiment.
|
3925
|
+
if isinstance(experiment, QuantumCircuit):
|
3926
|
+
instructions = experiment.data
|
3932
3927
|
else:
|
3933
3928
|
raise RuntimeError('Unrecognized "run_input" argument specified for run().')
|
3934
3929
|
|
@@ -3938,7 +3933,6 @@ class QrackSimulator:
|
|
3938
3933
|
self._sample_cregbits = []
|
3939
3934
|
self._sample_measure = True
|
3940
3935
|
_data = []
|
3941
|
-
shotsPerLoop = self._shots
|
3942
3936
|
shotLoopMax = 1
|
3943
3937
|
|
3944
3938
|
is_initializing = True
|
@@ -36,7 +36,7 @@ class QrackSystem:
|
|
36
36
|
self.qrack_lib = CDLL(shared_lib_path)
|
37
37
|
except Exception as e:
|
38
38
|
if _platform == "win32":
|
39
|
-
shared_lib_path = "C:/Program Files/
|
39
|
+
shared_lib_path = "C:/Program Files (x86)/Qrack/bin/qrack_pinvoke.dll"
|
40
40
|
elif _platform == "darwin":
|
41
41
|
shared_lib_path = "/usr/local/lib/qrack/libqrack_pinvoke.dylib"
|
42
42
|
else:
|
@@ -46,7 +46,7 @@ class QrackSystem:
|
|
46
46
|
self.qrack_lib = CDLL(shared_lib_path)
|
47
47
|
except Exception as e:
|
48
48
|
if _platform == "win32":
|
49
|
-
shared_lib_path = "C:/Program Files (x86)/
|
49
|
+
shared_lib_path = "C:/Program Files (x86)/Qrack/bin/qrack_pinvoke.dll"
|
50
50
|
elif _platform == "darwin":
|
51
51
|
shared_lib_path = "/usr/lib/qrack/libqrack_pinvoke.dylib"
|
52
52
|
else:
|
@@ -13,8 +13,6 @@ pyqrack/qrack_simulator.py
|
|
13
13
|
pyqrack/quimb_circuit_type.py
|
14
14
|
pyqrack/qrack_system/__init__.py
|
15
15
|
pyqrack/qrack_system/qrack_system.py
|
16
|
-
pyqrack/util/__init__.py
|
17
|
-
pyqrack/util/convert_qiskit_circuit_to_qasm_experiment.py
|
18
16
|
pyqrack_cuda.egg-info/PKG-INFO
|
19
17
|
pyqrack_cuda.egg-info/SOURCES.txt
|
20
18
|
pyqrack_cuda.egg-info/dependency_links.txt
|
@@ -7,7 +7,7 @@ from setuptools import setup
|
|
7
7
|
from setuptools.command.build_py import build_py
|
8
8
|
|
9
9
|
|
10
|
-
VERSION = "1.35.
|
10
|
+
VERSION = "1.35.9"
|
11
11
|
|
12
12
|
# Read long description from README.
|
13
13
|
README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.md')
|
@@ -27,7 +27,7 @@ class Build(build_py):
|
|
27
27
|
setup(
|
28
28
|
name='pyqrack-cuda',
|
29
29
|
version=VERSION,
|
30
|
-
packages=['pyqrack', 'pyqrack.qrack_system'
|
30
|
+
packages=['pyqrack', 'pyqrack.qrack_system'],
|
31
31
|
cmdclass={"build_py": Build},
|
32
32
|
description="pyqrack - Pure Python vm6502q/qrack Wrapper",
|
33
33
|
long_description=README,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# (C) Daniel Strano and the Qrack contributors 2017-2021. All rights reserved.
|
2
|
-
#
|
3
|
-
# Use of this source code is governed by an MIT-style license that can be
|
4
|
-
# found in the LICENSE file or at https://opensource.org/licenses/MIT.
|
5
|
-
|
6
|
-
from .convert_qiskit_circuit_to_qasm_experiment import (
|
7
|
-
convert_qiskit_circuit_to_qasm_experiment,
|
8
|
-
)
|
@@ -1,61 +0,0 @@
|
|
1
|
-
_IS_QISKIT_AVAILABLE = True
|
2
|
-
try:
|
3
|
-
from qiskit.circuit.quantumcircuit import QuantumCircuit
|
4
|
-
from qiskit.qobj.qasm_qobj import QasmQobjExperiment, QasmQobjInstruction
|
5
|
-
except ImportError:
|
6
|
-
_IS_QISKIT_AVAILABLE = False
|
7
|
-
|
8
|
-
|
9
|
-
class QrackQasmQobjInstructionConditional:
|
10
|
-
def __init__(self, mask, val):
|
11
|
-
self.mask = mask
|
12
|
-
self.val = val
|
13
|
-
|
14
|
-
|
15
|
-
def convert_qiskit_circuit_to_qasm_experiment(experiment, config=None, header=None):
|
16
|
-
if not _IS_QISKIT_AVAILABLE:
|
17
|
-
raise RuntimeError(
|
18
|
-
"Before trying to convert_circuit_to_qasm_experiment() with QrackSimulator, you must install Qiskit!"
|
19
|
-
)
|
20
|
-
|
21
|
-
instructions = []
|
22
|
-
for datum in experiment._data:
|
23
|
-
qubits = []
|
24
|
-
for qubit in datum[1]:
|
25
|
-
qubits.append(experiment.qubits.index(qubit))
|
26
|
-
|
27
|
-
clbits = []
|
28
|
-
for clbit in datum[2]:
|
29
|
-
clbits.append(experiment.clbits.index(clbit))
|
30
|
-
|
31
|
-
conditional = None
|
32
|
-
condition = datum[0].condition
|
33
|
-
if condition is not None:
|
34
|
-
if isinstance(condition[0], Clbit):
|
35
|
-
conditional = experiment.clbits.index(condition[0])
|
36
|
-
else:
|
37
|
-
creg_index = experiment.cregs.index(condition[0])
|
38
|
-
size = experiment.cregs[creg_index].size
|
39
|
-
offset = 0
|
40
|
-
for i in range(creg_index):
|
41
|
-
offset += len(experiment.cregs[i])
|
42
|
-
mask = ((1 << offset) - 1) ^ ((1 << (offset + size)) - 1)
|
43
|
-
val = condition[1]
|
44
|
-
conditional = (
|
45
|
-
offset
|
46
|
-
if (size == 1)
|
47
|
-
else QrackQasmQobjInstructionConditional(mask, val)
|
48
|
-
)
|
49
|
-
|
50
|
-
instructions.append(
|
51
|
-
QasmQobjInstruction(
|
52
|
-
datum[0].name,
|
53
|
-
qubits=qubits,
|
54
|
-
memory=clbits,
|
55
|
-
condition=condition,
|
56
|
-
conditional=conditional,
|
57
|
-
params=datum[0].params,
|
58
|
-
)
|
59
|
-
)
|
60
|
-
|
61
|
-
return QasmQobjExperiment(config=config, header=header, instructions=instructions)
|
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
|