npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

grover-explorer-engine

v0.1.0

Published

A typed Grover search simulation engine with exact state-vector and analytical modes.

Readme

grover-explorer-engine

A framework-independent TypeScript engine for simulating Grover search.

It powers Grover Explorer's classical comparison, exact state-vector simulation, analytical large-problem model, Oracle and Diffusion transitions, measurement, history, and query accounting.

Install

npm install grover-explorer-engine

Run one Grover iteration

import {
  createProblemInstance,
  createQuantumState,
  groverStep,
  measure
} from "grover-explorer-engine";

const { instance, target } = createProblemInstance(16, 6, "example-1");
let state = createQuantumState(instance);

const stepped = groverStep(state, instance);
if (!stepped.ok) throw new Error(stepped.error.message);
state = stepped.state;

console.log(state.iteration);       // 1
console.log(state.oracleQueries);   // 1

const measured = measure(state, instance, Math.random());
if (!measured.ok) throw new Error(measured.error.message);

console.log(measured.state.measuredIndex, target);

The measurement sample is supplied explicitly. The engine does not import its own random source, which makes simulations deterministic when you provide a fixed sample.

Apply Oracle and Diffusion separately

import {
  applyDiffusion,
  applyOracle,
  createProblemInstance,
  createQuantumState
} from "grover-explorer-engine";

const { instance } = createProblemInstance(8, 3, "step-by-step");
const initial = createQuantumState(instance);

if (initial.mode !== "exact") throw new Error("Expected exact mode");

const marked = applyOracle(initial, instance);
if (!marked.ok) throw new Error(marked.error.message);

const amplified = applyDiffusion(marked.state, instance);
if (!amplified.ok) throw new Error(amplified.error.message);

console.log(amplified.state.iteration); // 1

Exact and analytical modes

  • N <= 256: full complex state-vector simulation.
  • N > 256: constant-size analytical model using sin²((2k+1)θ).

Use distributionView(state, instance) to obtain a rendering-safe probability view for either mode.

Transition results

State-changing functions return a discriminated result:

const result = groverStep(state, instance);

if (result.ok) {
  state = result.state;
} else {
  console.error(result.error.tag, result.error.message);
}

Invalid transitions return the unchanged canonical state alongside a typed audit error.

Public API

The package exposes:

  • problem and state creation;
  • exact Oracle and Diffusion operations;
  • complete Grover steps;
  • measurement and step-back transitions;
  • classical sequential-search state and transitions;
  • exact and analytical probability views;
  • optimal-iteration and Grover-angle helpers;
  • validation results and TypeScript state types.

Scope and limitations

This is an educational simulation engine, not a quantum-hardware interface. Exact simulation is intentionally limited to N = 256; larger problems use the documented analytical model.

License

Licensed under the MIT License.

Free to use, modify, and distribute, including commercially. Attribution is required by the licence terms.