# 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:
```ps
pip install nullity
```
To start using, simply import the package in your Python file:
```py
from nullity import Matrix
```
## Usage
**Instantiation**
```py
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:
```py
>>> 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/mihiraggarwal/nullity",
"name": "nullity",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "linear, algebra, linear algebra, linalg, lin-alg, linearalgebra, eigen, eigenvalue, eigenvector, nullity, null, null space, rank nullity",
"author": "Mihir Aggarwal",
"author_email": "mail@mihiraggarwal.me",
"download_url": "https://files.pythonhosted.org/packages/21/ac/8df1cec51f943d900c008b1b887cf528161c414218f0f3644d4c737fdf8d/nullity-0.0.5.tar.gz",
"platform": null,
"description": "# nullity\n\nA Python package for all things linear algebra, built in vanilla python3 \nBuilt during MAT-1001 / Linear Algebra at Ashoka University.\n\n## Installation\n\nThe package is available on PyPI:\n\n```ps\npip install nullity\n```\n\nTo start using, simply import the package in your Python file:\n\n```py\nfrom nullity import Matrix\n```\n\n## Usage\n\n**Instantiation** \n\n```py\nm = Matrix(m, n, *args)\n```\n\nThe 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. \n\nThese values are arranged first in rows and then in columns. \nFor example:\n\n```py\n>>> m = Matrix(2, 3, 1, 2, 3, 4, 5, 6)\n>>> print(m)\n\n 1.00 2.00 3.00\n 4.00 5.00 6.00\n\n```\n\n**Methods** \n\n| Function | Output |\n| --- | --- |\n| `nrows` | Number of rows |\n| `ncolumns` | Number of columns |\n| `is_square` | Whether the matrix is square |\n| `rref` | RREF of the matrix |\n| `rank` | Rank of the matrix |\n| `nullity` | Nullity (dimension of the null space) of the matrix |\n| `is_invertible` | Whether the matrix is invertible |\n| `inverse` | Inverse of the invertible matrix |\n| `rank_factorization` | The two rank factorized matrices `r` and `c` |\n| `row_basis` | Basis of the row space |\n| `col_basis` | Basis of the column space |\n| `null_basis` | Basis of the null space |\n| `transpose` | Transpose of the matrix |\n| `plu` | PLU decomposed matrices `p`, `l`, and `u` |\n| `det` | Determinant of a square matrix |\n| `qr` | QR decomposed matrices `q` and `r` |\n| `charpol` | Characteristic polynomial of the matrix |\n| `eigenvals` | Eigenvalues of the matrix (from numpy) |\n| `eigenvecs` | Eigenvectors corresponding to the respective eigenvalues |\n| `svd` | Singular value decomposed matrices `u`, `sigma`, and `v_transpose` |\n\nAlong with these, addition and multiplication of 2 matrices is also supprted using the inbuilt operators `+` and `*` respectively.\n\n## Issues\n\nPython's decimal arithmetic often results in incorrect answers. In some cases, approximated output might be sufficient, however in others, errors may be raised.\n",
"bugtrack_url": null,
"license": null,
"summary": "A package for all things linear algebra",
"version": "0.0.5",
"project_urls": {
"Homepage": "https://github.com/mihiraggarwal/nullity"
},
"split_keywords": [
"linear",
" algebra",
" linear algebra",
" linalg",
" lin-alg",
" linearalgebra",
" eigen",
" eigenvalue",
" eigenvector",
" nullity",
" null",
" null space",
" rank nullity"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5a83a4ed5659b7e56137518083030bb529f84c759d69cc22ae4c79b3b4de6431",
"md5": "950aea125027da9992440e291c2fa75c",
"sha256": "1cbb774b082b879e0b4fde377f289c8b097363acca2dbdf7cff333ed99e6cd21"
},
"downloads": -1,
"filename": "nullity-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "950aea125027da9992440e291c2fa75c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 18222,
"upload_time": "2024-05-16T08:40:37",
"upload_time_iso_8601": "2024-05-16T08:40:37.372856Z",
"url": "https://files.pythonhosted.org/packages/5a/83/a4ed5659b7e56137518083030bb529f84c759d69cc22ae4c79b3b4de6431/nullity-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "21ac8df1cec51f943d900c008b1b887cf528161c414218f0f3644d4c737fdf8d",
"md5": "dab2191a3ed728a9b067ec60e1ecb398",
"sha256": "be016e8f7b041b3b9813608db5d1ef2af2d0c1577e85bcf66e7696f8e54953c2"
},
"downloads": -1,
"filename": "nullity-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "dab2191a3ed728a9b067ec60e1ecb398",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 18359,
"upload_time": "2024-05-16T08:40:39",
"upload_time_iso_8601": "2024-05-16T08:40:39.153307Z",
"url": "https://files.pythonhosted.org/packages/21/ac/8df1cec51f943d900c008b1b887cf528161c414218f0f3644d4c737fdf8d/nullity-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-16 08:40:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mihiraggarwal",
"github_project": "nullity",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nullity"
}