Least-squares solvers for MLX with Apple MPS native extensions.
Project description
mlx-lstsq
mlx-lstsq provides least-squares solvers for MLX backed by custom Apple Metal Performance Shaders kernels.
Requirements
- macOS on Apple Silicon
- Python 3.12 or newer
mlx>=0.31.1- Xcode command line tools
Installation
pip install mlx-lstsq
The package contains a compiled extension module plus companion .dylib and .metallib assets, so installation happens from a wheel on supported systems or from source with a local toolchain.
Usage
import mlx.core as mx
import mlx_lstsq
A = mx.array([[1.0, 0.0], [1.0, 1.0], [1.0, 2.0]], dtype=mx.float32)
b = mx.array([1.0, 2.0, 2.5], dtype=mx.float32)
x = mlx_lstsq.solve(A, b)
ridge_x = mlx_lstsq.solve_ridge(A, b, 1e-3)
Publishing Checklist
python3 -m pip install --upgrade build twine
python3 -m build
python3 -m twine check dist/*
python3 -m unittest discover -s tests -v
The smoke test installs the wheel from dist/ into a fresh virtual environment and verifies a scalar solve, so it checks the publishable artifact instead of the source tree. Run that check on each supported Python version before publishing.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlx_lstsq-0.1.0.tar.gz.
File metadata
- Download URL: mlx_lstsq-0.1.0.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be5ef28b08e693592ea913911d6fd3d4438489c7fecde7159ff6c484fdcd565f
|
|
| MD5 |
6148d358222b3fe1d25b0016b2220f56
|
|
| BLAKE2b-256 |
8bb3271ac6b103568021307d3cbf1ca63311d31dc22507ac8e35b3e2012a465f
|
File details
Details for the file mlx_lstsq-0.1.0-cp314-cp314-macosx_26_0_arm64.whl.
File metadata
- Download URL: mlx_lstsq-0.1.0-cp314-cp314-macosx_26_0_arm64.whl
- Upload date:
- Size: 103.8 kB
- Tags: CPython 3.14, macOS 26.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57a54536d0e58c364473b4f178a0c29608047532b56ee0d8942b42135fc3f30f
|
|
| MD5 |
5ac5bcedeeb9f9b6505e34dd61d22a89
|
|
| BLAKE2b-256 |
5d10435a3450ac3364dd1b83e0eeb40426d6e8f3993a8e84f9a6674fedabe1ff
|