Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlx_lstsq-0.1.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlx_lstsq-0.1.0-cp314-cp314-macosx_26_0_arm64.whl (103.8 kB view details)

Uploaded CPython 3.14macOS 26.0+ ARM64

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

Hashes for mlx_lstsq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 be5ef28b08e693592ea913911d6fd3d4438489c7fecde7159ff6c484fdcd565f
MD5 6148d358222b3fe1d25b0016b2220f56
BLAKE2b-256 8bb3271ac6b103568021307d3cbf1ca63311d31dc22507ac8e35b3e2012a465f

See more details on using hashes here.

File details

Details for the file mlx_lstsq-0.1.0-cp314-cp314-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for mlx_lstsq-0.1.0-cp314-cp314-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 57a54536d0e58c364473b4f178a0c29608047532b56ee0d8942b42135fc3f30f
MD5 5ac5bcedeeb9f9b6505e34dd61d22a89
BLAKE2b-256 5d10435a3450ac3364dd1b83e0eeb40426d6e8f3993a8e84f9a6674fedabe1ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page