cirq-core 1.2.0.dev20230630133613__py3-none-any.whl → 1.2.0.dev20230704233149__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.
- cirq/_version.py +1 -1
- cirq/sim/state_vector_simulator.py +3 -2
- cirq/sim/state_vector_simulator_test.py +22 -0
- {cirq_core-1.2.0.dev20230630133613.dist-info → cirq_core-1.2.0.dev20230704233149.dist-info}/METADATA +1 -1
- {cirq_core-1.2.0.dev20230630133613.dist-info → cirq_core-1.2.0.dev20230704233149.dist-info}/RECORD +8 -8
- {cirq_core-1.2.0.dev20230630133613.dist-info → cirq_core-1.2.0.dev20230704233149.dist-info}/LICENSE +0 -0
- {cirq_core-1.2.0.dev20230630133613.dist-info → cirq_core-1.2.0.dev20230704233149.dist-info}/WHEEL +0 -0
- {cirq_core-1.2.0.dev20230630133613.dist-info → cirq_core-1.2.0.dev20230704233149.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.2.0.
|
|
1
|
+
__version__ = "1.2.0.dev20230704233149"
|
|
@@ -20,6 +20,7 @@ import numpy as np
|
|
|
20
20
|
|
|
21
21
|
from cirq import _compat, ops, value, qis
|
|
22
22
|
from cirq.sim import simulator, state_vector, simulator_base
|
|
23
|
+
from cirq.protocols import qid_shape
|
|
23
24
|
|
|
24
25
|
if TYPE_CHECKING:
|
|
25
26
|
import cirq
|
|
@@ -31,7 +32,7 @@ TStateVectorStepResult = TypeVar('TStateVectorStepResult', bound='StateVectorSte
|
|
|
31
32
|
class SimulatesIntermediateStateVector(
|
|
32
33
|
Generic[TStateVectorStepResult],
|
|
33
34
|
simulator_base.SimulatorBase[
|
|
34
|
-
TStateVectorStepResult, 'cirq.StateVectorTrialResult', 'cirq.StateVectorSimulationState'
|
|
35
|
+
TStateVectorStepResult, 'cirq.StateVectorTrialResult', 'cirq.StateVectorSimulationState'
|
|
35
36
|
],
|
|
36
37
|
simulator.SimulatesAmplitudes,
|
|
37
38
|
metaclass=abc.ABCMeta,
|
|
@@ -172,7 +173,7 @@ class StateVectorTrialResult(
|
|
|
172
173
|
size = np.prod(shape, dtype=np.int64)
|
|
173
174
|
final = final.reshape(size)
|
|
174
175
|
if len([1 for e in final if abs(e) > 0.001]) < 16:
|
|
175
|
-
state_vector = qis.dirac_notation(final, 3)
|
|
176
|
+
state_vector = qis.dirac_notation(final, 3, qid_shape(substate.qubits))
|
|
176
177
|
else:
|
|
177
178
|
state_vector = str(final)
|
|
178
179
|
label = f'qubits: {substate.qubits}' if substate.qubits else 'phase:'
|
|
@@ -159,6 +159,28 @@ def test_str_big():
|
|
|
159
159
|
assert 'output vector: [0.03125+0.j 0.03125+0.j 0.03125+0.j ..' in str(result)
|
|
160
160
|
|
|
161
161
|
|
|
162
|
+
def test_str_qudit():
|
|
163
|
+
qutrit = cirq.LineQid(0, dimension=3)
|
|
164
|
+
final_simulator_state = cirq.StateVectorSimulationState(
|
|
165
|
+
prng=np.random.RandomState(0),
|
|
166
|
+
qubits=[qutrit],
|
|
167
|
+
initial_state=np.array([0, 0, 1]),
|
|
168
|
+
dtype=np.complex64,
|
|
169
|
+
)
|
|
170
|
+
result = cirq.StateVectorTrialResult(cirq.ParamResolver(), {}, final_simulator_state)
|
|
171
|
+
assert "|2⟩" in str(result)
|
|
172
|
+
|
|
173
|
+
ququart = cirq.LineQid(0, dimension=4)
|
|
174
|
+
final_simulator_state = cirq.StateVectorSimulationState(
|
|
175
|
+
prng=np.random.RandomState(0),
|
|
176
|
+
qubits=[ququart],
|
|
177
|
+
initial_state=np.array([0, 1, 0, 0]),
|
|
178
|
+
dtype=np.complex64,
|
|
179
|
+
)
|
|
180
|
+
result = cirq.StateVectorTrialResult(cirq.ParamResolver(), {}, final_simulator_state)
|
|
181
|
+
assert "|1⟩" in str(result)
|
|
182
|
+
|
|
183
|
+
|
|
162
184
|
def test_pretty_print():
|
|
163
185
|
final_simulator_state = cirq.StateVectorSimulationState(
|
|
164
186
|
available_buffer=np.array([1]),
|
{cirq_core-1.2.0.dev20230630133613.dist-info → cirq_core-1.2.0.dev20230704233149.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cirq-core
|
|
3
|
-
Version: 1.2.0.
|
|
3
|
+
Version: 1.2.0.dev20230704233149
|
|
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
|
{cirq_core-1.2.0.dev20230630133613.dist-info → cirq_core-1.2.0.dev20230704233149.dist-info}/RECORD
RENAMED
|
@@ -4,7 +4,7 @@ cirq/_compat_test.py,sha256=yaTzjrXRFRHRZ5mom2NFrGP-1SeV7AlnH4fMmL5Jeps,33945
|
|
|
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=
|
|
7
|
+
cirq/_version.py,sha256=k1a4_IMZAPnferSuFo0iDuGq31Fkzm0K8qiXKQmIdBk,40
|
|
8
8
|
cirq/_version_test.py,sha256=ZM9GLAiU02rzyJQ_HOT2o_tZixJ0lMXs4tCkOareqTA,133
|
|
9
9
|
cirq/conftest.py,sha256=mHCDs5--u17oLFDAfIlkTS4TRGSc35eLnZ2CXuIuB7I,1175
|
|
10
10
|
cirq/json_resolver_cache.py,sha256=JJiO1dhHsEqYClUv68eg-hiOzbb_C1QiQ-BCcvoe4Ck,13067
|
|
@@ -897,8 +897,8 @@ cirq/sim/sparse_simulator_test.py,sha256=3EAeCHUQeKllAAtdw14X592zBsGQY_vwfIYK-gE
|
|
|
897
897
|
cirq/sim/state_vector.py,sha256=N6N9EELlW66UaLTBaq62ms0XkfIK7CzN9SBM7t52dXo,13428
|
|
898
898
|
cirq/sim/state_vector_simulation_state.py,sha256=ZTmRdf9J--L3hISroWmW9vgqPvj13s99I2axIgV5x7o,17631
|
|
899
899
|
cirq/sim/state_vector_simulation_state_test.py,sha256=UtGMIurlV6N74nX7qoVnGoRhwF35-ghDEIP7Mj5AXmI,9841
|
|
900
|
-
cirq/sim/state_vector_simulator.py,sha256=
|
|
901
|
-
cirq/sim/state_vector_simulator_test.py,sha256=
|
|
900
|
+
cirq/sim/state_vector_simulator.py,sha256=L2S0xyUGqRcVgYdzYef0gVREVZVIDcCXPclVbIJEpPE,7529
|
|
901
|
+
cirq/sim/state_vector_simulator_test.py,sha256=wJq1OZRzKokeM9cJyaJXi6wHH2qi97h0HmJlYOEBDzU,7864
|
|
902
902
|
cirq/sim/state_vector_test.py,sha256=OjhAL2tWqJWstHV8RvJYQVqg95zm0PcS9nQKrLOhMmQ,16934
|
|
903
903
|
cirq/sim/clifford/__init__.py,sha256=lD7l6JuE5n0xwvOYNYH-giCH3qAEVH1SUwDrZM1jKKY,636
|
|
904
904
|
cirq/sim/clifford/clifford_simulator.py,sha256=6M69sv6IbtJTOk5ZE8CGWiILf6Ee2sCEALiZaw9NmvQ,9735
|
|
@@ -1136,8 +1136,8 @@ cirq/work/sampler.py,sha256=JVv1vvfa6EgFiR3UeDk44U186dCrioH2NZXueCgsb9w,19828
|
|
|
1136
1136
|
cirq/work/sampler_test.py,sha256=zo1Hj6sn6fLs_WZMxYRApBqgBsldmptn74NL0jhNukc,12325
|
|
1137
1137
|
cirq/work/zeros_sampler.py,sha256=D3hbNZC-jXKuNAWg2OUiUuT8pmDV_WFnEfMank6In4o,2357
|
|
1138
1138
|
cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
|
|
1139
|
-
cirq_core-1.2.0.
|
|
1140
|
-
cirq_core-1.2.0.
|
|
1141
|
-
cirq_core-1.2.0.
|
|
1142
|
-
cirq_core-1.2.0.
|
|
1143
|
-
cirq_core-1.2.0.
|
|
1139
|
+
cirq_core-1.2.0.dev20230704233149.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1140
|
+
cirq_core-1.2.0.dev20230704233149.dist-info/METADATA,sha256=59UAg0yYVU9wwJDLEW7dnwd6O3pslgVl4P1V8T-siHY,2095
|
|
1141
|
+
cirq_core-1.2.0.dev20230704233149.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
1142
|
+
cirq_core-1.2.0.dev20230704233149.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1143
|
+
cirq_core-1.2.0.dev20230704233149.dist-info/RECORD,,
|
{cirq_core-1.2.0.dev20230630133613.dist-info → cirq_core-1.2.0.dev20230704233149.dist-info}/LICENSE
RENAMED
|
File without changes
|
{cirq_core-1.2.0.dev20230630133613.dist-info → cirq_core-1.2.0.dev20230704233149.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|