Skip to main content

A computational laboratory for finite field vector spaces, Hamming balls, and sumset structural analysis.

Project description

Finite-Field Spaces (ffspaces)

ffspaces is a lightweight Python toolkit for working with vectors over finite fields $\mathbb{F}_p^n$, with a focus on sumset analysis, linear-subspace structure, and Hamming-ball geometry.

The package is designed for small-to-medium computational experiments in additive combinatorics, coding theory, and related discrete geometry settings. It provides both direct implementations and faster specialized routines for common operations over finite fields.

Current functionality

  • Finite-field vector spaces: generate the full vector space $\mathbb{F}_p^n$ or construct random invertible basis changes.
  • Finite-field rank: compute matrix rank over $\mathbb{F}_p$ using modular Gaussian elimination.
  • Sumsets: compute $S+S$ for a set of vectors over $\mathbb{F}_p^n$, including a direct reference method and a faster FWHT-based implementation.
  • Subspace detection: find the largest linear subspace contained in a sumset, with both greedy and exhaustive search modes.
  • Hamming-ball geometry: generate standard Hamming balls, compute Hamming weights, and build balls under arbitrary linear transforms.
  • Cover constructions: build unions of Hamming balls and compute complements relative to a universe.

Features

  • NumPy-based operations: vectorized generation and manipulation of finite-field vectors.
  • Field-aware linear algebra: rank and invertibility checks performed over $\mathbb{F}_p$, not over the reals.
  • Flexible geometry tools: support for binary and higher-characteristic experiments.
  • Reusable experiment helpers: scripts and utilities in the experiments/ directory for one-off analysis.

Installation

Clone the repository and install it in editable mode:

git clone https://github.com/nathanhoehndorf/finite-field-spaces
cd finite-field-spaces
pip install -e .

The package requires Python 3.10+ and NumPy.

Mathematical background

This package works in the vector space $\mathbb{F}_p^n$, where each coordinate is taken modulo a prime $p$. In particular, $\mathbb{F}_2^n$ is the set of binary vectors of length $n$, with addition done coordinatewise modulo $2$.

  • What is $\mathbb{F}_p^n$? A finite-dimensional vector space over the finite field with $p$ elements. For $p=2$, this is the space of binary vectors.
  • What is $S+S$? For a set $S \subseteq \mathbb{F}_p^n$, the sumset $S+S$ is the set of all pairwise sums $x+y$ with $x,y \in S$, taken modulo $p$.
  • What is a Hamming ball? A Hamming ball is the set of vectors within a given distance from a center, where distance is the number of coordinates in which two vectors differ (known as Hamming weight, or the Hamming metric).
  • What is the covering problem? A covering problem asks whether a collection of balls (or other subsets) can be chosen so that their union contains all points in a given universe, or perhaps all points of a particular structure.
  • Why does this matter? These objects are central in additive combinatorics, coding theory, and discrete geometry, and they provide a natural setting for studying how small sets expand under addition or how geometric configurations cover a space.

Quick example

import numpy as np
from ffspaces import generate_space, compute_sumset, find_maximum_subspace_dimension

space = generate_space(3, p=2)
subset = space[[0, 1, 2, 4]]
sumset = compute_sumset(subset, p=2)
dimension = find_maximum_subspace_dimension(sumset, p=2)
print(dimension)

Experiments

One-off analysis and experiment scripts live in the experiments/ directory so they stay separate from the installable package code in src/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ffspaces-0.2.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ffspaces-0.2.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file ffspaces-0.2.0.tar.gz.

File metadata

  • Download URL: ffspaces-0.2.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ffspaces-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5d1cf73a21274fb8774599fd65ac1e3ad73456b14eec31ac56dff8ca9a64b8fc
MD5 7541c3cbd09bc11160d39f67e021f4b8
BLAKE2b-256 7a57f4c166c4c9a9832e321167806316639167ac50fbdde7aed7a62d2a66f494

See more details on using hashes here.

File details

Details for the file ffspaces-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ffspaces-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ffspaces-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c4bb517531123b3f2fdf8325874dd7eb36dcd4457bb60d9e1faab778c8f06712
MD5 36734b239860cb6b166aba2abbbf38dd
BLAKE2b-256 8bb102b8d23fc61880a8b66653acfcc7b940463510a9d200610a88316b3bf8c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page