Skip to main content

LazyMatrix for Python

Center and scale NumPy arrays and SciPy CSR/CSC matrices without constructing a normalized matrix. LazyMatrix owns a copy of the raw input and applies fitted column normalization during products.

import numpy as np
from lazymatrix import standardize

X = np.array([[1.0, 0.0], [2.0, 3.0], [0.0, 4.0]])
Z = standardize(X)
prediction = Z @ np.array([1.0, -1.0])
gradient = Z.T @ prediction
column = Z[:, 0]

Install with pip install lazymatrix. Python 3.11 or newer is required. See the Python guide and API reference.

Z.aslinearoperator() integrates with SciPy's iterative solvers. Z.toarray() explicitly creates a normalized dense array. Other NumPy operations and implicit dense conversion are unsupported in this first release.

Dense inputs require a full raw-data copy. Sparse inputs remain sparse and are copied into canonical CSC storage. Products accept dense vectors and matrices; multiple right-hand sides currently use repeated vector products. All stored values and results use float64. Normalization uses population standard deviations by default; pass df=1 for sample standard deviations. The variance divisor is nrows - df; scales are NaN when nrows <= df. Exact zero scales become one.

For neural first layers, install pip install "lazymatrix[torch]" and use lazymatrix.torch.NormalizedLinear. It accepts supplied centers and scales, including Z.centers and Z.scales, and performs lazy normalization entirely in PyTorch. Weights remain trainable in normalized coordinates. The layer supports dense, sparse COO, and sparse CSR tensors in float32 or float64 on CPU and CUDA. Sparse inputs must not require gradients. PyTorch 2.9 or newer is required and is imported only when the adapter is used. See the PyTorch guide.

From the repository root, use task python:check to build and test the package. This includes the PyTorch adapter and runs CUDA cases when hardware is available. Python and Rust have independent versions and share one release PR.

PyPI trusted publishing must name jolars/lazymatrix, publish-python.yml, and the release environment. The existing Versionary release token must retain permission to create tags that trigger publishing workflows.

Metadata

Release files for lazymatrix 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lazymatrix 0.2.0
File Size Uploaded Provenance Actions
lazymatrix-0.2.0.tar.gz 6.0 MB With provenance Details for lazymatrix-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for lazymatrix 0.2.0
File Actions
lazymatrix-0.2.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for lazymatrix-0.2.0-cp311-abi3-win_amd64.whl
lazymatrix-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for lazymatrix-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lazymatrix-0.2.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for lazymatrix-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
lazymatrix-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for lazymatrix-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 7.3 MB

Release files / lazymatrix-0.2.0.tar.gz

Download URL lazymatrix-0.2.0.tar.gz
Size 6.0 MB
Tags Source
SHA-256 checksum
How to use checksums
d1644d156c6146b7c2066e50208170d1eacc2c195a0c084f431c277b006f5698
BLAKE2b-256 checksum
How to use checksums
b6c77506871ef4c69090c29633dbfbc420cd66765a5cd357fa5560aada1c86de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / lazymatrix-0.2.0-cp311-abi3-win_amd64.whl

Download URL lazymatrix-0.2.0-cp311-abi3-win_amd64.whl
Size 255.2 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
efa52bd37ac40a4b57e4a9105699c686a146961f68ac79751ab83c1ff56c305b
BLAKE2b-256 checksum
How to use checksums
8ab264f70be4bc4bb846c6b442e96e1a88ca9e805308b41100cbe7006d843355
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / lazymatrix-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lazymatrix-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 356.7 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
21daec18616d50fabc167f9b73c37e59163c7e57ed544fe1832e7cf1bbf76ac3
BLAKE2b-256 checksum
How to use checksums
c56f4f5a68b1f8c473cb52cb7b9355dd1bc9b6155f73b2471850b84cb0b67ca0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / lazymatrix-0.2.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL lazymatrix-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
Size 318.4 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d647358cc391a2d9a274c3f8312af576f59500f774cbf58c27b6025125779895
BLAKE2b-256 checksum
How to use checksums
b3320b4a8a492b2aa760e20604d200af8c428b56a94a66697ee79663fe5e266f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / lazymatrix-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL lazymatrix-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 331.1 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8297d015c18b9781f918cf9d53672ab45e86dc605c40bbe3de90e5eaaa6751b6
BLAKE2b-256 checksum
How to use checksums
97576f5aee4c7ddad1a72953b2f1c4f264b9f15b1aad928d9235401c579653e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for lazymatrix 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for lazymatrix-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page