quri_parts.core.utils.binary_field module

class BinaryArray(iter)

Bases: Sequence[int]

Array with elements in the binary field.

+, * and @ operators are defined. + and * perform element wise addition and multiplication respectively, returning a BinaryArray. @ performs binary inner product between two BinaryArray, returning either 0 or 1.

Parameters:

iter (Iterable[Union[int, bool]])

property binary: int

Binary representation of the array.

class BinaryMatrix(iter)

Bases: Iterable[BinaryArray], Sized

Matrix with elements in the binary field.

@ operator is defined as matrix multiplication (in the binary field). It can be applied to either of a BinaryMatrix or BinaryArray.

Parameters:

iter (Iterable[Iterable[Union[bool, int]]])

transpose()

Returns a transposed matrix.

Return type:

BinaryMatrix

hstack(a, b)
Parameters:
Return type:

BinaryMatrix

vstack(a, b)
Parameters:
Return type:

BinaryMatrix

inverse(mat)

Returns an inverse of the matrix.

Parameters:

mat (BinaryMatrix)

Return type:

BinaryMatrix