Skip to main content

Sketch a matrix from a few of its rows, with the cost stated beside the answer.

Approximate a matrix from a few rows and columns drawn by weight, and see what each theorem asks for beside what was used.

Draw rows and columns with probability proportional to their weight, decompose the small matrix they make, and answer from that. Each answer carries a label: what each source theorem asks for at this very matrix, what the run used, and the error measured against the full decomposition.

Change the matrix

The engine is the browser build of commit 9888b97d5229; this page checks its file's SHA-256 before it runs. Nothing you sketch here is sent anywhere.

Make a matrix, pick a question, and sketch.

The matrix is generated from a seed: its rank, its singular values running evenly from 1 down to 1/condition, and noise of the given share. The sketch draws rows by their squared norms and columns within them by their squared entries; ε, δ and η are what the theorems are asked for, so the label can state their counts.

The question

How a sketch answers, and what the label states.

  1. Sample by weight. The matrix is held as one tree of squared entries per row and a tree of the rows' squared norms, so a row is drawn with probability ‖Ai‖²/‖A‖F² and an entry within it by its square, each in a number of steps that grows with the logarithm of the size.
  2. Decompose the small matrix. The sampled rows, rescaled, make a small matrix whose decomposition gives approximate leading directions of the whole, each a combination of the sampled rows.
  3. Answer from the sketch. The leading directions themselves; items for a user, drawn from the projection of the user's row by rejection; or the entries, draws and inner products of a least-squares answer.
  4. State the cost beside the answer. Each source theorem's count is worked out at this matrix's own parameters, whether its constant is stated or hidden, beside the count the run used; where the full decomposition can be made, the error is measured against it.

Sketch the same matrix on your own machine.

The command line at the same commit takes the same request and gives the same bits. With Rust installed through rustup:

git clone https://git.transaction.science/Transaction-Science/open-standards
cd open-standards
git checkout 9888b97d5229674f5038bad6da9d1fa7fb3d251c
cd wai/wai-quantum-cli
cargo run --release --bin wai-quantum -- lab dequant example lowrank > request.json
cargo run --release --bin wai-quantum -- lab dequant lowrank --request request.json --demo-key

The kernels, their sources and every member of a request are in the guide to dequantized linear algebra. This page's engine was built with rustc 1.100.0 and wasm-pack 0.15.0; its file's SHA-256 is 12808555bc0d5084941e56acfba3a97efa0afd20cbb6a6c29d57403ed63bdd74.

Where to go from here