q1ss.binalg.base
Abstract base class for binary tensors.
Shape
bintensor
- class bintensor(data, *, readonly=False, copy=False)[source]
Bases:
objectAbstract base class for mutable binary tensors.
- exception ReadonlyError[source]
Bases:
ValueErrorSpecialised
ValueErrorsubclass for when attempting to mutate a readonly tensor.
- exception ShapeError[source]
Bases:
ValueErrorSpecialised
ValueErrorsubclass for shape errors.
- __add__(other)[source]
Componentwise mod 2 addition (bitwise XOR). :raises ShapeError: if the tensors have different shapes.
- __iadd__(other)[source]
Inplace componentwise mod 2 addition (bitwise XOR). :raises ShapeError: if the tensors have different shapes.
- __imul__(other)[source]
Inplace componentwise mod 2 multiplication (bitwise AND). :raises ShapeError: if the tensors have different shapes.
- __mul__(other)[source]
Componentwise mod 2 multiplication (bitwise AND). :raises ShapeError: if the tensors have different shapes.
- static __new__(cls, data, *, readonly=False, copy=False)[source]
Creates a new tensor with given shape from the given binary data. The class
BinTensorcannot be instantiated directly.If
readonly=True, the resulting tensor and its data are readonly. Ifcopy=True, a fresh copy of the given data is used.
- copy(*, readonly=False)[source]
Returns a copy of this tensor. If
readonly=True, the resulting copy is readonly.