matrixlib


Namematrixlib JSON
Version 0.3.2 PyPI version JSON
download
home_page
SummaryGeneral-purpose matrices for the layman
upload_time2023-04-03 01:16:35
maintainer
docs_urlNone
authorBraedyn L
requires_python>=3.9
licenseMIT License
keywords matrices matrix vectors vector vectorization sequences
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MatrixLib

General-purpose matrices for the layman.

Implements a family of general-purpose matrix types, with comprehensive type-checking capabilities, and seamless integration with core Python services.

```python
>>> from collections.abc import Iterable
>>> from math import fsum, sqrt, isclose
>>> from typing import Literal as L
>>>
>>> from matrixlib import ROW, RealMatrix, IntegerMatrix
>>>
>>> def norm(a: Iterable[float]) -> float:
...     return sqrt(fsum(map(lambda x: x * x, a)))
...
>>> a = IntegerMatrix[L[3], L[3], int](
...     (
...         1, 2, 3,
...         4, 5, 6,
...         7, 8, 9,
...     ),
...     shape=(3, 3),
... )
>>>
>>> b = RealMatrix[L[3], L[3], float](
...     (
...         val
...         for row in a.slices(by=ROW)
...         for val in row / norm(row)
...     ),
...     shape=a.shape,
... )
>>>
>>> print(b)
| 0.26726… 0.53452… 0.80178… |
| 0.45584… 0.56980… 0.68376… |
| 0.50257… 0.57436… 0.64616… |
(3 × 3)
>>>
>>> assert all(isclose(norm(row), 1) for row in b.slices(by=ROW))
```

## Getting Started

This project is available through [pip](https://pip.pypa.io/en/stable/) (requires Python 3.9 or later, 3.11 recommended):

```
pip install matrixlib
```

**Warning**:  MatrixLib is currently in its infancy, and may see future changes that are not always backwards compatible.

The current iteration of this library is in **beta**. Further testing is being conducted at the moment.

## Contributing

This project is currently maintained by [Braedyn L](https://github.com/braedynl). Feel free to report bugs or make a pull request through this repository.

## License

Distributed under the MIT license. See the [LICENSE](LICENSE) file for more details.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "matrixlib",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "matrices,matrix,vectors,vector,vectorization,sequences",
    "author": "Braedyn L",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/07/05/5eaa137efd421035e42179be037976a083a2e37685e21023de35c0fedee7/matrixlib-0.3.2.tar.gz",
    "platform": null,
    "description": "# MatrixLib\r\n\r\nGeneral-purpose matrices for the layman.\r\n\r\nImplements a family of general-purpose matrix types, with comprehensive type-checking capabilities, and seamless integration with core Python services.\r\n\r\n```python\r\n>>> from collections.abc import Iterable\r\n>>> from math import fsum, sqrt, isclose\r\n>>> from typing import Literal as L\r\n>>>\r\n>>> from matrixlib import ROW, RealMatrix, IntegerMatrix\r\n>>>\r\n>>> def norm(a: Iterable[float]) -> float:\r\n...     return sqrt(fsum(map(lambda x: x * x, a)))\r\n...\r\n>>> a = IntegerMatrix[L[3], L[3], int](\r\n...     (\r\n...         1, 2, 3,\r\n...         4, 5, 6,\r\n...         7, 8, 9,\r\n...     ),\r\n...     shape=(3, 3),\r\n... )\r\n>>>\r\n>>> b = RealMatrix[L[3], L[3], float](\r\n...     (\r\n...         val\r\n...         for row in a.slices(by=ROW)\r\n...         for val in row / norm(row)\r\n...     ),\r\n...     shape=a.shape,\r\n... )\r\n>>>\r\n>>> print(b)\r\n| 0.26726\u2026 0.53452\u2026 0.80178\u2026 |\r\n| 0.45584\u2026 0.56980\u2026 0.68376\u2026 |\r\n| 0.50257\u2026 0.57436\u2026 0.64616\u2026 |\r\n(3 \u00d7 3)\r\n>>>\r\n>>> assert all(isclose(norm(row), 1) for row in b.slices(by=ROW))\r\n```\r\n\r\n## Getting Started\r\n\r\nThis project is available through [pip](https://pip.pypa.io/en/stable/) (requires Python 3.9 or later, 3.11 recommended):\r\n\r\n```\r\npip install matrixlib\r\n```\r\n\r\n**Warning**:  MatrixLib is currently in its infancy, and may see future changes that are not always backwards compatible.\r\n\r\nThe current iteration of this library is in **beta**. Further testing is being conducted at the moment.\r\n\r\n## Contributing\r\n\r\nThis project is currently maintained by [Braedyn L](https://github.com/braedynl). Feel free to report bugs or make a pull request through this repository.\r\n\r\n## License\r\n\r\nDistributed under the MIT license. See the [LICENSE](LICENSE) file for more details.\r\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "General-purpose matrices for the layman",
    "version": "0.3.2",
    "split_keywords": [
        "matrices",
        "matrix",
        "vectors",
        "vector",
        "vectorization",
        "sequences"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7c58832bf107193147d0617a4099c7d32235255399ace1a5a243feeca2d75bd1",
                "md5": "c63267d56c2213dd4c30fde90fdc949b",
                "sha256": "4d556f3898204ca1bdf70f0c9a678ca4df8f5820b396ba2c7c7b55e1f8275418"
            },
            "downloads": -1,
            "filename": "matrixlib-0.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c63267d56c2213dd4c30fde90fdc949b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 16170,
            "upload_time": "2023-04-03T01:16:33",
            "upload_time_iso_8601": "2023-04-03T01:16:33.385730Z",
            "url": "https://files.pythonhosted.org/packages/7c/58/832bf107193147d0617a4099c7d32235255399ace1a5a243feeca2d75bd1/matrixlib-0.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "07055eaa137efd421035e42179be037976a083a2e37685e21023de35c0fedee7",
                "md5": "64f13dd33507c0cc20d3ebaf6107b14a",
                "sha256": "1bee1ffd045cd8b63731a007b7a79ebd377877a226cae91ccaad1b22fc94e2d8"
            },
            "downloads": -1,
            "filename": "matrixlib-0.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "64f13dd33507c0cc20d3ebaf6107b14a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 15999,
            "upload_time": "2023-04-03T01:16:35",
            "upload_time_iso_8601": "2023-04-03T01:16:35.442429Z",
            "url": "https://files.pythonhosted.org/packages/07/05/5eaa137efd421035e42179be037976a083a2e37685e21023de35c0fedee7/matrixlib-0.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-03 01:16:35",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "matrixlib"
}
        
Elapsed time: 0.06625s