The pymatops package is available on the official Python Package Index (PyPi) repository.
It can be installed and used in your projects by running the following command using pip
pip install pymatopsimport pymatops as pmo
mat = [[1,2,3], [4,5,6], [7,8,9]]
pmo.visualize(mat)import pymatops as pmo
mat = [[1,2,3], [4,5,6], [7,8,9]]
print("The dimension of the matrix is ", pmo.dim(mat))3. randomMatrix - returns a matrix of random dimensions with random values if the function is called with no arguments
import pymatops as pmo
print("The randomly generated matrix: ")
pmo.randomMatrix()4. randomMatrix - you can pass dimensions to get a matrix of specified dimensions with random values. Both row and col dimensions are required
import pymatops as pmo
print("The random matrix of dimension 6*8 generated: ")
pmo.randomMatrix(6,8)import pymatops as pmo
print("The random matrix generated: ")
mat = pmo.randomMatrix(6,8) # retuns a 6*8 matrix with random values
print("The sum of the matrix: ", pmo.matSum(mat))import pymatops as pmo
mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
mat1 =[[1, 2, 3], [4, 5, 6], [7, 8, 9]] # returns a 6*8 matrix with random values
print("Matrix 1:")
pmo.visualize(mat)
print("Matrix 2:")
pmo.visualize(mat1)
print("The resultant matrix of the matrix addition operation: ")
pmo.matAdd(mat, mat1)import pymatops as pmo
mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] # matrix of dimensions 4*3
mat1 =[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]] # matrix of dimensions 3*4
print("Matrix 1:")
pmo.visualize(mat)
print("Matrix 2:")
pmo.visualize(mat1)
print("The resultant matrix of the matrix multiplication operation: ")
pmo.matMul(mat, mat1)import pymatops as pmo
mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print("Original Matrix: ")
pmo.visualize(mat)
print("Matrix after scalar multiplication operation: ")
pmo.scalarMul(mat, 3)import pymatops as pmo
mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
print("Original Matrix: ")
pmo.visualize(mat)
print("Matrix after transpose operation: ")
pmo.transpose(mat)import pymatops as pmo
mat = [[1, 0, 3], [0, 5, 6], [7, 8, 0], [10, 11, 12]]
print("Original Matrix: ")
pmo.visualize(mat)
print("Number of zeros in the matrix: ", end = " ")
print(pmo.zeroElements(mat))11. evenCheck - returns a tuple with the first element as the number of even numbers in the matrix and the second element being the number of odd numbers in the matrix
import pymatops as pmo
mat = [[1, 0, 3], [0, 5, 6], [7, 8, 0], [10, 11, 12]]
print("Original Matrix: ")
pmo.visualize(mat)
print("Number of even numbers in the matrix: ", end = " ")
print(pmo.evenCheck(mat)[0])
print("Number of odd numbers in the matrix: ", end = " ")
print(pmo.evenCheck(mat)[1])
Developed by Yash Seth (c) 2022










