Skip to content

Base Class Methods

pyrix.matrix.Matrix.__init__() (Constructor)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def     __init__(self,nrow=1,ncol=1,data=[1]):
        ....

details

parameters:

  • nrow (int): number of rows for the matrix object
  • ncol (int): number of columns for the matrix object
  • data (nested-list): The data stored in the nested list structure

Returns:

  • return : A Matrix Object is returned

Dimensions of the data should match the nrow,ncol values

If this condition is not fulfilled the matrix raises an incompaitableTypeException

pyrix.matrix.Matrix.__repr__()

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __repr__(self):
        ....

details

Returns:

  • return : A String is returned

pyrix.matrix.Matrix.__str__() (str())

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __str__(self):
        ....

details

Every Time print method is called upon the matrix object this method is triggered. This method enables the Module to create a unique object print style.

Returns:

  • return : A String is returned

pyrix.matrix.Matrix.__add__() ('+' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __add__(self,matrix2):
        ....

details

parameters:

  • matrix2 (Matrix Object): the second operand matrix

Returns:

  • return : A new Matrix Object is returned

Dimensions of both these matrices should match

If this condition is not fulfilled the matrix raises an incompaitableTypeException

pyrix.matrix.Matrix.__sub__() ('-' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __sub__(self,matrix2):
        ....

details

parameters:

  • matrix2 (Matrix Object): the second operand matrix

Returns:

  • return : A new Matrix Object is returned

Dimensions of both these matrices should match

If this condition is not fulfilled the matrix raises an incompaitableTypeException

pyrix.matrix.Matrix.__mul__() ('*' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __mul__(self,matrix2):
        ....

details

parameters:

  • matrix2 (Matrix Object): the second operand matrix

Returns:

  • return : A new Matrix Object is returned

The matrix1.nrow should equal matrix2.ncol for multiplication operation

If this condition is not fulfilled the matrix raises an incompaitableTypeException

pyrix.matrix.Matrix.__truediv__() ('/' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __truediv__(self,matrix2):
        ....

details

parameters:

  • matrix2 (Matrix Object): the second operand matrix

Returns:

  • return : An divisionErrorException is Raised

pyrix.matrix.Matrix.__floordiv__() ('//' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __floordiv__(self,matrix2):
        ....

details

parameters:

  • matrix2 (Matrix Object): the second operand matrix

Returns:

  • return : An divisionErrorException is Raised

pyrix.matrix.Matrix.__pow__() ('**' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __pow__(self,times):
        ....

details

parameters:

  • times(int): The power value

Returns:

  • return : The same Matrix Object is returned

The matrix should be a square Matrix by nature

If this condition is not fulfilled the matrix raises anincompaitableTypeException

self.isSquareMatrix() method is accessed to verify the nature

Refer pyrix.matrix.Matrix.isSquareMatrix()

pyrix.matrix.Matrix.__abs__() (abs())

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __abs__(self):
        ....

details

Returns:

  • return : The determinant value is returned (float/int)

The matrix should be a square Matrix by nature

If this condition is not fulfilled the matrix raises anincompaitableTypeException

self.isSquareMatrix() method is accessed to verify the nature

Refer pyrix.matrix.Matrix.isSquareMatrix()

self.determinantValue()method is accessed to return the determinant value

Refer pyrix.matrix.Matrix.determinantValue()

pyrix.matrix.Matrix.__mod__() ('%' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __mod__(self,matrix2):
        ....

details

parameters:

  • matrix2 (Matrix Object): the second operand matrix

Returns:

  • return : An divisionErrorException is Raised

pyrix.matrix.Matrix.__lshift__() ('>>' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __lshift__(self,number):
        ....

Returns:

  • return : An bitWiseOnMatrix Exception is Raised

pyrix.matrix.Matrix.__rshift__() ('<<' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __rshift__(self,number):
        ....

details

Returns:

  • return : An bitWiseOnMatrix Exception is Raised

pyrix.matrix.Matrix.__and__() ('&' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __and__(self,Matrix2):
        ....

details

parameters:

  • matrix2 (Matrix Object): the second operand matrix

Returns:

  • return : An bitWiseOnMatrix Exception is Raised

pyrix.matrix.Matrix.__or__() ('|' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __or__(self,Matrix2):
        ....

details

parameters:

  • matrix2 (Matrix Object): the second operand matrix

Returns:

  • return : An bitWiseOnMatrix Exception is Raised

pyrix.matrix.Matrix.__xor__() ('^' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __xor__(self,Matrix2):
        ....

details

parameters:

  • matrix2 (Matrix Object): the second operand matrix

Returns:

  • return : An bitWiseOnMatrix Exception is Raised

pyrix.matrix.Matrix.__invert__() ('~' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __invert__(self):
        ....

details

Returns:

  • return : An bitWiseOnMatrix Exception is Raised

pyrix.matrix.Matrix.__eq__() ('==' operator)

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __eq__(self,Matrix2):
        ....

details

parameters:

  • matrix2 (Matrix Object): the second operand matrix

Returns:

  • return : A Boolean Value is returned based on the equality of indivisual values

pyrix.matrix.Matrix.__trunc__() (trunc())

Description

The trunc function behaves as a ceiling function for negative number and floor function for positive number.

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __trunc__(self):
        ....

details

Returns:

  • return : Returns a Matrix Object with Truncated Values.

pyrix.matrix.Matrix.__floor__() (floor())

Description

The floor function floors the value for a float numbers in the matrix.

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __floor__(self):
        ....

details

Returns:

  • return : Returns a Matrix Object with Floored Values.

pyrix.matrix.Matrix.__ceil__() (ceil())

Description

The ceil function ceils the value for a float numbers in the matrix.

Abstract Code Description

1
2
3
4
class Matrix:
    ::
    def __ceil__(self):
        ....

details

Returns:

  • return : Returns a Matrix Object with Ceil limited Values.

Last update: December 31, 2020