Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ismaelfaro/wasm-quantum-simulator
Quantum Simulator in WebAssembly for Classical Developers 💻
https://github.com/ismaelfaro/wasm-quantum-simulator
Last synced: 15 days ago
JSON representation
Quantum Simulator in WebAssembly for Classical Developers 💻
- Host: GitHub
- URL: https://github.com/ismaelfaro/wasm-quantum-simulator
- Owner: ismaelfaro
- License: apache-2.0
- Created: 2021-11-25T03:51:48.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-13T05:14:06.000Z (11 months ago)
- Last Synced: 2023-12-13T06:25:20.015Z (11 months ago)
- Language: TypeScript
- Homepage:
- Size: 23.4 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WebAssembly quantum-simulator
Quantum Simulator in WebAssembly for Classical Developers 💻This is a very basic implementation of a Quantum Simulator in 200 lines of AssemblyScript to learn the basic component.
Allow to create your Quantum circuits with the basic Quantum Gates, and you can execute it using plain pythonmore info about AssemblyScript: https://www.assemblyscript.org/introduction.html
# Components
- Quantum Circuit Class:
- Quantum Gates: x, rx, ry, rz, z, y, h, cx
- Quanrtum Simulator Class:
- imput: Qcircuit
- outputs:
- statevector
- counts
- memory# Example:
Modify the [assembly/qengine.ts](assembly/qengine.ts) after line 200 to add your circuit
```
let qc = new QuantumCircuit(qubits);
qc.h(0)
qc.cx(0,1)let qs = new QuantumSimulator(qc);
qs.run()
let result = qs.statevector()
```# Run:
Install dependencies
```
npm install
```Compile to WASM
```
npm run asbuild
```
Run
```
npm start
```# TODO:
- better integration, sending the circuit from the host
- Integrate with https://github.com/JavaFXpert/grok-bloch bloch sphere visualization# references
Inspired in MicroQiskit python implementation https://github.com/qiskit-community/MicroQiskit by James Wootton