A python package that retrieves matrix dimensions, their trace, and performs matrix addition, subtraction, multiplication.
Project description
py-Matrix-123
Installation
To install with pip, run: pip install py-Matrix-123
Basic Usage
You can retrieve matrix dimensions, their trace, and performs matrix addition, subtraction, multiplication and scalar multiplication.
requirements: python3
Here's an example for regular matrices
from pymatrix123 import Matrix
matrices = [
([[1], [3], [4], [5]],
[[1], [0], [2], [5]]),
([[1, 2], [3, -1], [4, 0.0], [5, -18]],
[1, 0, 2, 5]),
([1.1, 3, 4, 5],
[1, 0, -2.0, -5])
]
if __name__ == '__main__':
for A, B in matrices:
matrixA = Matrix(A)
matrixA.trace()
matrixA.get_dim()
matrixB = Matrix(B)
matrixB.trace()
matrixB.get_dim()
from pymatrix123 import Matrix
matrices = [
([[1], [3], [4], [5]],
[[1], [0], [2], [5]]),
([[1, 2], [3, -1], [4, 0.0], [5, -18]],
[1, 0, 2, 5]),
([1.1, 3, 4, 5],
[1, 0, -2.0, -5])
]
if __name__ == '__main__':
for A, B in matrices:
matrixA = Matrix(A)
matrixB = Matrix(B)
sum_up = matrixA + matrixB
Here's an example for square matrices
from pymatrix123 import SquareMatrix
square = [
([[1, 2], [3, 4]],
[[4, 3], [2, 1]],
[[1*4 + 2*2, 1*3 + 2*1], [3*4 + 4*2, 4*1+3*3]]),
([[1, 2, 0],
[3, 4, -1.0],
[2, 4, 0]],
[[4, 3, -1],
[2, 1, 2.0],
[0, 15, -1.1]],
[[1*4+2*2+0*0, 1*3+2*1+0*15, 1*(-1)+2*2.0+0*(-1.1)],
[3*4+4*2+(-1.0)*0, 4*1+3*3+(-1.0)*15, 3*(-1)+4*2.0+(-1.0)*(-1.1)],
[2*4+4*2+0*0, 2*3+4*1+0*15, 2*(-1)+(2.0)*4+0*(-1.1)]]),
]
if __name__ == '__main__':
for A, B, solution in square:
matrixA = SquareMatrix(A)
matrixB = SquareMatrix(B)
mul = matrixA * matrixB
Reference
Setup | Command | Notes |
---|---|---|
install | pip install pymatrix123 |
Creating a CLI | Command | Notes |
---|---|---|
import | import pymatrix123 |
|
Call | Matrix(A) |
Turns the current list into a matrix object. |
Call | SquareMatrix(B) |
Turns the current list into a matrix object. |
License
Licensed under the The Python Packaging Authority License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-Matrix-123-0.0.2.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for py_Matrix_123-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3e5ace2602044deacf640d25e6ae855a1cd9726b5d443681c53b58841ee0a8e |
|
MD5 | 6182d14cf8addf22d219c38316c77ac0 |
|
BLAKE2b-256 | 7a03b44bb87d051c9055b7f69fa104ea8b9a70848d0930bc8b23df9b4b0f2d34 |