stim-1.9.0
1.9.0
1.8.0
1.7.1
1.7.0
1.16.dev1770241571
1.16.dev1770174832
1.16.dev1770171649
1.16.dev1768963940
1.16.dev1768882982
1.16.dev1768553279
1.16.dev1768529462
1.16.dev1768525144
1.16.dev1768520142
1.16.dev1768509619
1.16.dev1768465883
1.16.dev1768463664
1.16.dev1768461476
1.16.dev1768459926
1.16.dev1768340014
1.16.dev1768331784
1.16.dev1768329600
1.16.dev1761611832
1.16.dev1758926350
1.16.dev1758580558
1.16.dev1757527933
1.16.dev1757476334
1.16.dev1755812119
1.16.dev1754438568
1.16.dev1753867049
1.16.dev1753811344
1.16.dev1751171094
1.16.dev1751065005
1.16.dev1751039605
1.16.dev1751007257
1.16.dev1750925622
1.16.dev1750923543
1.16.dev1748073630
1.16.dev1747178717
1.16.dev1746845336
1.16.dev1746599232
1.15.dev1746595831
1.15.dev1745883134
1.15.dev1745828296
1.15.dev1745621353
1.15.dev1745544934
1.15.dev1745405475
1.15.dev1745383124
1.15.dev1744789797
1.15.dev1744697311
1.15.dev1744231916
1.15.dev1743900324
1.15.dev1743897268
1.15.dev1743894906
1.15.dev1743893588
1.15.dev1743880617
1.15.dev1743876136
1.15.dev1743871966
1.15.dev1743819490
1.15.dev1743569532
1.15.dev1743543556
1.15.dev1743105184
1.15.dev1742879845
1.15.dev1742871434
1.15.dev1742866465
1.15.dev1742863809
1.15.dev1742861634
1.15.dev1742858851
1.15.dev1742838562
1.15.dev1742010621
1.15.dev1741992867
1.15.dev1741128853
1.15.dev1741126803
1.15.dev1741048818
1.15.dev1741046612
1.15.dev1741042613
1.15.dev1741040425
1.15.dev1738886522
1.15.dev1738710176
1.15.dev1738352709
1.15.dev1738302984
1.15.dev1737977492
1.15.dev1737603589
1.15.dev1737498006
1.15.dev1734387727
1.15.dev1733420295
1.15.dev1733303566
1.15.dev1733301548
1.15.dev1730523741
1.15.dev1730500841
1.15.dev1730154364
1.15.dev1728688449
1.15.dev1727166840
1.15.0
1.14.dev1727164676
1.14.dev1727163064
1.14.dev1727161109
1.14.dev1726902167
1.14.dev1726900525
1.14.dev1726895845
1.14.dev1726889409
1.14.dev1726430915
1.14.dev1726206696
1.14.dev1726187406
1.14.dev1726091180
1.14.dev1725679825
1.14.0
1.13.0
1.12.1
1.12.0
1.11.0
1.10.0
1.9.0
1.8.0
1.7.1
1.7.0
1.6.0
1.5.0
1.4.0
1.3.0
1.2.1
1.2
1.16.dev1770241571
1.16.dev1770174832
1.16.dev1770171649
1.16.dev1768963940
1.16.dev1768882982
1.16.dev1768553279
1.16.dev1768529462
1.16.dev1768525144
1.16.dev1768520142
1.16.dev1768509619
1.16.dev1768465883
1.16.dev1768463664
1.16.dev1768461476
1.16.dev1768459926
1.16.dev1768340014
1.16.dev1768331784
1.16.dev1768329600
1.16.dev1761611832
1.16.dev1758926350
1.16.dev1758580558
1.16.dev1757527933
1.16.dev1757476334
1.16.dev1755812119
1.16.dev1754438568
1.16.dev1753867049
1.16.dev1753811344
1.16.dev1751171094
1.16.dev1751065005
1.16.dev1751039605
1.16.dev1751007257
1.16.dev1750925622
1.16.dev1750923543
1.16.dev1748073630
1.16.dev1747178717
1.16.dev1746845336
1.16.dev1746599232
1.15.dev1746595831
1.15.dev1745883134
1.15.dev1745828296
1.15.dev1745621353
1.15.dev1745544934
1.15.dev1745405475
1.15.dev1745383124
1.15.dev1744789797
1.15.dev1744697311
1.15.dev1744231916
1.15.dev1743900324
1.15.dev1743897268
1.15.dev1743894906
1.15.dev1743893588
1.15.dev1743880617
1.15.dev1743876136
1.15.dev1743871966
1.15.dev1743819490
1.15.dev1743569532
1.15.dev1743543556
1.15.dev1743105184
1.15.dev1742879845
1.15.dev1742871434
1.15.dev1742866465
1.15.dev1742863809
1.15.dev1742861634
1.15.dev1742858851
1.15.dev1742838562
1.15.dev1742010621
1.15.dev1741992867
1.15.dev1741128853
1.15.dev1741126803
1.15.dev1741048818
1.15.dev1741046612
1.15.dev1741042613
1.15.dev1741040425
1.15.dev1738886522
1.15.dev1738710176
1.15.dev1738352709
1.15.dev1738302984
1.15.dev1737977492
1.15.dev1737603589
1.15.dev1737498006
1.15.dev1734387727
1.15.dev1733420295
1.15.dev1733303566
1.15.dev1733301548
1.15.dev1730523741
1.15.dev1730500841
1.15.dev1730154364
1.15.dev1728688449
1.15.dev1727166840
1.15.0
1.14.dev1727164676
1.14.dev1727163064
1.14.dev1727161109
1.14.dev1726902167
1.14.dev1726900525
1.14.dev1726895845
1.14.dev1726889409
1.14.dev1726430915
1.14.dev1726206696
1.14.dev1726187406
1.14.dev1726091180
1.14.dev1725679825
1.14.0
1.13.0
1.12.1
1.12.0
1.11.0
1.10.0
1.1.0
1.0
توضیحات
A fast library for analyzing with quantum stabilizer circuits.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | stim-1.9.0 |
| نام | stim |
| نسخه کتابخانه | 1.9.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Craig Gidney |
| ایمیل نویسنده | craig.gidney@gmail.com |
| آدرس صفحه اصلی | https://github.com/quantumlib/stim |
| آدرس اینترنتی | https://pypi.org/project/stim/ |
| مجوز | Apache 2 |
# Stim
Stim is a fast simulator for quantum stabilizer circuits.
API references are available on the stim github wiki: https://github.com/quantumlib/stim/wiki
Stim can be installed into a python 3 environment using pip:
```bash
pip install stim
```
Once stim is installed, you can `import stim` and use it.
There are three supported use cases:
1. Interactive simulation with `stim.TableauSimulator`.
2. High speed sampling with samplers compiled from `stim.Circuit`.
3. Independent exploration using `stim.Tableau` and `stim.PauliString`.
## Interactive Simulation
Use `stim.TableauSimulator` to simulate operations one by one while inspecting the results:
```python
import stim
s = stim.TableauSimulator()
# Create a GHZ state.
s.h(0)
s.cnot(0, 1)
s.cnot(0, 2)
# Look at the simulator state re-inverted to be forwards:
t = s.current_inverse_tableau()
print(t**-1)
# prints:
# +-xz-xz-xz-
# | ++ ++ ++
# | ZX _Z _Z
# | _X XZ __
# | _X __ XZ
# Measure the GHZ state.
print(s.measure_many(0, 1, 2))
# prints one of:
# [True, True, True]
# or:
# [False, False, False]
```
## High Speed Sampling
By creating a `stim.Circuit` and compiling it into a sampler, samples can be generated very quickly:
```python
import stim
# Create a circuit that measures a large GHZ state.
c = stim.Circuit()
c.append("H", [0])
for k in range(1, 30):
c.append("CNOT", [0, k])
c.append("M", range(30))
# Compile the circuit into a high performance sampler.
sampler = c.compile_sampler()
# Collect a batch of samples.
# Note: the ideal batch size, in terms of speed per sample, is roughly 1024.
# Smaller batches are slower because they are not sufficiently vectorized.
# Bigger batches are slower because they use more memory.
batch = sampler.sample(1024)
print(type(batch)) # numpy.ndarray
print(batch.dtype) # numpy.uint8
print(batch.shape) # (1024, 30)
print(batch)
# Prints something like:
# [[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]
# [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
# [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]
# ...
# [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]
# [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]
# [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
# [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]]
```
This also works on circuits that include noise:
```python
import stim
import numpy as np
c = stim.Circuit("""
X_ERROR(0.1) 0
Y_ERROR(0.2) 1
Z_ERROR(0.3) 2
DEPOLARIZE1(0.4) 3
DEPOLARIZE2(0.5) 4 5
M 0 1 2 3 4 5
""")
batch = c.compile_sampler().sample(2**20)
print(np.mean(batch, axis=0).round(3))
# Prints something like:
# [0.1 0.2 0. 0.267 0.267 0.266]
```
You can also sample annotated detection events using `stim.Circuit.compile_detector_sampler`.
For a list of gates that can appear in a `stim.Circuit`, see the [latest readme on github](https://github.com/quantumlib/Stim#readme).
## Independent Exploration
Stim provides data types `stim.PauliString` and `stim.Tableau`, which support a variety of fast operations.
```python
import stim
xx = stim.PauliString("XX")
yy = stim.PauliString("YY")
assert xx * yy == -stim.PauliString("ZZ")
s = stim.Tableau.from_named_gate("S")
print(repr(s))
# prints:
# stim.Tableau.from_conjugated_generators(
# xs=[
# stim.PauliString("+Y"),
# ],
# zs=[
# stim.PauliString("+Z"),
# ],
# )
s_dag = stim.Tableau.from_named_gate("S_DAG")
assert s**-1 == s_dag
assert s**1000000003 == s_dag
cnot = stim.Tableau.from_named_gate("CNOT")
cz = stim.Tableau.from_named_gate("CZ")
h = stim.Tableau.from_named_gate("H")
t = stim.Tableau(5)
t.append(cnot, [1, 4])
t.append(h, [4])
t.append(cz, [1, 4])
t.prepend(h, [4])
assert t == stim.Tableau(5)
```
نیازمندی
| مقدار | نام |
|---|---|
| - | numpy |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6.0 | Python |
نحوه نصب
نصب پکیج whl stim-1.9.0:
pip install stim-1.9.0.whl
نصب پکیج tar.gz stim-1.9.0:
pip install stim-1.9.0.tar.gz