Metadata-Version: 2.4
Name: linalgkit-lab2
Version: 1.0.0
Summary: Linear-algebra toolkit: vector/matrix-space axioms, subspace checks, basis, norm, dimension, rank-nullity.
Author: manohar100323
License: MIT
Project-URL: Source Code, https://github.com/manohar100323/linalgkit-lab2
Keywords: linear algebra,vector space,matrix space,subspace,basis,rank-nullity,norm
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.21
Dynamic: license-file

# linalgkit-lab2

A clean, well-tested Python library for verifying fundamental linear-algebra
properties — vector-space axioms, subspace conditions, basis extraction, norms,
dimension, and the rank–nullity theorem.

---

## Installation

```bash
pip install linalgkit-lab2
```

---

## Quick Start

```python
from linalgkit_lab2 import (
    check_vector_space,
    check_matrix_space,
    check_subspace,
    find_basis,
    find_norm,
    find_dimension,
    verify_rank_nullity,
    print_results,
)

# --- Vector space ---
result = check_vector_space([1, 2], [3, 4], a=2, b=3, zero_vector=[0, 0])
print_results("Vector Space", result)

# --- Matrix space ---
result = check_matrix_space([[1,2],[3,4]], [[5,6],[7,8]], a=2, b=3,
                             zero_matrix=[[0,0],[0,0]])
print_results("Matrix Space", result)

# --- Subspace ---
result = check_subspace([1, 2], [3, 4], a=2, b=3, zero_vector=[0, 0])
print_results("Subspace", result)

# --- Basis ---
basis = find_basis([[1,0,0],[0,1,0],[1,1,0]])
print("Basis:\n", basis)

# --- Norm ---
print("Norm:", find_norm([3, 4]))          # → 5.0

# --- Dimension ---
print("Dim:", find_dimension([[1,0],[0,1],[1,1]]))   # → 2

# --- Rank-nullity ---
print(verify_rank_nullity([[1,2,3],[4,5,6]]))
```

---

## API Reference

### `check_vector_space(v1, v2, a, b, zero_vector) → dict`
Returns a dict mapping each of the **10 standard vector-space axioms** to
`True` / `False`.

### `check_matrix_space(A, B, a, b, zero_matrix) → dict`
Same as above but for 2-D matrices.

### `check_subspace(v1, v2, a, b, zero_vector) → dict`
Checks the **3 subspace conditions** plus an `"Is Subspace"` verdict key.

| Key | What is checked |
|-----|----------------|
| `"Contains zero vector"` | `zero_vector` is all-zeros *and* acts as additive identity |
| `"Closed under addition"` | `v1 + v2` has correct shape, no NaN/Inf |
| `"Closed under scalar multiplication"` | `a*v1`, `b*v2` have correct shape, no NaN/Inf |
| `"Is Subspace"` | All three above pass |

### `find_basis(vectors) → ndarray`
Greedy basis extraction. `vectors` is a 2-D array whose **rows** are vectors.

### `find_norm(vector) → float`
Euclidean (L2) norm of a 1-D vector.

### `find_dimension(vectors) → int`
Dimension of the span of the given row vectors (= matrix rank).

### `verify_rank_nullity(matrix) → dict`
Returns `{"rank", "nullity", "n_columns", "theorem_holds"}`.

### `print_results(label, results)`
Pretty-prints any result dict from the functions above.

---

## Error Handling

All functions raise:
- `TypeError` — non-numeric inputs or non-real scalars
- `ValueError` — wrong dimensionality, empty inputs, shape mismatches, NaN/Inf values

---

## License

MIT © manohar100323
