Metadata-Version: 2.4
Name: linearean
Version: 0.1.1
Summary: A pure-Python linear algebra package with matrices, vectors, and manual numerical algorithms.
Author: tki
License: MIT License
        
        Copyright (c) 2026
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Dynamic: license-file

# linearean

A small linear algebra package written from scratch in pure Python. It provides
matrix and vector data structures, manual Gaussian-elimination based routines,
power iteration, and extensions for complex-valued linear algebra, tensor
products, and Markov-chain checks.

The package intentionally avoids high-level numerical libraries so the core
algorithms are easy to read and study.

## Features

- `Matrix` and `Vector` classes with dimension validation.
- Operator overloading for `+`, `-`, scalar `*`, and matrix multiplication with
  `@`.
- Determinants and inverses using manual Gaussian elimination / Gauss-Jordan
  elimination with partial pivoting.
- Linear solves, rank, reduced row echelon form, trace, transpose, and norms.
- Power iteration for the dominant eigenvalue and eigenvector.
- Complex conjugate transpose, Hermitian/unitary checks, Kronecker products,
  tensor powers, and stochastic-matrix validation.

## Quick start

```python
from linearean import Matrix, Vector, power_iteration
from linearean.extensions import kronecker_product, is_stochastic

A = Matrix([[2, 1], [5, 3]])
B = Matrix([[1, 0], [0, 1]])
v = Vector([1, 2])

print(A + B)
print(A @ v)
print(A.determinant())
print(A.inverse())

eigenvalue, eigenvector = power_iteration(A)
print(eigenvalue, eigenvector)

coin = Matrix([[0.5, 0.5], [0.5, 0.5]])
print(is_stochastic(coin))

system = kronecker_product(B, B)
print(system)
```

## Development

Run tests with:

```bash
python -m unittest discover
```

Install locally in editable mode with:

```bash
python -m pip install -e .
```
