Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/teddy55codes/blochsphere
Interactive bloch sphere implemented with Three.js
https://github.com/teddy55codes/blochsphere
bloch-sphere complex-numbers quantum-computing qubit threejs
Last synced: about 2 months ago
JSON representation
Interactive bloch sphere implemented with Three.js
- Host: GitHub
- URL: https://github.com/teddy55codes/blochsphere
- Owner: Teddy55Codes
- License: mit
- Created: 2024-07-14T22:14:12.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-28T03:50:27.000Z (6 months ago)
- Last Synced: 2024-11-16T20:58:56.542Z (about 2 months ago)
- Topics: bloch-sphere, complex-numbers, quantum-computing, qubit, threejs
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/interactive-blochsphere
- Size: 85.9 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Interactive Bloch Sphere
An interactive [bloch sphere](https://en.wikipedia.org/wiki/Bloch_sphere) implemented with [Three.js](https://threejs.org/).
## Features
* Setting qubit state to basis states:$$
\lvert 0 \rangle =
\left\lceil
\begin{matrix}
1 \\
0
\end{matrix}
\right\rceil
$$$$
\lvert 1 \rangle =
\left\lceil
\begin{matrix}
0 \\
1
\end{matrix}
\right\rceil
$$$$
\lvert - \rangle =
\frac {1} {\sqrt{2}}
\left\lceil
\begin{matrix}
1 \\
-1
\end{matrix}
\right\rceil
$$$$
\lvert + \rangle =
\frac {1} {\sqrt{2}}
\left\lceil
\begin{matrix}
1\\
1
\end{matrix}
\right\rceil
$$$$
\lvert -i \rangle =
\frac {1} {\sqrt{2}}
\left\lceil
\begin{matrix}
1 \\
-i
\end{matrix}
\right\rceil
$$$$
\lvert +i \rangle =
\frac {1} {\sqrt{2}}
\left\lceil
\begin{matrix}
1 \\
i
\end{matrix}
\right\rceil
$$* Applying gates, this includes:
* Half turn gates:
* $X$ Gate
* $Y$ Gate
* $Z$ Gate
* $H$ Gate
* Quater turn gates:
* $S$ Gate ($\sqrt{Z}$)
* $S^{-1}$ Gate ($Z^{-\frac 1 2}$)
* $Y^{\frac 1 2}$ Gate
* $Y^{-\frac 1 2}$ Gate
* $X^{\frac 1 2}$ Gate
* $X^{-\frac 1 2}$ Gate
* Eighth turn gates:
* $T$ Gate
* $T^{-1}$ Gate
* $Y^{\frac 1 4}$ Gate
* $Y^{-\frac 1 4}$ Gate
* $X^{\frac 1 4}$ Gate
* $X^{-\frac 1 4}$ GateThese gates can be applied in any order for example $H, T, Y^{-\frac 1 4}$ will result in this state:
![example qubit state](readme-resources/example-qubit-state.png)
## How To Run
1. Have npm installed
2. run `npm install`
3. run `vite serve`## Use As npm Package
This project is available as an npm package under the name [interactive-blochsphere](https://www.npmjs.com/package/interactive-blochsphere).### Example Usage
```javascript
import {InteractiveBlochSphere} from "interactive-blochsphere";new InteractiveBlochSphere(document.getElementById("blochsphere"));
```