Purpose: Solve a sparse linear system, compute a determinant, or find the minimal polynomial of a sparse matrix over a finite field in operations — where is the number of nonzeros — using only matrix-vector products. No fill-in, no .

The Idea

Gaussian elimination on a sparse matrix destroys sparsity: zeros fill in, and you end up doing work on a dense matrix that no longer fits in memory. Wiedemann never modifies the matrix at all. It only ever computes .

  1. Pick random vectors .
  2. Compute the Krylov sequence of scalars

    Each step is one matrix-vector product: each, total.
  3. Run Berlekamp-Massey on to find the shortest linear recurrence it satisfies. With high probability this recurrence is the minimal polynomial of .
  4. From :
    • Solve : if , then , so is a short linear combination of Krylov vectors.
    • Determinant: if the minimal polynomial equals the characteristic polynomial (generic case), ; otherwise randomise with a diagonal preconditioner and retry.

Complexity

  • Time: field operations
  • Space: the matrix is never modified
  • Randomized (Las Vegas): the answer is verifiable, so failure only costs a retry

Compare Gaussian elimination: time and space after fill-in. For with , Wiedemann is feasible and elimination is not.

Why the random vectors work

satisfies the linear recurrence given by the minimal polynomial of , for any . The risk is that the sequence satisfies a shorter recurrence by accident — which happens only if or is unluckily aligned with an invariant subspace. Over a field of size that has probability , so for a large prime modulus one try almost always suffices.

Where it is used

  • Integer factorisation. The quadratic sieve and the number field sieve both end with a huge sparse linear algebra problem — millions of rows, a few dozen nonzeros per row. Block Wiedemann and block Lanczos are the algorithms that solve it; this step is a substantial fraction of every factorisation record.
  • Discrete logarithms by index calculus — the same sparse linear algebra.
  • Sparse determinants and ranks in computer algebra systems.

Block Wiedemann

Coppersmith’s block variant uses as blocks of vectors rather than single vectors, so the matrix-vector products become matrix-matrix products with better cache behaviour, and — crucially — the work parallelises across machines. This is the standard version in factorisation software.

Variants / Use Cases