linear-operator
A linear operator implementation, primarily designed for finite-dimensional positive definite operators (i.e. kernel matrices).
Decision gist · record as of 2026-08-14
Yes, if you work with large structured matrices in PyTorch and need memory efficiency or computational speed. The low install friction and active maintenance support adoption. However, the pre-alpha status and incomplete feature set (symmetric, generic square, rectangular, and sparse operators not yet implemented) mean you should verify that positive semi-definite and triangular operators cover your use case and accept that the API may change.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >= 3.10 and torch installed.
- Low friction install with only torch and scipy as runtime dependencies.
- Active maintenance with recent releases; currently in pre-alpha (Development Status :: 2 - Pre-Alpha), so expect API changes and incomplete feature coverage.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution with minimal obligations—suitable for both open and proprietary projects.
last release 2026-02-27 (168 days) · last repo commit 2026-06-14 · 126 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,139,454 downloads/mo, #4,309 on PyPI
Alternatives
Verify before relying
pip install linear_operator
from linear_operator.operators import DiagLinearOperator, LowRankRootLinearOperator
import torch
C = torch.randn(1000, 20)
d = torch.randn(1000)
b = torch.randn(1000)
A = LowRankRootLinearOperator(C) + DiagLinearOperator(d)
result = torch.linalg.solve(A, b)- Whether positive semi-definite and triangular operators cover your specific matrix structure needs, given the package's stated beta limitations
- Performance gains on your hardware and matrix sizes relative to dense PyTorch operations
- Stability of the API given pre-alpha status and the incomplete roadmap (symmetric, generic square, rectangular, and sparse operators still pending)
What it is and what it does
LinearOperator is a PyTorch package that lets you define and work with structured matrices—such as low-rank-plus-diagonal or triangular matrices—without explicitly constructing them as dense tensors. Instead of materializing a large matrix in memory, you define it compositionally (e.g., `LowRankRootLinearOperator(C) + DiagLinearOperator(d)`) and LinearOperator automatically routes operations like solves and matrix-vector products through efficient structure-exploiting routines. It depends on torch and scipy and integrates with PyTorch's standard linear algebra API.
The package is currently in beta and supports positive semi-definite and triangular matrices. Its main value is enabling memory-efficient and computationally efficient workflows for large structured matrices—particularly useful in probabilistic modeling and kernel methods—without requiring you to hand-code specialized linear algebra routines. Operations like `torch.linalg.solve(A, b)` work transparently on LinearOperator objects, dispatching to the best available algorithm based on the matrix's declared structure.
Use it for
- Sampling from high-dimensional multivariate Gaussians with structured covariance matrices without materializing the full matrix.
- Solving linear systems with low-rank-plus-diagonal structure efficiently via the Woodbury formula.
- Kernel matrix operations in Gaussian process inference where the kernel matrix is too large to fit in memory.
- Composing multiple structured matrix types and automatically leveraging efficient algorithms for the resulting composite structure.
- Prototyping different structured matrix approximations for a model without rewriting linear algebra code for each variant.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you work with large structured matrices in PyTorch and need memory efficiency or computational speed.
The low install friction and active maintenance support adoption. However, the pre-alpha status and incomplete feature set (symmetric, generic square, rectangular, and sparse operators not yet implemented) mean you should verify that positive semi-definite and triangular operators cover your use case and accept that the API may change.
Install
linear-operator on PyPI
Before you install
Low friction install with only torch and scipy as runtime dependencies. Active maintenance with recent releases; currently in pre-alpha (Development Status :: 2 - Pre-Alpha), so expect API changes and incomplete feature coverage.
Requires Python >= 3.10 and torch installed.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal obligations—suitable for both open and proprietary projects.
Quickstart
pip install linear_operator
from linear_operator.operators import DiagLinearOperator, LowRankRootLinearOperator
import torch
C = torch.randn(1000, 20)
d = torch.randn(1000)
b = torch.randn(1000)
A = LowRankRootLinearOperator(C) + DiagLinearOperator(d)
result = torch.linalg.solve(A, b)
Verify before relying
- Whether positive semi-definite and triangular operators cover your specific matrix structure needs, given the package's stated beta limitations
- Performance gains on your hardware and matrix sizes relative to dense PyTorch operations
- Stability of the API given pre-alpha status and the incomplete roadmap (symmetric, generic square, rectangular, and sparse operators still pending)
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagestorchscipy |
| Maintenance | Actively maintained 168 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,139,454 / month, #4,309 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 2 - Pre-AlphaProgramming Language :: Python :: 3 |
Evidence: linear_operator-0.6.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “structured matrix operations pytorch”
- linear-operatorLinearOperator abstracts structured matrix operations in PyTorch,…
- torch-complexProvides a Python class wrapping real and imaginary PyTorch tensors…
- gram-newton-schulzImplements a hardware-aware Gram Newton-Schulz algorithm for polar…
Give your agent the search over MCP, or paste the wish link into any chat.
More Mathematics packages
NetworkX provides data structures and algorithms for creating, analyzing, and manipulating graphs and networks, supporting everything from simple undirected graphs to complex directed and weighted networks.
kiwisolver is a Python binding to a fast C++ implementation of the Cassowary constraint solver, enabling you to solve systems of linear constraints and inequalities.
Install it if you need to solve constraint systems; skip it if you only need simple linear algebra.
SymPy is a Python library for symbolic mathematics, performing algebraic manipulation, calculus, equation solving, and mathematical expression simplification without numerical approximation.
ContourPy calculates contours of 2D quadrilateral grids using C++11 algorithms wrapped in Python, offering serial and multithreaded implementations without requiring Matplotlib as a dependency.
PyTorch provides GPU-accelerated tensor computation and automatic differentiation for building and training deep neural networks in Python.
onnxruntime loads and executes Open Neural Network Exchange (ONNX) models with a focus on inference performance across CPUs and accelerators.
Install it if you have ONNX models to run in production or development.
See also nvidia-cusolver · blis · nvidia-cusolver-cu12 · lineax · eigenpy · nvidia-cublas · nvidia-cublas-cu12 · xarray-einstats · scikit-fem · tabmat