Skip to content

levvedrov/matrix-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

MatrixLab

A lightweight Python matrix library with basic linear algebra operations, including Gaussian elimination, addition, subtraction, matrix and constant multiplication, and transposition.

Features

  • Matrix addition and subtraction
  • Matrix multiplication
  • Scalar multiplication
  • Transposition
  • Gaussian elimination for solving systems of linear equations (Ax = b)
  • Pretty matrix display (.show() method)

Requirements

  • Python 3.6+

No external dependencies required.

Usage

Import, create and operate matrices

from matrix import Matrix

A = Matrix([[1, 2], [3, 4]])
B = Matrix([[5, 6], [7, 8]])
C = A + B           # Matrix addition
D = A @ B           # Matrix multiplication
E = A * 3           # Scalar multiplication
A.transpose()       # In-place transpose, returns class matrix
A.show()            # Nicely print the matrix
A.solveGauss()      # Returns the roots for the matrix