panta-sim 0.1.0__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.
@@ -0,0 +1,384 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "autocfg"
7
+ version = "1.5.0"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
10
+
11
+ [[package]]
12
+ name = "cc"
13
+ version = "1.2.61"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "d16d90359e986641506914ba71350897565610e87ce0ad9e6f28569db3dd5c6d"
16
+ dependencies = [
17
+ "find-msvc-tools",
18
+ "shlex",
19
+ ]
20
+
21
+ [[package]]
22
+ name = "cfg-if"
23
+ version = "1.0.4"
24
+ source = "registry+https://github.com/rust-lang/crates.io-index"
25
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
26
+
27
+ [[package]]
28
+ name = "find-msvc-tools"
29
+ version = "0.1.9"
30
+ source = "registry+https://github.com/rust-lang/crates.io-index"
31
+ checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
32
+
33
+ [[package]]
34
+ name = "getrandom"
35
+ version = "0.2.17"
36
+ source = "registry+https://github.com/rust-lang/crates.io-index"
37
+ checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
38
+ dependencies = [
39
+ "cfg-if",
40
+ "libc",
41
+ "wasi",
42
+ ]
43
+
44
+ [[package]]
45
+ name = "heck"
46
+ version = "0.5.0"
47
+ source = "registry+https://github.com/rust-lang/crates.io-index"
48
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
49
+
50
+ [[package]]
51
+ name = "indoc"
52
+ version = "2.0.7"
53
+ source = "registry+https://github.com/rust-lang/crates.io-index"
54
+ checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
55
+ dependencies = [
56
+ "rustversion",
57
+ ]
58
+
59
+ [[package]]
60
+ name = "libc"
61
+ version = "0.2.186"
62
+ source = "registry+https://github.com/rust-lang/crates.io-index"
63
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
64
+
65
+ [[package]]
66
+ name = "matrixmultiply"
67
+ version = "0.3.10"
68
+ source = "registry+https://github.com/rust-lang/crates.io-index"
69
+ checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08"
70
+ dependencies = [
71
+ "autocfg",
72
+ "rawpointer",
73
+ ]
74
+
75
+ [[package]]
76
+ name = "memoffset"
77
+ version = "0.9.1"
78
+ source = "registry+https://github.com/rust-lang/crates.io-index"
79
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
80
+ dependencies = [
81
+ "autocfg",
82
+ ]
83
+
84
+ [[package]]
85
+ name = "ndarray"
86
+ version = "0.15.6"
87
+ source = "registry+https://github.com/rust-lang/crates.io-index"
88
+ checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32"
89
+ dependencies = [
90
+ "matrixmultiply",
91
+ "num-complex",
92
+ "num-integer",
93
+ "num-traits",
94
+ "rawpointer",
95
+ ]
96
+
97
+ [[package]]
98
+ name = "num-complex"
99
+ version = "0.4.6"
100
+ source = "registry+https://github.com/rust-lang/crates.io-index"
101
+ checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
102
+ dependencies = [
103
+ "num-traits",
104
+ ]
105
+
106
+ [[package]]
107
+ name = "num-integer"
108
+ version = "0.1.46"
109
+ source = "registry+https://github.com/rust-lang/crates.io-index"
110
+ checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
111
+ dependencies = [
112
+ "num-traits",
113
+ ]
114
+
115
+ [[package]]
116
+ name = "num-traits"
117
+ version = "0.2.19"
118
+ source = "registry+https://github.com/rust-lang/crates.io-index"
119
+ checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
120
+ dependencies = [
121
+ "autocfg",
122
+ ]
123
+
124
+ [[package]]
125
+ name = "numpy"
126
+ version = "0.23.0"
127
+ source = "registry+https://github.com/rust-lang/crates.io-index"
128
+ checksum = "b94caae805f998a07d33af06e6a3891e38556051b8045c615470a71590e13e78"
129
+ dependencies = [
130
+ "libc",
131
+ "ndarray",
132
+ "num-complex",
133
+ "num-integer",
134
+ "num-traits",
135
+ "pyo3",
136
+ "rustc-hash",
137
+ ]
138
+
139
+ [[package]]
140
+ name = "once_cell"
141
+ version = "1.21.4"
142
+ source = "registry+https://github.com/rust-lang/crates.io-index"
143
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
144
+
145
+ [[package]]
146
+ name = "portable-atomic"
147
+ version = "1.13.1"
148
+ source = "registry+https://github.com/rust-lang/crates.io-index"
149
+ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
150
+
151
+ [[package]]
152
+ name = "ppv-lite86"
153
+ version = "0.2.21"
154
+ source = "registry+https://github.com/rust-lang/crates.io-index"
155
+ checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
156
+ dependencies = [
157
+ "zerocopy",
158
+ ]
159
+
160
+ [[package]]
161
+ name = "proc-macro2"
162
+ version = "1.0.106"
163
+ source = "registry+https://github.com/rust-lang/crates.io-index"
164
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
165
+ dependencies = [
166
+ "unicode-ident",
167
+ ]
168
+
169
+ [[package]]
170
+ name = "pyo3"
171
+ version = "0.23.5"
172
+ source = "registry+https://github.com/rust-lang/crates.io-index"
173
+ checksum = "7778bffd85cf38175ac1f545509665d0b9b92a198ca7941f131f85f7a4f9a872"
174
+ dependencies = [
175
+ "cfg-if",
176
+ "indoc",
177
+ "libc",
178
+ "memoffset",
179
+ "once_cell",
180
+ "portable-atomic",
181
+ "pyo3-build-config",
182
+ "pyo3-ffi",
183
+ "pyo3-macros",
184
+ "unindent",
185
+ ]
186
+
187
+ [[package]]
188
+ name = "pyo3-build-config"
189
+ version = "0.23.5"
190
+ source = "registry+https://github.com/rust-lang/crates.io-index"
191
+ checksum = "94f6cbe86ef3bf18998d9df6e0f3fc1050a8c5efa409bf712e661a4366e010fb"
192
+ dependencies = [
193
+ "once_cell",
194
+ "python3-dll-a",
195
+ "target-lexicon",
196
+ ]
197
+
198
+ [[package]]
199
+ name = "pyo3-ffi"
200
+ version = "0.23.5"
201
+ source = "registry+https://github.com/rust-lang/crates.io-index"
202
+ checksum = "e9f1b4c431c0bb1c8fb0a338709859eed0d030ff6daa34368d3b152a63dfdd8d"
203
+ dependencies = [
204
+ "libc",
205
+ "pyo3-build-config",
206
+ ]
207
+
208
+ [[package]]
209
+ name = "pyo3-macros"
210
+ version = "0.23.5"
211
+ source = "registry+https://github.com/rust-lang/crates.io-index"
212
+ checksum = "fbc2201328f63c4710f68abdf653c89d8dbc2858b88c5d88b0ff38a75288a9da"
213
+ dependencies = [
214
+ "proc-macro2",
215
+ "pyo3-macros-backend",
216
+ "quote",
217
+ "syn",
218
+ ]
219
+
220
+ [[package]]
221
+ name = "pyo3-macros-backend"
222
+ version = "0.23.5"
223
+ source = "registry+https://github.com/rust-lang/crates.io-index"
224
+ checksum = "fca6726ad0f3da9c9de093d6f116a93c1a38e417ed73bf138472cf4064f72028"
225
+ dependencies = [
226
+ "heck",
227
+ "proc-macro2",
228
+ "pyo3-build-config",
229
+ "quote",
230
+ "syn",
231
+ ]
232
+
233
+ [[package]]
234
+ name = "python3-dll-a"
235
+ version = "0.2.15"
236
+ source = "registry+https://github.com/rust-lang/crates.io-index"
237
+ checksum = "d80ba7540edb18890d444c5aa8e1f1f99b1bdf26fb26ae383135325f4a36042b"
238
+ dependencies = [
239
+ "cc",
240
+ ]
241
+
242
+ [[package]]
243
+ name = "qsim-core"
244
+ version = "0.1.0"
245
+ dependencies = [
246
+ "num-complex",
247
+ ]
248
+
249
+ [[package]]
250
+ name = "qsim-python"
251
+ version = "0.1.0"
252
+ dependencies = [
253
+ "num-complex",
254
+ "numpy",
255
+ "pyo3",
256
+ "qsim-core",
257
+ "qsim-simulator",
258
+ ]
259
+
260
+ [[package]]
261
+ name = "qsim-simulator"
262
+ version = "0.1.0"
263
+ dependencies = [
264
+ "qsim-core",
265
+ "rand",
266
+ ]
267
+
268
+ [[package]]
269
+ name = "quote"
270
+ version = "1.0.45"
271
+ source = "registry+https://github.com/rust-lang/crates.io-index"
272
+ checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
273
+ dependencies = [
274
+ "proc-macro2",
275
+ ]
276
+
277
+ [[package]]
278
+ name = "rand"
279
+ version = "0.8.6"
280
+ source = "registry+https://github.com/rust-lang/crates.io-index"
281
+ checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
282
+ dependencies = [
283
+ "libc",
284
+ "rand_chacha",
285
+ "rand_core",
286
+ ]
287
+
288
+ [[package]]
289
+ name = "rand_chacha"
290
+ version = "0.3.1"
291
+ source = "registry+https://github.com/rust-lang/crates.io-index"
292
+ checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
293
+ dependencies = [
294
+ "ppv-lite86",
295
+ "rand_core",
296
+ ]
297
+
298
+ [[package]]
299
+ name = "rand_core"
300
+ version = "0.6.4"
301
+ source = "registry+https://github.com/rust-lang/crates.io-index"
302
+ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
303
+ dependencies = [
304
+ "getrandom",
305
+ ]
306
+
307
+ [[package]]
308
+ name = "rawpointer"
309
+ version = "0.2.1"
310
+ source = "registry+https://github.com/rust-lang/crates.io-index"
311
+ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
312
+
313
+ [[package]]
314
+ name = "rustc-hash"
315
+ version = "2.1.2"
316
+ source = "registry+https://github.com/rust-lang/crates.io-index"
317
+ checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
318
+
319
+ [[package]]
320
+ name = "rustversion"
321
+ version = "1.0.22"
322
+ source = "registry+https://github.com/rust-lang/crates.io-index"
323
+ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
324
+
325
+ [[package]]
326
+ name = "shlex"
327
+ version = "1.3.0"
328
+ source = "registry+https://github.com/rust-lang/crates.io-index"
329
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
330
+
331
+ [[package]]
332
+ name = "syn"
333
+ version = "2.0.117"
334
+ source = "registry+https://github.com/rust-lang/crates.io-index"
335
+ checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
336
+ dependencies = [
337
+ "proc-macro2",
338
+ "quote",
339
+ "unicode-ident",
340
+ ]
341
+
342
+ [[package]]
343
+ name = "target-lexicon"
344
+ version = "0.12.16"
345
+ source = "registry+https://github.com/rust-lang/crates.io-index"
346
+ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
347
+
348
+ [[package]]
349
+ name = "unicode-ident"
350
+ version = "1.0.24"
351
+ source = "registry+https://github.com/rust-lang/crates.io-index"
352
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
353
+
354
+ [[package]]
355
+ name = "unindent"
356
+ version = "0.2.4"
357
+ source = "registry+https://github.com/rust-lang/crates.io-index"
358
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
359
+
360
+ [[package]]
361
+ name = "wasi"
362
+ version = "0.11.1+wasi-snapshot-preview1"
363
+ source = "registry+https://github.com/rust-lang/crates.io-index"
364
+ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
365
+
366
+ [[package]]
367
+ name = "zerocopy"
368
+ version = "0.8.48"
369
+ source = "registry+https://github.com/rust-lang/crates.io-index"
370
+ checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9"
371
+ dependencies = [
372
+ "zerocopy-derive",
373
+ ]
374
+
375
+ [[package]]
376
+ name = "zerocopy-derive"
377
+ version = "0.8.48"
378
+ source = "registry+https://github.com/rust-lang/crates.io-index"
379
+ checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4"
380
+ dependencies = [
381
+ "proc-macro2",
382
+ "quote",
383
+ "syn",
384
+ ]
@@ -0,0 +1,3 @@
1
+ [workspace]
2
+ members = ["crates/core", "crates/simulator", "crates/python-binding"]
3
+ resolver = "2"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 quantumfia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: panta-sim
3
+ Version: 0.1.0
4
+ Classifier: Development Status :: 3 - Alpha
5
+ Classifier: Intended Audience :: Science/Research
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Operating System :: OS Independent
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Rust
15
+ Classifier: Topic :: Scientific/Engineering :: Physics
16
+ Requires-Dist: numpy>=1.20
17
+ License-File: LICENSE
18
+ Summary: Full Rust core quantum circuit simulator with Python bindings
19
+ Keywords: quantum,simulator,quantum-computing,rust,pyo3
20
+ Author: quantumfia
21
+ License: MIT
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
24
+ Project-URL: Issues, https://github.com/quantumfia/quantum-sim/issues
25
+ Project-URL: Repository, https://github.com/quantumfia/quantum-sim
26
+
27
+ # panta-sim
28
+
29
+ 풀 Rust 코어 + Python 바인딩으로 작성한 양자 회로 시뮬레이터.
30
+ Full state vector 방식으로 20~25큐비트 회로를 정확히 시뮬레이션 한다.
31
+
32
+ - **Rust 코어**: `num-complex` 기반 상태 벡터, qubit-wise multiplication
33
+ - **Python API**: PyO3 + maturin, NumPy 연동
34
+ - **검증**: 100+ pytest + Qiskit statevector 교차검증 (오차 < 1e-10)
35
+
36
+ ## 설치
37
+
38
+ ```bash
39
+ pip install panta-sim
40
+ ```
41
+
42
+ > 위 명령은 PyPI 에 wheel 이 등록된 이후 동작합니다.
43
+ > 아직 publish 전이라면 소스에서 빌드하세요:
44
+ >
45
+ > ```bash
46
+ > # 사전 요구 사항: Rust toolchain (rustup), Python >= 3.9, maturin
47
+ > pip install maturin
48
+ > git clone https://github.com/quantumfia/quantum-sim
49
+ > cd quantum-sim
50
+ > maturin develop --release # 또는 pip install .
51
+ > ```
52
+
53
+ ## 빠른 시작
54
+
55
+ ```python
56
+ from panta_sim import QuantumCircuit
57
+
58
+ # Bell state |Φ+⟩ = (|00⟩ + |11⟩)/√2
59
+ qc = QuantumCircuit(2)
60
+ qc.h(0)
61
+ qc.cx(0, 1)
62
+ qc.measure_all()
63
+
64
+ result = qc.run(shots=1024, seed=42)
65
+ print(result.counts()) # {'00': ~512, '11': ~512}
66
+ print(result.statevector()) # [0.707+0j, 0+0j, 0+0j, 0.707+0j]
67
+ print(result.probabilities()) # [0.5, 0, 0, 0.5]
68
+ ```
69
+
70
+ `QuantumCircuit` 의 게이트 메서드는 모두 self 를 반환하므로 메서드 체이닝도 가능하다:
71
+
72
+ ```python
73
+ counts = (
74
+ QuantumCircuit(3)
75
+ .h(0)
76
+ .cx(0, 1)
77
+ .cx(0, 2)
78
+ .measure_all()
79
+ .run(shots=1024, seed=0)
80
+ .counts()
81
+ )
82
+ ```
83
+
84
+ > `pip install panta-sim` (배포 이름) → `import panta_sim` (Python 모듈 이름).
85
+
86
+ ## 지원 게이트
87
+
88
+ | 분류 | 게이트 | 메서드 |
89
+ | --- | --- | --- |
90
+ | 단일 큐비트 | Hadamard | `h(q)` |
91
+ | 단일 큐비트 | Pauli-X / Y / Z | `x(q)`, `y(q)`, `z(q)` |
92
+ | 단일 큐비트 | Phase / T | `s(q)`, `t(q)` |
93
+ | 단일 큐비트 | Identity | `id(q)` |
94
+ | 회전 | Rx / Ry / Rz | `rx(theta, q)`, `ry(theta, q)`, `rz(theta, q)` |
95
+ | 2큐비트 | CNOT / CZ / SWAP | `cx(c, t)`, `cz(a, b)`, `swap(a, b)` |
96
+ | 3큐비트 | Toffoli (CCX) | `ccx(c1, c2, t)` |
97
+ | 3큐비트 | Fredkin (CSWAP) | `cswap(c, t1, t2)` |
98
+ | 측정 | 부분 / 전체 측정 | `measure(q, c)`, `measure_all()` |
99
+
100
+ 비트 순서 규약은 Qiskit 과 동일한 little-endian 이다 (`q_{n-1} … q_1 q_0`).
101
+ `counts()` 의 키는 MSB-first 비트 문자열, statevector 의 인덱스는 동일한 비트열을 정수로 해석한 값이다.
102
+
103
+ ## 빌드 / 테스트
104
+
105
+ ```bash
106
+ cargo build --release # Rust 전체 빌드
107
+ cargo test # Rust 유닛 테스트 (core + simulator)
108
+ maturin develop --release # Python 바인딩 빌드 (개발 모드)
109
+ pytest tests/ # Python 통합 테스트 + Qiskit 교차검증
110
+ pytest tests/ -v # 상세 출력
111
+ ```
112
+
113
+ Qiskit 교차검증 테스트는 `qiskit` 패키지가 설치되어 있을 때만 실행되며,
114
+ 설치되어 있지 않으면 자동으로 skip 된다.
115
+
116
+ ## 예제
117
+
118
+ `examples/` 디렉터리 참고:
119
+
120
+ - `bell_state.py` — Bell 상태 생성 및 측정
121
+ - `grover.py` — 2큐비트 Grover 탐색
122
+ - `qft.py` — Quantum Fourier Transform
123
+
124
+ ```bash
125
+ python examples/bell_state.py
126
+ python examples/grover.py
127
+ python examples/qft.py
128
+ ```
129
+
130
+ ## 프로젝트 구조
131
+
132
+ ```
133
+ quantum-sim/
134
+ ├── crates/
135
+ │ ├── core/ 상태 벡터, 게이트 행렬, 복소수 연산
136
+ │ ├── simulator/ 시뮬레이션 엔진, 측정, 회로 실행기
137
+ │ └── python-binding/ PyO3 바인딩
138
+ ├── python/panta_sim/ 사용자용 Python 라이브러리
139
+ ├── tests/ pytest 통합 테스트
140
+ ├── examples/ 사용 예제
141
+ └── docs/ 설계 문서 (plan.md, architecture.md, references.md)
142
+ ```
143
+
144
+ ## 5월 스코프 밖 (현재 미구현)
145
+
146
+ 트랜스파일러, 노이즈 모델, OpenQASM 파싱, GPU/멀티스레딩 가속,
147
+ 회로 시각화, tensor network/MPS, 실제 QPU 연동.
148
+
149
+ ## 참고 자료
150
+
151
+ - 설계 문서: [`docs/architecture.md`](docs/architecture.md)
152
+ - 개발 계획(WBS): [`docs/plan.md`](docs/plan.md)
153
+ - 참고 논문: [`docs/references.md`](docs/references.md)
154
+
@@ -0,0 +1,127 @@
1
+ # panta-sim
2
+
3
+ 풀 Rust 코어 + Python 바인딩으로 작성한 양자 회로 시뮬레이터.
4
+ Full state vector 방식으로 20~25큐비트 회로를 정확히 시뮬레이션 한다.
5
+
6
+ - **Rust 코어**: `num-complex` 기반 상태 벡터, qubit-wise multiplication
7
+ - **Python API**: PyO3 + maturin, NumPy 연동
8
+ - **검증**: 100+ pytest + Qiskit statevector 교차검증 (오차 < 1e-10)
9
+
10
+ ## 설치
11
+
12
+ ```bash
13
+ pip install panta-sim
14
+ ```
15
+
16
+ > 위 명령은 PyPI 에 wheel 이 등록된 이후 동작합니다.
17
+ > 아직 publish 전이라면 소스에서 빌드하세요:
18
+ >
19
+ > ```bash
20
+ > # 사전 요구 사항: Rust toolchain (rustup), Python >= 3.9, maturin
21
+ > pip install maturin
22
+ > git clone https://github.com/quantumfia/quantum-sim
23
+ > cd quantum-sim
24
+ > maturin develop --release # 또는 pip install .
25
+ > ```
26
+
27
+ ## 빠른 시작
28
+
29
+ ```python
30
+ from panta_sim import QuantumCircuit
31
+
32
+ # Bell state |Φ+⟩ = (|00⟩ + |11⟩)/√2
33
+ qc = QuantumCircuit(2)
34
+ qc.h(0)
35
+ qc.cx(0, 1)
36
+ qc.measure_all()
37
+
38
+ result = qc.run(shots=1024, seed=42)
39
+ print(result.counts()) # {'00': ~512, '11': ~512}
40
+ print(result.statevector()) # [0.707+0j, 0+0j, 0+0j, 0.707+0j]
41
+ print(result.probabilities()) # [0.5, 0, 0, 0.5]
42
+ ```
43
+
44
+ `QuantumCircuit` 의 게이트 메서드는 모두 self 를 반환하므로 메서드 체이닝도 가능하다:
45
+
46
+ ```python
47
+ counts = (
48
+ QuantumCircuit(3)
49
+ .h(0)
50
+ .cx(0, 1)
51
+ .cx(0, 2)
52
+ .measure_all()
53
+ .run(shots=1024, seed=0)
54
+ .counts()
55
+ )
56
+ ```
57
+
58
+ > `pip install panta-sim` (배포 이름) → `import panta_sim` (Python 모듈 이름).
59
+
60
+ ## 지원 게이트
61
+
62
+ | 분류 | 게이트 | 메서드 |
63
+ | --- | --- | --- |
64
+ | 단일 큐비트 | Hadamard | `h(q)` |
65
+ | 단일 큐비트 | Pauli-X / Y / Z | `x(q)`, `y(q)`, `z(q)` |
66
+ | 단일 큐비트 | Phase / T | `s(q)`, `t(q)` |
67
+ | 단일 큐비트 | Identity | `id(q)` |
68
+ | 회전 | Rx / Ry / Rz | `rx(theta, q)`, `ry(theta, q)`, `rz(theta, q)` |
69
+ | 2큐비트 | CNOT / CZ / SWAP | `cx(c, t)`, `cz(a, b)`, `swap(a, b)` |
70
+ | 3큐비트 | Toffoli (CCX) | `ccx(c1, c2, t)` |
71
+ | 3큐비트 | Fredkin (CSWAP) | `cswap(c, t1, t2)` |
72
+ | 측정 | 부분 / 전체 측정 | `measure(q, c)`, `measure_all()` |
73
+
74
+ 비트 순서 규약은 Qiskit 과 동일한 little-endian 이다 (`q_{n-1} … q_1 q_0`).
75
+ `counts()` 의 키는 MSB-first 비트 문자열, statevector 의 인덱스는 동일한 비트열을 정수로 해석한 값이다.
76
+
77
+ ## 빌드 / 테스트
78
+
79
+ ```bash
80
+ cargo build --release # Rust 전체 빌드
81
+ cargo test # Rust 유닛 테스트 (core + simulator)
82
+ maturin develop --release # Python 바인딩 빌드 (개발 모드)
83
+ pytest tests/ # Python 통합 테스트 + Qiskit 교차검증
84
+ pytest tests/ -v # 상세 출력
85
+ ```
86
+
87
+ Qiskit 교차검증 테스트는 `qiskit` 패키지가 설치되어 있을 때만 실행되며,
88
+ 설치되어 있지 않으면 자동으로 skip 된다.
89
+
90
+ ## 예제
91
+
92
+ `examples/` 디렉터리 참고:
93
+
94
+ - `bell_state.py` — Bell 상태 생성 및 측정
95
+ - `grover.py` — 2큐비트 Grover 탐색
96
+ - `qft.py` — Quantum Fourier Transform
97
+
98
+ ```bash
99
+ python examples/bell_state.py
100
+ python examples/grover.py
101
+ python examples/qft.py
102
+ ```
103
+
104
+ ## 프로젝트 구조
105
+
106
+ ```
107
+ quantum-sim/
108
+ ├── crates/
109
+ │ ├── core/ 상태 벡터, 게이트 행렬, 복소수 연산
110
+ │ ├── simulator/ 시뮬레이션 엔진, 측정, 회로 실행기
111
+ │ └── python-binding/ PyO3 바인딩
112
+ ├── python/panta_sim/ 사용자용 Python 라이브러리
113
+ ├── tests/ pytest 통합 테스트
114
+ ├── examples/ 사용 예제
115
+ └── docs/ 설계 문서 (plan.md, architecture.md, references.md)
116
+ ```
117
+
118
+ ## 5월 스코프 밖 (현재 미구현)
119
+
120
+ 트랜스파일러, 노이즈 모델, OpenQASM 파싱, GPU/멀티스레딩 가속,
121
+ 회로 시각화, tensor network/MPS, 실제 QPU 연동.
122
+
123
+ ## 참고 자료
124
+
125
+ - 설계 문서: [`docs/architecture.md`](docs/architecture.md)
126
+ - 개발 계획(WBS): [`docs/plan.md`](docs/plan.md)
127
+ - 참고 논문: [`docs/references.md`](docs/references.md)
@@ -0,0 +1,7 @@
1
+ [package]
2
+ name = "qsim-core"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+
6
+ [dependencies]
7
+ num-complex = "0.4"