Skip to main content

Lazylinop

License Downloads Downloads PyPI version

Lazylinop is a python toolbox to ease and accelerate computations with ("matrix-free") linear operators. It provides glue to combine linear operators as easily as NumPy arrays, PyTorch/CuPy compatibility, standard signal/image processing linear operators, as well as advanced tools to approximate large matrices by efficient butterfly operators.

A LazyLinOp is a high-level linear operator based on an arbitrary underlying implementation, such as:

- custom Python functions,
- a [NumPy array](https://numpy.org/doc/stable/reference/generated/numpy.array.html),
- a [SciPy matrix](https://docs.scipy.org/doc/scipy/reference/sparse.html),
- a [CuPy array](https://docs.cupy.dev/en/stable/reference/generated/cupy.array.html),
- a [torch tensor](https://docs.pytorch.org/docs/stable/tensors.html),
- a [Faust](https://faustgrp.gitlabpages.inria.fr/faust/last-doc/html/classpyfaust_1_1Faust.html) object,
- any Python linear operator.

Thanks to the Lazylinop API, this operator can be easily manipulated, transformed or aggregated with other linear operators to form more complex LazyLinOp objects. Thus, many operations are available such as the addition, concatenation, adjoint etc. These operations are all ruled by the lazy paradigm: their evaluation is delayed until the resulting LazyLinOp is actually applied to a vector (or to a collection of vectors, seen as a matrix).

Get started with lazylinop

Run the following command to install the lazylinop package from PyPI:

pip install lazylinop

Run the following commands to install from conda:

conda config --add channels conda-forge
conda config --add channels lazylinop
conda install lazylinop

First steps

Build 2D FFT from 1D FFT and Kronecker product:

from lazylinop.signal import fft
from lazylinop.basicops import kron
fft2d = kron(fft(N), fft(N))
x = np.random.randn(fft2d.shape[1])
y = fft2d @ x

Build circular convolution from 1D FFT:

from lazylinop.signal import fft
from lazylinop.basicops import diag
DFT = fft(N) * np.sqrt(N)
D = diag(DFT @ filter, k=0)
L = (DFT / N).H @ D @ DFT

Authors

  • Pascal Carrivain
  • Simon Delamare
  • Hakim Hadj-Djilani
  • Remi Gribonval

Contribute to lazylinop

You can contribute to lazylinop with bug report, feature request and merge request.

Useful links

Running unit tests

    cd tests
    python3 -m unittest TestLazyLinOp.py
    python3 -m unittest TestSignal.py

Release files for lazylinop 1.24.19

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

Built distribution (wheel)

Table of built distributions (wheels) for lazylinop 1.24.19
File Interpreter ABI Platform
lazylinop-1.24.19-py3-none-any.whl Python 3 none any Details

Release files / lazylinop-1.24.19-py3-none-any.whl

Download URL lazylinop-1.24.19-py3-none-any.whl
Size 340.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3c161f7fa088645e57145e879c8478b626506aaecdb12e4b8a34aeab14f81a2
BLAKE2b-256 checksum
How to use checksums
dc23f0c4bb624b1b7cd98aaec6b7455b0a5c9b47135822e4cb256c38b9b32cca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

1.24.19 This release

1 release file

1.24.11

1 release file

1.24.7

1 release file

1.24.3

1 release file

1.24.0

1 release file

1.23.6

1 release file

1.23.1

1 release file

1.23.0

1 release file

1.20.3

1 release file

1.20.2

1 release file

1.20.1

1 release file

1.20

1 release file

1.18.3

1 release file

1.18.2

1 release file

1.18.1

1 release file

1.18.0

1 release file

1.17.0

1 release file

1.16.5

1 release file

1.16.4

1 release file

1.16.3

1 release file

1.16.2

1 release file

1.16.1

1 release file

1.16.0

1 release file

1.15.0

1 release file

1.14.1

1 release file

1.14.0

1 release file

1.13.1

1 release file

1.13.0

1 release file

1.12.0

1 release file

1.11.1

1 release file

1.11.0

1 release file

1.10.0

1 release file

1.9.1

1 release file

1.9.0

1 release file

1.8.0

1 release file

1.7.1

1 release file

1.7.0

1 release file

1.6.1

1 release file

1.6.0

1 release file

1.4.0

1 release file

1.3.2

1 release file

1.3.0

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.29

1 release file

1.0.28

1 release file

1.0.27

1 release file

1.0.26

1 release file

1.0.25

1 release file

1.0.24

1 release file

1.0.23

1 release file

1.0.22

1 release file

1.0.21

1 release file

1.0.20

1 release file

1.0.19

1 release file

1.0.18

1 release file

1.0.17

1 release file

1.0.16

1 release file

1.0.15

1 release file

1.0.14

1 release file

1.0.13

1 release file

1.0.12

1 release file

1.0.11

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

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