Skip to main content

A Python package for Matrix Operations

Project description

pymatops - A Python package for Matrix Operations

Package Details

The pymatops package is available on the official Python Package Index (PyPi) repository. It can be installed and used in your projects pip install pymatops.

Package Operations

1. visualize - visualize a matrix

import pymatops as pmo
mat = [[1,2,3], [4,5,6], [7,8,9]]
pmo.visualize(mat)

image

2. dim - returns a tuple with the dimensions of the matrix

import pymatops as pmo
mat = [[1,2,3], [4,5,6], [7,8,9]]
print("The dimension of the matrix is ", pmo.dim(mat))

image

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()

image

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)

image

5. matSum - returns the sum of all elements in the matrix passed

import pymatops as pmo
print("The random matrix generated: ")
mat = pmo.randomMatrixDim(6,8) # retuns a 6*8 matrix with random values
print("The sum of the matrix: ", pmo.matSum(mat))

image

6. matAdd - returns the resultant matrix of the sum of matrix A and B

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)

image

7. matMul - returns the resultant matrix of the multiplication of matrix A and B

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)

image

8. scalarMul - returns the resultant matrix of the multiplication of matrix A with scalar c

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)

image

9. transpose - returns transpose of matrix

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)

image

10. zeroElements - returns the number of zero elements 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 zeros in the matrix: ", end = " ")
print(pmo.zeroElements(mat))

image

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])

image

Developed by Yash Seth (c) 2022

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymatops-1.0.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymatops-1.0.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file pymatops-1.0.0.tar.gz.

File metadata

  • Download URL: pymatops-1.0.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.2

File hashes

Hashes for pymatops-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b839edb543914f9c905aec40ad0f6ad0961b248922f550966c9e70771140a5b6
MD5 a67cec3af0258e0838844ab96e62aedd
BLAKE2b-256 75cfa68ce8e018aee4bd961e98a322884144eb03045f8b1c472907a3831e477b

See more details on using hashes here.

File details

Details for the file pymatops-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pymatops-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.2

File hashes

Hashes for pymatops-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e962eda9bfa4b1a83fe78b06d2334b982ce4f61914d9f7f473cc4d363e4cdd4d
MD5 be3e9dbfa084c27c9e9aeb5d3af3463a
BLAKE2b-256 68f4bce6dc8306d1b8164f5e9c8d058a94ef2bc2d68a0045683548af4777c9c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page