Skip to content

Introduction


Inheritance from Matrix Class

Binary Matrix is a special subset of matrices in general , which reflects in Pyrix as well by Inheriting all of the methods used in the traditional Matrix class . Instead or reinventing the wheel i have extended the Matrix class as a superclass of BinaryMatrix class. Some Methods which are Unique to Binary Matrices are implemented in the sub class hence defining the changes. So instead of discussing all methods of Matrix class again, i will discuss what are the changes and new exclusive Methods again Categorized in a similar fashion.

Apparently some methods when applied to binary matrices will completely change its form and with that transformation or function the binaryMatrix will no longer remain a Binary Matrix . For Example using scaleMatrix() method will scale a binaryMatrix but since it has the potential to change the definition of binary matrix where the "1s" values would be scaled by a certain scalar and hence will be automatically TypeCasted into Traditional Matrix Object. Another way to maintain integrity is through typechecking as a precautionary step in Critical methods and function calls to keep a track on changes and retaining the binary Nature of these matrices intact.

Category 0 : BinaryMatrix DataType

Category 1 : Base Class Methods and Operator Overriding Methods

  Method Description
1. __init__() Initializer constructor method
2. __repr__() Describes/represents the object and returns sensible/expected values.
3. __str__() String value of the Object.
4. __add__() Addition of two binary matrices [operator override].
5. __sub__() Subtraction of two binary matrices [operator override].
6. __lshift__() Left Logical shift on the binary data. [operator override].
7. __rshift__() Right Logical shift on the binary data. [operator override].
8. __and__() Shorthand operator for Boolean AND is implemented [operator override].
9. __or__() Shorthand operator for Boolean OR is implemented[operator override].
10. __xor__() Shorthand operator for Boolean XOR is implemented[operator override].
11. __invert__() Shorthand operator for Boolean NOT(Invert) is implemented[operator override].

These Methods are extensions for adding operator support to custom BinaryMatrix object type. Some of these methods described here override the methods in the super class. Other Category 1 methods not described here are inherited directly.

Category 2 : Matrix Analysis Methods

Other Methods are described in depth in here( Analysis Methods)

  Method Description
1. isBinaryMatrix() This method checks if the Matrix in question is a BinaryMatrix any-more. Returns boolean value.

Category 3 : Intra-Matrix Methods

All Methods are described in depth in here( Intra-Matrix Methods)

Category 4: Inter-Matrix Methods

All Methods are described in depth in here( Inter-Matrix Methods)

Category 5: Matrix Transformations

All Methods are described in depth in here( Matrix Transformations)

Category 6: Statistical Methods

All Methods are described in depth in here( Statistical Methods)

Category 7: Supplementary Methods

All Methods are described in depth in here( Supplementary Methods)

Category 8 : Binary/Boolean Logic Methods

These methods execute boolean logic on the binary matrices especially for 1-bit Emulated ones.

  Method Description
1. And()
2. Or()
3. Not()
4. Nand()
5. Nor()
6. Exor()
7. ExNor()
8. onesComplement()
9. twosComplement()
10. __AndS()
11. __Or()
12. __Not()
13. __Nand()
14. __Nor()
15. __EXNor()
16. __Exor()
17. __forward_one()

Category 9 : Shift Methods

These methods add binary shifts to the matrix as a whole.

  Method Description
1. logicalShift()
2. arithmeticShift()
3. circularShift()
4. popcount()
5. __listifyMatrix()

Last update: December 19, 2020