Matrix types for Python
The matrix-types package implements simple and intuitive matrix data types for
Python. Matrixes are often required to implement various algorithms or store
and process two-dimensional data arrays. While this can be (and often is)
achieved with built-in data types, such as lists of lists or tuples of tuples,
these approaches frequently require a programmatic approach that is aware of
the internal structure of the data, and because of the arbitrary lengths of
types such as list
and tuple
they offer little in the way
of assurances that their internal structure is (and remains) consistent.
The Matrix
and FrozenMatrix
types in the matrix-types package
implement mutable and immutable matrix data types with an interface modelled
closely on Python’s built-in data types, such as list
,
tuple
, and dict
– if you know how to use these you
probably already know how to use Matrix
and FrozenMatrix
!
The matrix types implemented here are also fully type annotated and support
generic types, meaning you can use static type checkers such as mypy to
avoid or spot potential issues in your code before they become a problem.
Indices and tables
\(\begin{bmatrix}\textup{m} & \textup{a} & \textup{t} & \textup{r}\\\textup{i} & \textup{c} & \textup{e} & \textup{s}\end{bmatrix}\)