[Paper Review] Bitslicing and the Method of Four Russians Over Larger Finite Fields
This paper presents an optimized method for matrix multiplication over finite fields larger than 𝔽₂, combining bitslicing with an adapted Method of Four Russians to reduce memory usage and accelerate computation. By packing field elements into words and leveraging parallel bit operations, the approach achieves faster performance than existing implementations, including Magma and LinBox, across 𝔽₃, 𝔽₅, 𝔽₇, and extension fields like 𝔽₂³ and 𝔽₃².
We present a method of computing with matrices over very small finite fields of size larger than 2. Specifically, we show how the Method of Four Russians can be efficiently adapted to these larger fields, and introduce a row-wise matrix compression scheme that both reduces memory requirements and allows one to vectorize element operations. We also present timings which confirm the efficiency of these methods and exceed the speed of the fastest implementations the authors are aware of.
Motivation & Objective
- To improve the efficiency of linear algebra operations over finite fields larger than 𝔽₂, which are under-optimized compared to 𝔽₂ and larger prime fields.
- To adapt the Method of Four Russians for fields like 𝔽₃, 𝔽₅, and 𝔽₇, where traditional lookup tables become impractical due to high cardinality.
- To reduce memory usage and enable vectorized operations through a novel row-wise matrix compression scheme based on bitslicing.
- To demonstrate that this hybrid approach outperforms state-of-the-art systems like Magma and LinBox for medium-sized matrices.
- To enable efficient computation in number theory and graph theory applications requiring linear algebra over small but non-binary finite fields.
Proposed method
- Adapts the Method of Four Russians to finite fields of size >2 by expressing field elements in an additive basis over 𝔽₂, enabling precomputation of binary combinations of matrix rows.
- Uses bitslicing to pack multiple field elements into single machine words, representing each element’s bits across separate words to allow parallel bitwise operations.
- Applies word-level arithmetic with masking and carry handling to perform field operations like addition and multiplication in 𝔽_p^n efficiently.
- Employs a row-wise matrix representation where each row is stored as a sequence of packed bits, reducing memory footprint and improving data locality.
- Introduces a hybrid representation for extension fields 𝔽_{p^n} by expressing matrices as polynomials in α with coefficients in 𝔽_p, enabling use of Karatsuba-style multiplication.
- Optimizes scalar multiplication and field arithmetic by leveraging low-level bit operations and minimizing padding through dedicated packing schemes.
Experimental results
Research questions
- RQ1Can the Method of Four Russians be efficiently extended to finite fields larger than 𝔽₂, where full lookup tables become infeasible?
- RQ2How can matrix storage and operation be optimized for small non-binary finite fields to reduce memory usage and improve cache efficiency?
- RQ3To what extent can bitslicing techniques be adapted to enable vectorized operations on field elements in 𝔽_p for p > 2?
- RQ4How does the performance of this method compare to existing high-performance libraries like Magma and LinBox for matrices over 𝔽₃, 𝔽₅, and extension fields?
- RQ5Can the combination of bitslicing and the Method of Four Russians yield a practical speedup in real-world applications such as number theory and graph theory?
Key findings
- The proposed method achieves faster matrix multiplication than Magma V2.15-3 for all tested fields, including 𝔽₃, 𝔽₅, 𝔽₇, and extension fields like 𝔽₂³ and 𝔽₃².
- For 1000×1000 matrices over 𝔽₃, the implementation runs in 12.2 ms, outperforming Magma’s 21.4 ms.
- In 𝔽₃², the method reduces time from 444.0 ms (Magma) to 37.6 ms for 1000×1000 matrices, showing a 12x speedup.
- The bitslicing-based compression reduces memory usage and enables vectorized operations, improving data-level parallelism.
- The method shows consistent performance gains across different field sizes and extension degrees, with the largest gains in medium-sized matrices.
- The implementation is included in Sage, indicating practical integration into open-source mathematical software.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.