API Reference

GF(2) matrix.

This class exposes binary linear algebra over GF(2) implemented in Rust using PyO3.

__doc__ = 'GF(2) matrix.\n\nThis class exposes binary linear algebra over GF(2)\nimplemented in Rust using PyO3.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ = 'gf2_lin_algebra.gf2_lin_algebra' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

echelon_form() method descriptor

Compute the echelon form of a GF2Matrix

Returns

(GF2Matrix, list[tuple[int, int]]): The first element is the RREF form of the matrix and the second is the history of the row operations applied to the matrix to compute the RREF. Each element of the row operations vector, is a tuple heving the modified row as first element and the row to which it has been summed as second element: R1 -> R1 + R2 is represented the entry (R1, R2) The swap of two rows is represented as 3 entries: swap(R1, R2) is represented as (R1, R2), (R2,R1), (R1,R2)

get_element(row_idx, column_idx) method descriptor

Get the element of a GF2Matrix from the indexes.

Arguments

  • row_idx - row index of the element
  • column_idx - column inde of the element

Returns

int: Value at selected position.

image() method descriptor

Compute the base of the image of a GF2Matric

Returns

List[list[int]]: Basis vector spanning the image.

is_reduced_echelon() method descriptor

Check if matrix is in reduced echelon form (RREF).

Returns:

bool: True if matrix is in RREF, otherwise False.

kernel() method descriptor

Compue the base otf the kernel of a GF2Matrix

Retuens

List[list[int]]: Basis vectors spanning the kernel.

ncols() method descriptor

Get the number or columns of a GF2Matrix.

Returns

int: Number of columns of the GF2Matrix.

nrows() method descriptor

Get the number or rows of a PyGf2matrix.

Returns

int: Number of rows of the GF2Matrix.

rank() method descriptor

Compue the rank of a GF2Matrix

Returns

int: Rank of the matrix.

shape() method descriptor

Get the number of rows and columns of a GF2Matrix

Returns

Tuple(int, int): (number_of_rows, number_of_columns).

solve(b) method descriptor

Solve the system of linear equation defined by a GF2Matrix and a right-hand-side vector b.

Arguments

  • b - RHS vector of the system of equation

Returns

List[int]: Solution vector.

solve_matrix_system(y) method descriptor

Solve the system of equationd efines by the GF2Matrix and by a right hand side GF2Matrix.

Arguments

  • - RHS GF2Matrix

Returns

GF2Matrix: Solution matrix.

to_list() method descriptor

Convert PyGF2Matrix to vector of vectors.

Returns

List[List[int]] correspomding to the matrix elements