binar
High-performance bit manipulation library providing optimized bit vectors, bit matrices, and linear algebra over GF(2).
Features
- Bit Vectors: Efficient bit vector implementations with
BitVecandAlignedBitVec - Bit Matrices: High-performance bit matrix operations with
BitMatrixandAlignedBitMatrix - Linear Algebra over GF(2): Gaussian elimination, matrix multiplication, and rank computation
- Bitwise Traits: Generic trait system for bitwise operations across different types
- Portable Performance: Designed to leverage SIMD without explicit intrinsics, ensuring portability
Installation
Add this to your Cargo.toml:
[]
= "0.1"
Usage
use ;
// Create and manipulate bit vectors
let mut v1 = zeros;
v1.assign_index;
v1.assign_index;
let mut v2 = zeros;
v2.assign_index;
v2.assign_index;
// Bitwise operations
v1.bitxor_assign;
assert_eq!; // Bits at positions 17, 42 XOR 42, 99 = 17, 99
// Linear algebra over GF(2)
let mut matrix = identity;
matrix.set;
matrix.set;
// Gaussian elimination
let pivots = matrix.echelonize;
println!;
// Matrix-vector multiplication
let x = from_fn;
let y = &matrix * &x;
Python Bindings
Python bindings are available separately. See bindings/python for details.
Performance
This library prioritizes performance while maintaining portability. Operations are designed to benefit from SIMD optimizations without using explicit intrinsics, allowing the compiler to generate efficient code across different platforms.
Key use cases include:
- Sparse matrix operations
- Linear equation solving over GF(2)
- Rank computation
- Kernel and image computation
Benchmarks can be run with:
Documentation
Full API documentation is available on docs.rs.
License
Licensed under the MIT License.