ffspaces 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ffspaces
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A computational laboratory for finite field vector spaces, Hamming balls, and sumset structural analysis.
5
5
  Author: Nathan Hoehndorf
6
6
  Project-URL: Homepage, https://github.com/nathanhoehndorf/finite-field-spaces
@@ -38,7 +38,13 @@ The package is designed for small-to-medium computational experiments in additiv
38
38
 
39
39
  ## Installation
40
40
 
41
- Clone the repository and install it in editable mode:
41
+ Install from PyPI:
42
+
43
+ ```bash
44
+ pip install ffspaces
45
+ ```
46
+
47
+ Or clone the repository and install in editable mode:
42
48
 
43
49
  ```bash
44
50
  git clone https://github.com/nathanhoehndorf/finite-field-spaces
@@ -48,6 +54,85 @@ pip install -e .
48
54
 
49
55
  The package requires Python 3.10+ and NumPy.
50
56
 
57
+ ## Package API
58
+
59
+ After installing with `pip install ffspaces`, import the public API from the package root:
60
+
61
+ ```python
62
+ from ffspaces import (
63
+ generate_space,
64
+ generate_random_basis,
65
+ is_invertible,
66
+ vectors_to_ints,
67
+ ints_to_vectors,
68
+ compute_sumset_fwht,
69
+ _compute_sumset_original,
70
+ compute_sumset,
71
+ compare_sumset_methods,
72
+ find_maximum_subspace_dimension,
73
+ generate_covering,
74
+ complement,
75
+ compute_hamming_weight,
76
+ generate_hamming_ball,
77
+ generate_standard_ball,
78
+ )
79
+ ```
80
+
81
+ ### Core utilities
82
+
83
+ - `generate_space(n, p=2)`: returns all vectors in $\mathbb{F}_p^n$ as a NumPy array of shape `(p**n, n)`.
84
+ - `generate_random_basis(n, p=2, rng=None)`: returns a random invertible `n x n` matrix over $\mathbb{F}_p$.
85
+ - `is_invertible(matrix, p=2)`: checks whether a square matrix is invertible over $\mathbb{F}_p$.
86
+
87
+ ### Vector encoding
88
+
89
+ - `vectors_to_ints(vectors, p=2)`: maps each row of a matrix in $\mathbb{Z}_p^n$ to a unique integer.
90
+ - `ints_to_vectors(ints, n, p=2)`: converts integer codes back into $\mathbb{Z}_p^n$ vectors.
91
+
92
+ ### Sumset operations
93
+
94
+ - `compute_sumset_fwht(set_elements, p=2)`: computes the sumset $S+S$ using a Fourier-based transform over the finite field.
95
+ - `_compute_sumset_original(set_elements, p=2)`: computes $S+S$ by direct pairwise sums and unique filtering.
96
+ - `compute_sumset(set_elements, p=2)`: alias for the fast FWHT-based sumset computation.
97
+ - `compare_sumset_methods(n=6, subset_size=10, seed=None)`: generates a random binary subset and compares FWHT and direct sumset methods.
98
+
99
+ ### Subspace analysis
100
+
101
+ - `find_maximum_subspace_dimension(sumset, p=2, exhaustive=False, max_combinations=10000)`: returns the dimension of the largest linear subspace contained in a sumset.
102
+
103
+ ### Hamming geometry and covering
104
+
105
+ - `generate_standard_ball(n, r)`: returns all binary vectors in $\mathbb{F}_2^n$ with Hamming weight at most `r`.
106
+ - `compute_hamming_weight(vectors)`: computes Hamming weights for each row of a matrix.
107
+ - `generate_hamming_ball(universe, center, radius, linear_transform, p=2)`: builds a Hamming ball in $\mathbb{F}_p^n$ under a linear basis transform.
108
+ - `generate_covering(centers, radii, bases=None, p=2, universe=None)`: returns the union of Hamming balls defined by `centers`, `radii`, and optional basis transforms.
109
+ - `complement(universe, covered)`: returns vectors in `universe` that are not present in `covered`.
110
+
111
+ ### Example usage
112
+
113
+ ```python
114
+ import numpy as np
115
+ from ffspaces import generate_space, compute_sumset, find_maximum_subspace_dimension
116
+
117
+ space = generate_space(3, p=2)
118
+ subset = space[[0, 1, 2, 4]]
119
+ sumset = compute_sumset(subset, p=2)
120
+ dimension = find_maximum_subspace_dimension(sumset, p=2)
121
+ print("sumset shape:", sumset.shape)
122
+ print("max subspace dimension:", dimension)
123
+ ```
124
+
125
+ ```python
126
+ from ffspaces import generate_standard_ball, generate_covering, complement
127
+
128
+ ball = generate_standard_ball(4, 2)
129
+ universe = generate_space(4, p=2)
130
+ covered = generate_covering([np.zeros(4, dtype=int)], [2], p=2)
131
+ missing = complement(universe, covered)
132
+ print("covered size:", covered.shape[0])
133
+ print("missing size:", missing.shape[0])
134
+ ```
135
+
51
136
  ## Mathematical background
52
137
 
53
138
  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$.
@@ -22,7 +22,13 @@ The package is designed for small-to-medium computational experiments in additiv
22
22
 
23
23
  ## Installation
24
24
 
25
- Clone the repository and install it in editable mode:
25
+ Install from PyPI:
26
+
27
+ ```bash
28
+ pip install ffspaces
29
+ ```
30
+
31
+ Or clone the repository and install in editable mode:
26
32
 
27
33
  ```bash
28
34
  git clone https://github.com/nathanhoehndorf/finite-field-spaces
@@ -32,6 +38,85 @@ pip install -e .
32
38
 
33
39
  The package requires Python 3.10+ and NumPy.
34
40
 
41
+ ## Package API
42
+
43
+ After installing with `pip install ffspaces`, import the public API from the package root:
44
+
45
+ ```python
46
+ from ffspaces import (
47
+ generate_space,
48
+ generate_random_basis,
49
+ is_invertible,
50
+ vectors_to_ints,
51
+ ints_to_vectors,
52
+ compute_sumset_fwht,
53
+ _compute_sumset_original,
54
+ compute_sumset,
55
+ compare_sumset_methods,
56
+ find_maximum_subspace_dimension,
57
+ generate_covering,
58
+ complement,
59
+ compute_hamming_weight,
60
+ generate_hamming_ball,
61
+ generate_standard_ball,
62
+ )
63
+ ```
64
+
65
+ ### Core utilities
66
+
67
+ - `generate_space(n, p=2)`: returns all vectors in $\mathbb{F}_p^n$ as a NumPy array of shape `(p**n, n)`.
68
+ - `generate_random_basis(n, p=2, rng=None)`: returns a random invertible `n x n` matrix over $\mathbb{F}_p$.
69
+ - `is_invertible(matrix, p=2)`: checks whether a square matrix is invertible over $\mathbb{F}_p$.
70
+
71
+ ### Vector encoding
72
+
73
+ - `vectors_to_ints(vectors, p=2)`: maps each row of a matrix in $\mathbb{Z}_p^n$ to a unique integer.
74
+ - `ints_to_vectors(ints, n, p=2)`: converts integer codes back into $\mathbb{Z}_p^n$ vectors.
75
+
76
+ ### Sumset operations
77
+
78
+ - `compute_sumset_fwht(set_elements, p=2)`: computes the sumset $S+S$ using a Fourier-based transform over the finite field.
79
+ - `_compute_sumset_original(set_elements, p=2)`: computes $S+S$ by direct pairwise sums and unique filtering.
80
+ - `compute_sumset(set_elements, p=2)`: alias for the fast FWHT-based sumset computation.
81
+ - `compare_sumset_methods(n=6, subset_size=10, seed=None)`: generates a random binary subset and compares FWHT and direct sumset methods.
82
+
83
+ ### Subspace analysis
84
+
85
+ - `find_maximum_subspace_dimension(sumset, p=2, exhaustive=False, max_combinations=10000)`: returns the dimension of the largest linear subspace contained in a sumset.
86
+
87
+ ### Hamming geometry and covering
88
+
89
+ - `generate_standard_ball(n, r)`: returns all binary vectors in $\mathbb{F}_2^n$ with Hamming weight at most `r`.
90
+ - `compute_hamming_weight(vectors)`: computes Hamming weights for each row of a matrix.
91
+ - `generate_hamming_ball(universe, center, radius, linear_transform, p=2)`: builds a Hamming ball in $\mathbb{F}_p^n$ under a linear basis transform.
92
+ - `generate_covering(centers, radii, bases=None, p=2, universe=None)`: returns the union of Hamming balls defined by `centers`, `radii`, and optional basis transforms.
93
+ - `complement(universe, covered)`: returns vectors in `universe` that are not present in `covered`.
94
+
95
+ ### Example usage
96
+
97
+ ```python
98
+ import numpy as np
99
+ from ffspaces import generate_space, compute_sumset, find_maximum_subspace_dimension
100
+
101
+ space = generate_space(3, p=2)
102
+ subset = space[[0, 1, 2, 4]]
103
+ sumset = compute_sumset(subset, p=2)
104
+ dimension = find_maximum_subspace_dimension(sumset, p=2)
105
+ print("sumset shape:", sumset.shape)
106
+ print("max subspace dimension:", dimension)
107
+ ```
108
+
109
+ ```python
110
+ from ffspaces import generate_standard_ball, generate_covering, complement
111
+
112
+ ball = generate_standard_ball(4, 2)
113
+ universe = generate_space(4, p=2)
114
+ covered = generate_covering([np.zeros(4, dtype=int)], [2], p=2)
115
+ missing = complement(universe, covered)
116
+ print("covered size:", covered.shape[0])
117
+ print("missing size:", missing.shape[0])
118
+ ```
119
+
35
120
  ## Mathematical background
36
121
 
37
122
  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$.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ffspaces"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  authors = [{name="Nathan Hoehndorf"}]
9
9
  description = "A computational laboratory for finite field vector spaces, Hamming balls, and sumset structural analysis."
10
10
  readme = "README.md"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ffspaces
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A computational laboratory for finite field vector spaces, Hamming balls, and sumset structural analysis.
5
5
  Author: Nathan Hoehndorf
6
6
  Project-URL: Homepage, https://github.com/nathanhoehndorf/finite-field-spaces
@@ -38,7 +38,13 @@ The package is designed for small-to-medium computational experiments in additiv
38
38
 
39
39
  ## Installation
40
40
 
41
- Clone the repository and install it in editable mode:
41
+ Install from PyPI:
42
+
43
+ ```bash
44
+ pip install ffspaces
45
+ ```
46
+
47
+ Or clone the repository and install in editable mode:
42
48
 
43
49
  ```bash
44
50
  git clone https://github.com/nathanhoehndorf/finite-field-spaces
@@ -48,6 +54,85 @@ pip install -e .
48
54
 
49
55
  The package requires Python 3.10+ and NumPy.
50
56
 
57
+ ## Package API
58
+
59
+ After installing with `pip install ffspaces`, import the public API from the package root:
60
+
61
+ ```python
62
+ from ffspaces import (
63
+ generate_space,
64
+ generate_random_basis,
65
+ is_invertible,
66
+ vectors_to_ints,
67
+ ints_to_vectors,
68
+ compute_sumset_fwht,
69
+ _compute_sumset_original,
70
+ compute_sumset,
71
+ compare_sumset_methods,
72
+ find_maximum_subspace_dimension,
73
+ generate_covering,
74
+ complement,
75
+ compute_hamming_weight,
76
+ generate_hamming_ball,
77
+ generate_standard_ball,
78
+ )
79
+ ```
80
+
81
+ ### Core utilities
82
+
83
+ - `generate_space(n, p=2)`: returns all vectors in $\mathbb{F}_p^n$ as a NumPy array of shape `(p**n, n)`.
84
+ - `generate_random_basis(n, p=2, rng=None)`: returns a random invertible `n x n` matrix over $\mathbb{F}_p$.
85
+ - `is_invertible(matrix, p=2)`: checks whether a square matrix is invertible over $\mathbb{F}_p$.
86
+
87
+ ### Vector encoding
88
+
89
+ - `vectors_to_ints(vectors, p=2)`: maps each row of a matrix in $\mathbb{Z}_p^n$ to a unique integer.
90
+ - `ints_to_vectors(ints, n, p=2)`: converts integer codes back into $\mathbb{Z}_p^n$ vectors.
91
+
92
+ ### Sumset operations
93
+
94
+ - `compute_sumset_fwht(set_elements, p=2)`: computes the sumset $S+S$ using a Fourier-based transform over the finite field.
95
+ - `_compute_sumset_original(set_elements, p=2)`: computes $S+S$ by direct pairwise sums and unique filtering.
96
+ - `compute_sumset(set_elements, p=2)`: alias for the fast FWHT-based sumset computation.
97
+ - `compare_sumset_methods(n=6, subset_size=10, seed=None)`: generates a random binary subset and compares FWHT and direct sumset methods.
98
+
99
+ ### Subspace analysis
100
+
101
+ - `find_maximum_subspace_dimension(sumset, p=2, exhaustive=False, max_combinations=10000)`: returns the dimension of the largest linear subspace contained in a sumset.
102
+
103
+ ### Hamming geometry and covering
104
+
105
+ - `generate_standard_ball(n, r)`: returns all binary vectors in $\mathbb{F}_2^n$ with Hamming weight at most `r`.
106
+ - `compute_hamming_weight(vectors)`: computes Hamming weights for each row of a matrix.
107
+ - `generate_hamming_ball(universe, center, radius, linear_transform, p=2)`: builds a Hamming ball in $\mathbb{F}_p^n$ under a linear basis transform.
108
+ - `generate_covering(centers, radii, bases=None, p=2, universe=None)`: returns the union of Hamming balls defined by `centers`, `radii`, and optional basis transforms.
109
+ - `complement(universe, covered)`: returns vectors in `universe` that are not present in `covered`.
110
+
111
+ ### Example usage
112
+
113
+ ```python
114
+ import numpy as np
115
+ from ffspaces import generate_space, compute_sumset, find_maximum_subspace_dimension
116
+
117
+ space = generate_space(3, p=2)
118
+ subset = space[[0, 1, 2, 4]]
119
+ sumset = compute_sumset(subset, p=2)
120
+ dimension = find_maximum_subspace_dimension(sumset, p=2)
121
+ print("sumset shape:", sumset.shape)
122
+ print("max subspace dimension:", dimension)
123
+ ```
124
+
125
+ ```python
126
+ from ffspaces import generate_standard_ball, generate_covering, complement
127
+
128
+ ball = generate_standard_ball(4, 2)
129
+ universe = generate_space(4, p=2)
130
+ covered = generate_covering([np.zeros(4, dtype=int)], [2], p=2)
131
+ missing = complement(universe, covered)
132
+ print("covered size:", covered.shape[0])
133
+ print("missing size:", missing.shape[0])
134
+ ```
135
+
51
136
  ## Mathematical background
52
137
 
53
138
  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$.
File without changes
File without changes