Skip to main content

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.

>>> 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 (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. Feel free to report bugs or make a pull request through this repository.

License

Distributed under the MIT license. See the LICENSE file for more details.

Metadata

Release files for matrixlib 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for matrixlib 0.3.2
File Size Uploaded
matrixlib-0.3.2.tar.gz 16.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for matrixlib 0.3.2
File Interpreter ABI Platform
matrixlib-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 32.2 kB

Release files / matrixlib-0.3.2.tar.gz

Download URL matrixlib-0.3.2.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1bee1ffd045cd8b63731a007b7a79ebd377877a226cae91ccaad1b22fc94e2d8
BLAKE2b-256 checksum
How to use checksums
07055eaa137efd421035e42179be037976a083a2e37685e21023de35c0fedee7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release files / matrixlib-0.3.2-py3-none-any.whl

Download URL matrixlib-0.3.2-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d556f3898204ca1bdf70f0c9a678ca4df8f5820b396ba2c7c7b55e1f8275418
BLAKE2b-256 checksum
How to use checksums
7c58832bf107193147d0617a4099c7d32235255399ace1a5a243feeca2d75bd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page