Metadata-Version: 2.4
Name: abakus
Version: 0.1.0
Summary: Sparse, vectorized algebra over countably infinite bases: symmetric functions, Clifford and Weyl algebras, polynomials, with integer partitions encoded as bit patterns.
Author: Simon Kapfer
License-Expression: MIT
Project-URL: Homepage, https://github.com/SimonKapfer/abakus
Project-URL: Issues, https://github.com/SimonKapfer/abakus/issues
Keywords: algebra,symmetric functions,integer partitions,Clifford algebra,Weyl algebra,Hopf algebra,combinatorics,numba
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Typing :: Typed
Requires-Python: >=3.14
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numba>=0.65.1
Requires-Dist: numpy>=2.4.6
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Dynamic: license-file

# abakus

Sparse, vectorized algebra over countably infinite bases.

Many algebras in mathematics have a countable basis: polynomials in infinitely
many variables, symmetric functions, Clifford and exterior algebras, Weyl
algebras, class algebras of symmetric groups. abakus computes in such algebras
directly in a chosen basis, with numpy arrays and Numba-compiled kernels.

## Ideas

**Vectors and bases.** An element of an algebra is a `Vector`: a finite linear
combination of basis elements, stored as an integer index array and a
coefficient array. A basis is a class that knows what its indices mean. It
defines multiplication, comultiplication and changes of basis on whole arrays
of indices at once. Tensor products, smash products and linear maps are built
uniformly on top of this.

**Countably infinite bases.** Most bases are infinite: all partitions, all
monomials in infinitely many variables. Each vector touches only finitely many
basis elements, and indices grow as needed. Beyond the int64 range, indices
turn into exact Python integers on their own.

**Tensor products** are built uniformly: index rows are placed side by side,
`a @ b` is a⊗b, and Koszul signs appear when two factors are superalgebras.
Smash products such as Weyl algebras are tensor products with a twisted
multiplication.

**Partitions as integers.** An integer partition is encoded by the boundary of
its Ferrers diagram: a step up is a 1 bit, a step right is a 0 bit. The
partition (8, 5, 2, 2) becomes `0b10001000110 == 1094`. Partitions are then
plain integers that can live in numpy arrays. Containment of diagrams implies
`x <= y`. Horizontal and vertical strips, rim hooks, and transposition become
bit operations. So do the Pieri, Littlewood–Richardson and Murnaghan–Nakayama
rules (see [docs/BinaryPartitions.md](https://github.com/SimonKapfer/abakus/blob/master/docs/BinaryPartitions.md)).

## Example

```python
>>> from abakus.symm import s, h, p
>>> s(2, 1) * s(1)              # Littlewood–Richardson rule
s{2,2} + s{3,1} + s{2,1,1}
>>> h(s(2, 1))                  # Jacobi–Trudi
-h{3} + h{2,1}
>>> s(p(3))                     # Murnaghan–Nakayama
s{3} - s{2,1} + s{1,1,1}
>>> s(100) * s(100) == s(h(100, 100))
True

>>> from abakus import bpart
>>> x = bpart.from_lambda([8, 5, 2, 2])
>>> x
1094
>>> bpart.to_lambda(bpart.transpose(x))
[4, 4, 2, 2, 2, 1, 1, 1]

>>> from abakus.clifford import CliffordAlgebraBasis, ExteriorAlgebraBasis as E
>>> C = CliffordAlgebraBasis[3, 0]
>>> C.u * C.v, C.v * C.u, (C.u + C.v) ** 2
(uv, -uv, 2)

>>> from abakus.polynomial import PolynomialBasis
>>> from abakus.weyl import polynomial_weyl_basis
>>> W = polynomial_weyl_basis(PolynomialBasis["x"])
>>> W.dx * W.x
1 + x∂

>>> s(2) @ E.u
s{2}⊗u
```

More in the [tutorial](https://github.com/SimonKapfer/abakus/blob/master/docs/Tutorial.md), in
[docs/SymmetricFunctions.md](https://github.com/SimonKapfer/abakus/blob/master/docs/SymmetricFunctions.md) and in
[docs/TensorProducts.md](https://github.com/SimonKapfer/abakus/blob/master/docs/TensorProducts.md).

## Modules

| Module | Contents |
|---|---|
| `abakus.vector` | `Vector`, `VectorBasis`, tensor products, linear and bilinear maps |
| `abakus.bpart` | integer partitions encoded as ints, scalar and array versions |
| `abakus.polynomial` | (Laurent) polynomials in finitely many variables |
| `abakus.infpoly` | polynomial rings with bases indexed by partitions |
| `abakus.clifford` | Clifford and exterior algebras |
| `abakus.symm` | symmetric functions (e, h, p, m, Schur), class algebras, Ivanov–Kerov algebra |
| `abakus.weyl` | Weyl algebras as smash products |

## Installation

```
pip install abakus
```

Requires Python 3.14 or later, numpy and Numba.

For development:

```
pip install -e ".[dev]"
pytest
```

## License

MIT, see [LICENSE](https://github.com/SimonKapfer/abakus/blob/master/LICENSE).
