nullity
A Python package for all things linear algebra, built in vanilla python3
Built during MAT-1001 / Linear Algebra at Ashoka University.
Installation
The package is available on PyPI:
pip install nullity
To start using, simply import the package in your Python file:
from nullity import Matrix
Usage
Instantiation
m = Matrix(m, n, *args)
The matrix must be instantiated by first passing in the number of rows (m), then the number of columns (n), and finally the m*n values of the matrix separated by commas.
These values are arranged first in rows and then in columns.
For example:
>>> m = Matrix(2, 3, 1, 2, 3, 4, 5, 6)
>>> print(m)
1.00 2.00 3.00
4.00 5.00 6.00
Methods
| Function | Output |
|---|---|
nrows |
Number of rows |
ncolumns |
Number of columns |
is_square |
Whether the matrix is square |
rref |
RREF of the matrix |
rank |
Rank of the matrix |
nullity |
Nullity (dimension of the null space) of the matrix |
is_invertible |
Whether the matrix is invertible |
inverse |
Inverse of the invertible matrix |
rank_factorization |
The two rank factorized matrices r and c |
row_basis |
Basis of the row space |
col_basis |
Basis of the column space |
null_basis |
Basis of the null space |
transpose |
Transpose of the matrix |
plu |
PLU decomposed matrices p, l, and u |
det |
Determinant of a square matrix |
qr |
QR decomposed matrices q and r |
charpol |
Characteristic polynomial of the matrix |
eigenvals |
Eigenvalues of the matrix (from numpy) |
eigenvecs |
Eigenvectors corresponding to the respective eigenvalues |
svd |
Singular value decomposed matrices u, sigma, and v_transpose |
Along with these, addition and multiplication of 2 matrices is also supprted using the inbuilt operators + and * respectively.
Issues
Python's decimal arithmetic often results in incorrect answers. In some cases, approximated output might be sufficient, however in others, errors may be raised.
Release files for nullity 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nullity-0.0.5.tar.gz | 18.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nullity-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.6 kB
Release files / nullity-0.0.5.tar.gz
| Download URL | nullity-0.0.5.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be016e8f7b041b3b9813608db5d1ef2af2d0c1577e85bcf66e7696f8e54953c2
|
|
BLAKE2b-256 checksum How to use checksums |
21ac8df1cec51f943d900c008b1b887cf528161c414218f0f3644d4c737fdf8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Release files / nullity-0.0.5-py3-none-any.whl
| Download URL | nullity-0.0.5-py3-none-any.whl |
|---|---|
| Size | 18.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1cbb774b082b879e0b4fde377f289c8b097363acca2dbdf7cff333ed99e6cd21
|
|
BLAKE2b-256 checksum How to use checksums |
5a83a4ed5659b7e56137518083030bb529f84c759d69cc22ae4c79b3b4de6431
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|