this is package for matrix calculations, in this package there are mainly 2 modules,
calculate: contains the functions for calculationsinterface: contains helpers and other functions to i/o matrices
- addition (any amount of matrices)
- substraction (any amount of matrices)
- multiplication (2 matrices)
- Python >=3.10
- install by using
pip install mxcalc - if ur just using to get results rather than use the functions u can just use
mxcalcmodule itself, an interface made using the functions will be at ur service
- when you run the module, it will first ask you for a operation, select the operation you wish to perform
- then you can provide the information the systems ask about the matrices, the you will get your result at the end
mxcalc - if u want some of the helper functions (to display matrix,get matrix data), u can use the
interfacemodule, example show bellow
from mxcalc import interface
interface.displayMatrix(
[[1],
[0]]
)- if u want to use the function to input matrices in code and get direct resulting output, u can use the
calculatemodule. simple example given bellow.
from mxcalc import calculate
calculate.matrixMultiplication([
[[1,0]],
[[1],
[2]]
])All the available functions are mentioned down below in the master table
| Function | Parameters | Description | Returns |
|---|---|---|---|
| matrixAddSub | matrices (list), oprt (str) | Adds or subtracts an array of matrices based on the operator provided (+ or -). | The resulting matrix (list of lists). |
| matrixMultiplication | matrices (list) | Multiplies two matrices after checking if their dimensions are compatible. | The product matrix, or -1 if dimensions are invalid. |
| Function | Parameters | Description | Returns |
|---|---|---|---|
| getRowsAndColumns | num (int) | Prompts user for matrix dimensions with input validation. | [rows, cols] or -1 on error. |
| getMatrix | rows (int), columns (int) | Collects individual integer values from the user for a specific matrix size. | A 2D list (matrix) or -1. |
| displayMatrix | matrix (list), isFinal (bool) | Prints a matrix to the console, optionally adding a "Final Matrix" header. | None |
| matrixMultiplicationHelper | matrices (list), i (int) | Manages the UI flow for collecting and multiplying two matrices. | None (displays result). |
| matrixAddSubHelper | matrices (list), oprt (str), i (int) | Manages the UI flow for adding/subtracting multiple matrices of the same size. | None (displays result). |
currently you can only use this by running main.py and using the helper interfaces provided by that, i feel like making it a package would give it a much better range
(inspired by githubs workflow suggestions)
this operations are wayy too common. for example i want to add,
- transpose
- invertion(obviously)
- rotation and maybe flipping ? idk, we'll see
right now only additions and substraction has unlimited amount of matrices support, idk if this is even possible but if we can do this it'll be fun