Skip to main content

This is a module which can be used for performing matrix operations

Project description


This is a module to replicate matrix object to python and all its mathematical operators


pip install pymatdet


Available methods

  • .rows()
  • .cols()
  • .principal_diagonal()
  • .minor(row,col)
  • .cofactor(row,col)
  • trace()
  • .determinant()
  • .transpose()
  • .adjoint()
  • .inverse([precision])
  • .isutriangle()
  • .isltriangle()
  • nullity()
  • sqareness()

Available operators

  • +
  • -
  • *
  • ==
  • negation
  • bool

NOTE: Index of row and col start from 1

creating a matrix object


allows null,random, ltriangle,utriangle and identity instead of val in object creation.

  • null: creates a null matrix example: x=matrix(3,3,"null")

  • random: creates a random matrix example: x=matrix(3,3,"random")

  • ltriangle: creates a lower triangular matrix example: x=matrix(3,3,"ltriangle")

  • utriangle: creates a upper triangular matrix example: x=matrix(3,3,"utriangle")

  • identity: creates an identity matrix example: x=matrix(3,3,"identity")

NOTE: if you want to create a matrix with specific values, you can use the following syntax: x=matrix(row,col,val) where val is a list of lists with the values of the matrix.and appropriate dimensions.

Accessing elements

Allows value assignment using matrix[row,col]=val returns value at current index using val=matrix[row,col]


returns number of rows in the matrix


returns number of columns in the matrix


returns principal diagonal of the matrix


returns the minor of element at given row,col


returns the cofactor of element at given row,col


returns trace of the matrix


returns determinant of the matrix


returns transpose of the given matrix


returns adjoint of the given matrix


returns inverse of the given matrix.allows precision of calculation. NOTE: precision is optional.if not given,default precision is 10


returns true if the matrix is upper triangular otherwise returns false


returns true if the matrix is lower triangular otherwise returns false


returns true if the matrix is null otherwise returns false


returns true if the matrix is square otherwise returns false

using operators

  • x+y returns addition of 2 matrix x and y

  • x-y returns subtraction of 2 matrix x and y

  • x*y returns multiplication of 2 matrix x and y

  • x/y raises exception operator not available

  • x==y returns true if x and y are equal

  • -x returns negative of matrix x

  • bool(x) returns true if x is not null

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

pymatdet-1.0.4.tar.gz (4.6 kB view hashes)

Uploaded source

Built Distribution

pymatdet-1.0.4-py3-none-any.whl (4.9 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page