metalq 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.
Files changed (33) hide show
  1. metalq-0.1.0/LICENSE +21 -0
  2. metalq-0.1.0/MANIFEST.in +9 -0
  3. metalq-0.1.0/Makefile +65 -0
  4. metalq-0.1.0/PKG-INFO +211 -0
  5. metalq-0.1.0/README.md +181 -0
  6. metalq-0.1.0/metalq/python/metalq/__init__.py +36 -0
  7. metalq-0.1.0/metalq/python/metalq/backend.py +184 -0
  8. metalq-0.1.0/metalq/python/metalq/circuit_data.py +220 -0
  9. metalq-0.1.0/metalq/python/metalq/lib/libmetalq.dylib +0 -0
  10. metalq-0.1.0/metalq/python/metalq/lib/quantum_gates.metallib +0 -0
  11. metalq-0.1.0/metalq/python/metalq/result.py +37 -0
  12. metalq-0.1.0/metalq/python/metalq.egg-info/PKG-INFO +211 -0
  13. metalq-0.1.0/metalq/python/metalq.egg-info/SOURCES.txt +31 -0
  14. metalq-0.1.0/metalq/python/metalq.egg-info/dependency_links.txt +1 -0
  15. metalq-0.1.0/metalq/python/metalq.egg-info/requires.txt +6 -0
  16. metalq-0.1.0/metalq/python/metalq.egg-info/top_level.txt +1 -0
  17. metalq-0.1.0/native/gate_executor.h +30 -0
  18. metalq-0.1.0/native/gate_executor.m +957 -0
  19. metalq-0.1.0/native/measurement.h +37 -0
  20. metalq-0.1.0/native/measurement.m +406 -0
  21. metalq-0.1.0/native/metalq.h +94 -0
  22. metalq-0.1.0/native/metalq.m +248 -0
  23. metalq-0.1.0/native/shaders/measurement.metal +154 -0
  24. metalq-0.1.0/native/shaders/quantum_gates.metal +313 -0
  25. metalq-0.1.0/native/state_vector.h +27 -0
  26. metalq-0.1.0/native/state_vector.m +52 -0
  27. metalq-0.1.0/pyproject.toml +69 -0
  28. metalq-0.1.0/setup.cfg +4 -0
  29. metalq-0.1.0/setup.py +58 -0
  30. metalq-0.1.0/tests/test_all_gates.py +177 -0
  31. metalq-0.1.0/tests/test_basic.py +88 -0
  32. metalq-0.1.0/tests/test_high_level_gates.py +220 -0
  33. metalq-0.1.0/tests/test_rotation_gates.py +49 -0
metalq-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Masaki Shiraishi
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,9 @@
1
+ include README.md
2
+ include LICENSE
3
+ include Makefile
4
+
5
+ # Native libraries
6
+ recursive-include metalq/python/metalq/lib *.dylib *.metallib
7
+
8
+ # Source files for building
9
+ recursive-include native *.m *.h *.metal
metalq-0.1.0/Makefile ADDED
@@ -0,0 +1,65 @@
1
+ # Metal-Q Makefile
2
+
3
+ CC = clang
4
+ OBJC = clang
5
+ METAL = xcrun -sdk macosx metal
6
+ METALLIB = xcrun -sdk macosx metallib
7
+
8
+ CFLAGS = -Wall -O2 -fPIC
9
+ OBJCFLAGS = -Wall -O2 -fPIC -fobjc-arc -framework Foundation -framework Metal
10
+
11
+ SRC_DIR = native
12
+ BUILD_DIR = build
13
+ PYTHON_DIR = metalq/python/metalq
14
+
15
+ # Source files
16
+ OBJC_SRCS = $(SRC_DIR)/metalq.m \
17
+ $(SRC_DIR)/state_vector.m \
18
+ $(SRC_DIR)/gate_executor.m \
19
+ $(SRC_DIR)/measurement.m
20
+
21
+ METAL_SRC = $(SRC_DIR)/shaders/quantum_gates.metal
22
+ MEASUREMENT_METAL_SRC = $(SRC_DIR)/shaders/measurement.metal
23
+
24
+ # Output
25
+ DYLIB = $(BUILD_DIR)/libmetalq.dylib
26
+ METALLIB_OUT = $(BUILD_DIR)/quantum_gates.metallib
27
+
28
+ .PHONY: all clean install test dirs
29
+
30
+ all: dirs $(DYLIB) $(METALLIB_OUT)
31
+
32
+ dirs:
33
+ mkdir -p $(BUILD_DIR)
34
+
35
+ # Compile Metal shaders (both quantum_gates and measurement)
36
+ $(BUILD_DIR)/quantum_gates.air: $(METAL_SRC)
37
+ $(METAL) -c $< -o $@
38
+
39
+ $(BUILD_DIR)/measurement.air: $(MEASUREMENT_METAL_SRC)
40
+ $(METAL) -c $< -o $@
41
+
42
+ $(METALLIB_OUT): $(BUILD_DIR)/quantum_gates.air $(BUILD_DIR)/measurement.air
43
+ $(METALLIB) $(BUILD_DIR)/quantum_gates.air $(BUILD_DIR)/measurement.air -o $@
44
+
45
+ # Build dynamic library
46
+ $(DYLIB): $(OBJC_SRCS)
47
+ $(OBJC) $(OBJCFLAGS) \
48
+ -dynamiclib \
49
+ -install_name @rpath/libmetalq.dylib \
50
+ $(OBJC_SRCS) \
51
+ -o $@
52
+
53
+ # Install to Python package
54
+ install: all
55
+ mkdir -p $(PYTHON_DIR)/lib
56
+ cp $(DYLIB) $(PYTHON_DIR)/lib/
57
+ cp $(METALLIB_OUT) $(PYTHON_DIR)/lib/
58
+
59
+ # Run tests
60
+ test: install
61
+ cd metalq/python && uv run pytest ../../tests/ -v
62
+
63
+ clean:
64
+ rm -rf $(BUILD_DIR)
65
+ rm -rf $(PYTHON_DIR)/lib
metalq-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: metalq
3
+ Version: 0.1.0
4
+ Summary: High-performance quantum circuit simulator for Apple Silicon using Metal GPU
5
+ Author: Metal-Q Contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/masa-whitestone/metal-quantum
8
+ Project-URL: Repository, https://github.com/masa-whitestone/metal-quantum.git
9
+ Project-URL: Issues, https://github.com/masa-whitestone/metal-quantum/issues
10
+ Keywords: quantum,quantum-computing,simulator,qiskit,apple-silicon,metal,gpu
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: MacOS :: MacOS X
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Physics
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: numpy>=1.21.0
25
+ Requires-Dist: qiskit<3.0.0,>=2.0.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
28
+ Requires-Dist: qiskit-aer>=0.13.0; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # Metal-Q ⚛️🍎
32
+
33
+ A high-performance quantum circuit simulator for Apple Silicon, using Metal GPU acceleration.
34
+
35
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
36
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
37
+ [![Qiskit 2.x](https://img.shields.io/badge/Qiskit-2.x-6929C4.svg)](https://qiskit.org/)
38
+
39
+ ## Overview
40
+
41
+ Metal-Q is a drop-in replacement for Qiskit's statevector simulator, optimized for Apple Silicon GPUs. It leverages Metal compute shaders to achieve significant speedups on M1/M2/M3/M4 Macs.
42
+
43
+ ### Key Features
44
+
45
+ - 🚀 **Up to 32x faster** than Qiskit for large circuits
46
+ - 🔌 **Drop-in compatible** with Qiskit 2.x circuits
47
+ - 🍎 **Native Apple Silicon** optimization via Metal API
48
+ - 📦 **Simple installation** - no CUDA or complex dependencies
49
+ - ⚛️ **44 quantum gates** supported natively
50
+
51
+ ## Performance
52
+
53
+ Benchmarked on Apple M2 Pro (16GB RAM):
54
+
55
+ ### Statevector Simulation
56
+
57
+ | Qubits | Depth | Metal-Q | Qiskit | Speedup |
58
+ |--------|-------|---------|--------|---------|
59
+ | 16 | 10 | 41ms | 42ms | 1.0x |
60
+ | 20 | 10 | 80ms | 1,009ms | **12.7x** |
61
+ | 22 | 10 | 265ms | 4,888ms | **18.5x** |
62
+ | 24 | 8 | 732ms | 17,285ms | **23.6x** |
63
+ | 26 | 6 | 2,303ms | 54,444ms | **23.6x** |
64
+
65
+ ### Sampling (8192 shots)
66
+
67
+ | Qubits | Metal-Q | Aer | Speedup |
68
+ |--------|---------|-----|---------|
69
+ | 16 | 15ms | 18ms | 1.2x |
70
+ | 20 | 36ms | 138ms | **3.9x** |
71
+ | 22 | 203ms | 497ms | **2.5x** |
72
+ | 24 | 671ms | 1,475ms | **2.2x** |
73
+
74
+ ### QFT Circuit
75
+
76
+ | Qubits | Metal-Q | Qiskit | Speedup |
77
+ |--------|---------|--------|---------|
78
+ | 16 | 20ms | 24ms | 1.2x |
79
+ | 20 | 63ms | 603ms | **9.6x** |
80
+ | 22 | 137ms | 3,257ms | **23.8x** |
81
+ | 24 | 459ms | 14,788ms | **32.2x** |
82
+
83
+ ## Installation
84
+
85
+ ### Requirements
86
+
87
+ - macOS 12.0+ (Monterey or later)
88
+ - Apple Silicon (M1/M2/M3/M4) or Intel Mac with Metal support
89
+ - Python 3.9+
90
+ - Xcode Command Line Tools
91
+
92
+ ### Install from Source
93
+
94
+ ```bash
95
+ git clone https://github.com/masa-whitestone/metal-quantum.git
96
+ cd metal-quantum
97
+ make install
98
+ pip install .
99
+ ```
100
+
101
+ ## Quick Start
102
+
103
+ ```python
104
+ from qiskit import QuantumCircuit
105
+ import metalq
106
+
107
+ # Create a quantum circuit (standard Qiskit)
108
+ qc = QuantumCircuit(4, 4)
109
+ qc.h(0)
110
+ qc.cx(0, 1)
111
+ qc.cx(1, 2)
112
+ qc.cx(2, 3)
113
+ qc.measure([0, 1, 2, 3], [0, 1, 2, 3])
114
+
115
+ # Run on Metal-Q
116
+ result = metalq.run(qc, shots=1024)
117
+ print(result.get_counts())
118
+ # {'0000': 512, '1111': 512}
119
+ ```
120
+
121
+ ### Get Statevector
122
+
123
+ ```python
124
+ qc = QuantumCircuit(3)
125
+ qc.h(0)
126
+ qc.cx(0, 1)
127
+ qc.cx(1, 2)
128
+
129
+ # Get statevector directly
130
+ statevector = metalq.statevector(qc)
131
+ print(statevector)
132
+ # [0.707+0j, 0, 0, 0, 0, 0, 0, 0.707+0j]
133
+ ```
134
+
135
+ ## Supported Gates
136
+
137
+ ### Single-Qubit Gates (19)
138
+ `id`, `x`, `y`, `z`, `h`, `s`, `sdg`, `t`, `tdg`, `sx`, `sxdg`, `rx`, `ry`, `rz`, `p`, `u`, `u1`, `u2`, `u3`, `r`
139
+
140
+ ### Two-Qubit Gates (22)
141
+ `cx`, `cy`, `cz`, `ch`, `cs`, `csdg`, `csx`, `cp`, `crx`, `cry`, `crz`, `cu`, `cu1`, `cu3`, `swap`, `iswap`, `dcx`, `ecr`, `rxx`, `ryy`, `rzz`, `rzx`
142
+
143
+ ### Three-Qubit Gates (3)
144
+ `ccx` (Toffoli), `cswap` (Fredkin), `ccz`
145
+
146
+ ### High-Level Constructs
147
+ QFTGate, MCXGate, GroverOperator, UnitaryGate (automatically decomposed)
148
+
149
+ ## API Reference
150
+
151
+ ### `metalq.run(circuit, shots=1024)`
152
+
153
+ Execute a quantum circuit with measurements.
154
+
155
+ ```python
156
+ result = metalq.run(qc, shots=1024)
157
+ counts = result.get_counts() # {'00': 523, '11': 501}
158
+ ```
159
+
160
+ ### `metalq.statevector(circuit)`
161
+
162
+ Get the final statevector without measurements.
163
+
164
+ ```python
165
+ sv = metalq.statevector(qc) # numpy array
166
+ ```
167
+
168
+ ## Architecture
169
+
170
+ ```
171
+ ┌─────────────────────────────────────────────────┐
172
+ │ Python Layer │
173
+ │ (metalq package) │
174
+ ├─────────────────────────────────────────────────┤
175
+ │ ctypes Bridge │
176
+ ├─────────────────────────────────────────────────┤
177
+ │ Native Layer (ObjC) │
178
+ │ libmetalq.dylib │
179
+ ├─────────────────────────────────────────────────┤
180
+ │ Metal Compute Shaders │
181
+ │ quantum_gates.metallib │
182
+ └─────────────────────────────────────────────────┘
183
+
184
+
185
+ ┌─────────────────────────────────────────────────┐
186
+ │ Apple Silicon GPU │
187
+ │ (M1 / M2 / M3 / M4 Series) │
188
+ └─────────────────────────────────────────────────┘
189
+ ```
190
+
191
+ ## Limitations
192
+
193
+ - **macOS only** - Requires Metal API
194
+ - **No noise models** - Pure statevector simulation
195
+ - **Memory bound** - 28 qubits requires ~2GB GPU memory
196
+
197
+ ## Running Tests
198
+
199
+ ```bash
200
+ make install
201
+ pip install pytest qiskit-aer
202
+ pytest tests/ -v
203
+ ```
204
+
205
+ ## License
206
+
207
+ MIT License - see [LICENSE](LICENSE) for details.
208
+
209
+ ---
210
+
211
+ Made with ❤️ for the quantum computing community on Apple Silicon.
metalq-0.1.0/README.md ADDED
@@ -0,0 +1,181 @@
1
+ # Metal-Q ⚛️🍎
2
+
3
+ A high-performance quantum circuit simulator for Apple Silicon, using Metal GPU acceleration.
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
7
+ [![Qiskit 2.x](https://img.shields.io/badge/Qiskit-2.x-6929C4.svg)](https://qiskit.org/)
8
+
9
+ ## Overview
10
+
11
+ Metal-Q is a drop-in replacement for Qiskit's statevector simulator, optimized for Apple Silicon GPUs. It leverages Metal compute shaders to achieve significant speedups on M1/M2/M3/M4 Macs.
12
+
13
+ ### Key Features
14
+
15
+ - 🚀 **Up to 32x faster** than Qiskit for large circuits
16
+ - 🔌 **Drop-in compatible** with Qiskit 2.x circuits
17
+ - 🍎 **Native Apple Silicon** optimization via Metal API
18
+ - 📦 **Simple installation** - no CUDA or complex dependencies
19
+ - ⚛️ **44 quantum gates** supported natively
20
+
21
+ ## Performance
22
+
23
+ Benchmarked on Apple M2 Pro (16GB RAM):
24
+
25
+ ### Statevector Simulation
26
+
27
+ | Qubits | Depth | Metal-Q | Qiskit | Speedup |
28
+ |--------|-------|---------|--------|---------|
29
+ | 16 | 10 | 41ms | 42ms | 1.0x |
30
+ | 20 | 10 | 80ms | 1,009ms | **12.7x** |
31
+ | 22 | 10 | 265ms | 4,888ms | **18.5x** |
32
+ | 24 | 8 | 732ms | 17,285ms | **23.6x** |
33
+ | 26 | 6 | 2,303ms | 54,444ms | **23.6x** |
34
+
35
+ ### Sampling (8192 shots)
36
+
37
+ | Qubits | Metal-Q | Aer | Speedup |
38
+ |--------|---------|-----|---------|
39
+ | 16 | 15ms | 18ms | 1.2x |
40
+ | 20 | 36ms | 138ms | **3.9x** |
41
+ | 22 | 203ms | 497ms | **2.5x** |
42
+ | 24 | 671ms | 1,475ms | **2.2x** |
43
+
44
+ ### QFT Circuit
45
+
46
+ | Qubits | Metal-Q | Qiskit | Speedup |
47
+ |--------|---------|--------|---------|
48
+ | 16 | 20ms | 24ms | 1.2x |
49
+ | 20 | 63ms | 603ms | **9.6x** |
50
+ | 22 | 137ms | 3,257ms | **23.8x** |
51
+ | 24 | 459ms | 14,788ms | **32.2x** |
52
+
53
+ ## Installation
54
+
55
+ ### Requirements
56
+
57
+ - macOS 12.0+ (Monterey or later)
58
+ - Apple Silicon (M1/M2/M3/M4) or Intel Mac with Metal support
59
+ - Python 3.9+
60
+ - Xcode Command Line Tools
61
+
62
+ ### Install from Source
63
+
64
+ ```bash
65
+ git clone https://github.com/masa-whitestone/metal-quantum.git
66
+ cd metal-quantum
67
+ make install
68
+ pip install .
69
+ ```
70
+
71
+ ## Quick Start
72
+
73
+ ```python
74
+ from qiskit import QuantumCircuit
75
+ import metalq
76
+
77
+ # Create a quantum circuit (standard Qiskit)
78
+ qc = QuantumCircuit(4, 4)
79
+ qc.h(0)
80
+ qc.cx(0, 1)
81
+ qc.cx(1, 2)
82
+ qc.cx(2, 3)
83
+ qc.measure([0, 1, 2, 3], [0, 1, 2, 3])
84
+
85
+ # Run on Metal-Q
86
+ result = metalq.run(qc, shots=1024)
87
+ print(result.get_counts())
88
+ # {'0000': 512, '1111': 512}
89
+ ```
90
+
91
+ ### Get Statevector
92
+
93
+ ```python
94
+ qc = QuantumCircuit(3)
95
+ qc.h(0)
96
+ qc.cx(0, 1)
97
+ qc.cx(1, 2)
98
+
99
+ # Get statevector directly
100
+ statevector = metalq.statevector(qc)
101
+ print(statevector)
102
+ # [0.707+0j, 0, 0, 0, 0, 0, 0, 0.707+0j]
103
+ ```
104
+
105
+ ## Supported Gates
106
+
107
+ ### Single-Qubit Gates (19)
108
+ `id`, `x`, `y`, `z`, `h`, `s`, `sdg`, `t`, `tdg`, `sx`, `sxdg`, `rx`, `ry`, `rz`, `p`, `u`, `u1`, `u2`, `u3`, `r`
109
+
110
+ ### Two-Qubit Gates (22)
111
+ `cx`, `cy`, `cz`, `ch`, `cs`, `csdg`, `csx`, `cp`, `crx`, `cry`, `crz`, `cu`, `cu1`, `cu3`, `swap`, `iswap`, `dcx`, `ecr`, `rxx`, `ryy`, `rzz`, `rzx`
112
+
113
+ ### Three-Qubit Gates (3)
114
+ `ccx` (Toffoli), `cswap` (Fredkin), `ccz`
115
+
116
+ ### High-Level Constructs
117
+ QFTGate, MCXGate, GroverOperator, UnitaryGate (automatically decomposed)
118
+
119
+ ## API Reference
120
+
121
+ ### `metalq.run(circuit, shots=1024)`
122
+
123
+ Execute a quantum circuit with measurements.
124
+
125
+ ```python
126
+ result = metalq.run(qc, shots=1024)
127
+ counts = result.get_counts() # {'00': 523, '11': 501}
128
+ ```
129
+
130
+ ### `metalq.statevector(circuit)`
131
+
132
+ Get the final statevector without measurements.
133
+
134
+ ```python
135
+ sv = metalq.statevector(qc) # numpy array
136
+ ```
137
+
138
+ ## Architecture
139
+
140
+ ```
141
+ ┌─────────────────────────────────────────────────┐
142
+ │ Python Layer │
143
+ │ (metalq package) │
144
+ ├─────────────────────────────────────────────────┤
145
+ │ ctypes Bridge │
146
+ ├─────────────────────────────────────────────────┤
147
+ │ Native Layer (ObjC) │
148
+ │ libmetalq.dylib │
149
+ ├─────────────────────────────────────────────────┤
150
+ │ Metal Compute Shaders │
151
+ │ quantum_gates.metallib │
152
+ └─────────────────────────────────────────────────┘
153
+
154
+
155
+ ┌─────────────────────────────────────────────────┐
156
+ │ Apple Silicon GPU │
157
+ │ (M1 / M2 / M3 / M4 Series) │
158
+ └─────────────────────────────────────────────────┘
159
+ ```
160
+
161
+ ## Limitations
162
+
163
+ - **macOS only** - Requires Metal API
164
+ - **No noise models** - Pure statevector simulation
165
+ - **Memory bound** - 28 qubits requires ~2GB GPU memory
166
+
167
+ ## Running Tests
168
+
169
+ ```bash
170
+ make install
171
+ pip install pytest qiskit-aer
172
+ pytest tests/ -v
173
+ ```
174
+
175
+ ## License
176
+
177
+ MIT License - see [LICENSE](LICENSE) for details.
178
+
179
+ ---
180
+
181
+ Made with ❤️ for the quantum computing community on Apple Silicon.
@@ -0,0 +1,36 @@
1
+ """
2
+ Metal-Q: Apple Metal GPU Quantum Circuit Simulator
3
+ """
4
+
5
+ from .backend import get_backend, MetalQBackend
6
+ from .result import MetalQResult
7
+
8
+ __version__ = "0.1.0"
9
+ __all__ = ['run', 'statevector', 'MetalQResult', 'MetalQBackend']
10
+
11
+
12
+ def run(circuit, shots: int = 1024) -> MetalQResult:
13
+ """
14
+ Run a quantum circuit on the Metal backend.
15
+
16
+ Args:
17
+ circuit: Qiskit QuantumCircuit
18
+ shots: Number of shots (default: 1024)
19
+
20
+ Returns:
21
+ MetalQResult object
22
+ """
23
+ return get_backend().run(circuit, shots)
24
+
25
+
26
+ def statevector(circuit):
27
+ """
28
+ Calculate the statevector of a quantum circuit.
29
+
30
+ Args:
31
+ circuit: Qiskit QuantumCircuit
32
+
33
+ Returns:
34
+ numpy.ndarray (complex64)
35
+ """
36
+ return get_backend().statevector(circuit)