Compare commits

..

No commits in common. "main" and "v0.5.0" have entirely different histories.
main ... v0.5.0

3 changed files with 54 additions and 20 deletions

View File

@ -6,6 +6,8 @@ A tiny Python package that steps through Grovers Search algorithm and shows y
- A sinecurve of successprobability vs. iteration - A sinecurve of successprobability vs. iteration
- A geometric "rotation" on the unit circle - A geometric "rotation" on the unit circle
Choose between a Matplotlib-based CLI or an optional DearPyGui GUI (WIP).
--- ---
![Demo of Grovers Visualizer](media/demo.gif) ![Demo of Grovers Visualizer](media/demo.gif)
@ -14,37 +16,69 @@ A tiny Python package that steps through Grovers Search algorithm and shows y
## Installation ## Installation
### Using [uv](https://docs.astral.sh/uv/)/[uvx](https://docs.astral.sh/uv/guides/tools/) ### Via [pipx](https://pipx.pypa.io/stable/installation/)
Basic (CLI only):
```bash
pipx install grovers-visualizer
grovers-visualizer 1111
```
With the optional DearPyGui UI (WIP):
```bash
pipx "grovers-visualizer[ui]"
grovers-visualizer --ui
```
### Via [uvx](https://docs.astral.sh/uv/guides/tools/)
Basic (CLI only):
```bash ```bash
uvx grovers-visualizer 1111 uvx grovers-visualizer 1111
``` ```
### Using [pip](https://pypi.org/project/pip/)/[pipx](https://pipx.pypa.io/stable/installation/) With the optional UI extra:
```bash ```bash
pip grovers-visualizer uvx "grovers-visualizer[ui]" --ui
# or
pipx grovers-visualizer # (recommended)
# and then run
grovers-visualizer
``` ```
--- ---
## Usage ## Usage
### Flags ### CLI Mode
- `TARGET` Flags:
Target bitstring (e.g. `010`). Length also determines number of qubits.
- `-i, --iterations ITERATIONS` `-t, --target`
Max iterations; `0` means use the optimal $\lfloor\frac\pi4\sqrt{2^n}\rfloor$. Target bitstring (e.g. `010`). Length determines number of qubits.
- `-s, --speed SPEED` `-s, --speed`
Delay between iterations (seconds). Default `0.5`. Delay between iterations (seconds). Default `0.5`.
- `-p, --phase PHASE` `-i, --iterations`
The phase $\psi$ (in radians) used for both the oracle and diffusion steps. Defaults to $\pi$ (i.e. a sign-flip, $e^{i\pi}=-1$). Max iterations; `0` means use the optimal $\lfloor\frac\pi4\sqrt{2^n}\rfloor$.
`--ui`
Launch the optional DearPyGui GUI (requires the `[ui]` extra) (WIP).
### GUI Mode (WIP)
If you installed with `"[ui]"`, launch the DearPyGui window:
```
grovers-visualizer --ui
```
In the UI you can:
- Set number of qubits
- Enter the target bitstring
- Choose max iterations or leave at 0 for optimal
- Control the animation speed
Hit **Start** to watch the bar chart, sine plot, and rotationcircle update in real time.
--- ---

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 KiB

After

Width:  |  Height:  |  Size: 292 KiB

View File

@ -155,7 +155,7 @@ wheels = [
[[package]] [[package]]
name = "grovers-visualizer" name = "grovers-visualizer"
version = "0.5.0" version = "0.4.2"
source = { editable = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "numpy" }, { name = "numpy" },