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 aBinaryArray
.@
performs binary inner product between twoBinaryArray
, 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 aBinaryMatrix
orBinaryArray
.- Parameters:
iter (Iterable[Iterable[Union[bool, int]]]) –
- transpose()#
Returns a transposed matrix.
- Return type:
- hstack(a, b)#
- Parameters:
a (BinaryMatrix) –
b (BinaryMatrix) –
- Return type:
- vstack(a, b)#
- Parameters:
a (BinaryMatrix) –
b (BinaryMatrix) –
- Return type:
- inverse(mat)#
Returns an inverse of the matrix.
- Parameters:
mat (BinaryMatrix) –
- Return type: