Operations with matrices.
Project description
Simple module to work with matrices. Division between matrices isn't supported yet.
Important: this package is not maintained anymore.
Examples:
>>> from easymatrix import Matrix
# Create a 2x3 matrix.
>>> a = Matrix([
... [1, 5, 0],
... [2, 0, 3]
... ])
# Output is automatically created to be human-readable.
>>> a
1 5 0
2 0 3
# Define another to operate with.
>>> b = Matrix([
... [-3, -5, 7],
... [0, 9, 1]
... ])
# Arithmetic operations.
>>> c = a + b
>>> c
-2 0 7
2 9 4
>>> d = a - b
>>> d
4 10 -7
2 -9 2
# Multiplication: matrix * matrix.
>>> e = d * c
Traceback (most recent call last):
ValueError: Expected ?x3 and 2x? matrices.
>>> f = Matrix([
... [1, 0],
... [3, -2],
... [0, 5]
... ])
>>> g = d * f
>>> print(g)
34 -55
-25 28
# Matrix * number.
>>> g*2
68 -110
-50 56
# Power.
>>> g**2
2531 -3410
-1550 2159
# Division: matrix / number.
>>> g/10.
3.4 -5.5
-2.5 2.8
Important: this package is not maintained anymore.
Examples:
>>> from easymatrix import Matrix
# Create a 2x3 matrix.
>>> a = Matrix([
... [1, 5, 0],
... [2, 0, 3]
... ])
# Output is automatically created to be human-readable.
>>> a
1 5 0
2 0 3
# Define another to operate with.
>>> b = Matrix([
... [-3, -5, 7],
... [0, 9, 1]
... ])
# Arithmetic operations.
>>> c = a + b
>>> c
-2 0 7
2 9 4
>>> d = a - b
>>> d
4 10 -7
2 -9 2
# Multiplication: matrix * matrix.
>>> e = d * c
Traceback (most recent call last):
ValueError: Expected ?x3 and 2x? matrices.
>>> f = Matrix([
... [1, 0],
... [3, -2],
... [0, 5]
... ])
>>> g = d * f
>>> print(g)
34 -55
-25 28
# Matrix * number.
>>> g*2
68 -110
-50 56
# Power.
>>> g**2
2531 -3410
-1550 2159
# Division: matrix / number.
>>> g/10.
3.4 -5.5
-2.5 2.8
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
easymatrix-1.0.0a1.zip
(4.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file easymatrix-1.0.0a1.zip.
File metadata
- Download URL: easymatrix-1.0.0a1.zip
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b603ae8136cc4f46f09594405d741bc50b5724c3599b76e8ec483d9d0aff209e
|
|
| MD5 |
60731301dcd3cae9130e7d285c61937c
|
|
| BLAKE2b-256 |
70099dec1e230945acf5d6da092b0196590b973e9e7408311e8432be28300950
|
File details
Details for the file easymatrix-1.0.0a1-py2.py3-none-any.whl.
File metadata
- Download URL: easymatrix-1.0.0a1-py2.py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f242cc5edaae1715375db79bc334dad0c52389422f9acb17ffb7b9e64f7c6217
|
|
| MD5 |
2f953440d75f68c66cf904b06e807579
|
|
| BLAKE2b-256 |
f48bb3c0946246d9e8d5c84e38092b333fd592d4415fbd272a5a420311848bb4
|