bitgauss documentation

This package consists of Python bindings for the bitgauss library, which is a Rust library for fast linear algebraic operations over the 2-element field using bit matrices.

class bitgauss.BitMatrix(rows, cols)
bit(i, j)

Gets the bit at position (i, j)

static build(rows, cols, func)

Builds a BitMatrix from a Python function that determines the value of each bit

cols

Returns the number of logical columns in the matrix

copy()

Returns a copy of the matrix

static from_int_list(data)

Create matrix from a list of lists of integers (0 or 1)

static from_list(data)

Create matrix from a list of lists of bools

gauss(full=False)

Performs gaussian elimination

hstack(other)

Horizontally stacks this matrix with another one and returns the result

static identity(size)

Creates a new identity BitMatrix of size size x size

inverse()

Computes the inverse of an invertible matrix

is_zero()

Checks if the matrix consists of all zero bits

matmul(other)

Matrix multiplication method (alternative to operators)

nullspace()

Computes a basis for the nullspace of the matrix

static random(rows, cols, seed=None)

Creates a new random BitMatrix of size rows x cols

static random_invertible(size, seed=None)

Creates a new random invertible BitMatrix of size size x size

rank()

Computes the rank of the matrix using gaussian elimination

rows

Returns the number of logical rows in the matrix

set_bit(i, j, b)

Sets the bit at position (i, j) to b

to_int_list()

Convert matrix to a list of lists of integers (0 or 1)

to_list()

Convert matrix to a list of lists of bools

transpose_inplace()

Transposes the matrix in place

transposed()

Returns a transposed copy of the matrix

vstack(other)

Vertically stacks this matrix with another one and returns the result

static zeros(rows, cols)

Creates a new BitMatrix of size rows x cols with all bits set to 0