Metadata-Version: 2.4
Name: lazylinop
Version: 1.24.11
Summary: A package dedicated to lazy linear operators based on diverse backends/libraries.
Project-URL: Homepage, https://faustgrp.gitlabpages.inria.fr/lazylinop/
Project-URL: Documentation, https://faustgrp.gitlabpages.inria.fr/lazylinop/api.html
Project-URL: Repository, https://gitlab.inria.fr/faustgrp/lazylinop
Project-URL: Bug Tracker, https://gitlab.inria.fr/faustgrp/lazylinop/-/issues
Author-email: Inria <remi.gribonval@inria.fr>, Pascal Carrivain <pascal.carrivain@inria.fr>, Simon Delamare <simon.delamare@ens-lyon.fr>, Hakim Hadj-Djilani <hakim.hadj-djilani@inria.fr>, Rémi Gribonval <remi.gribonval@inria.fr>
License-Expression: BSD-2-Clause
License-File: AUTHORS.md
License-File: LICENSE.txt
Keywords: butterfly,lazy computation,signal processing
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: array-api-compat>=1.12.0
Requires-Dist: numpy>=2.0
Requires-Dist: scipy>=1.13
Requires-Dist: sympy>=1.14
Description-Content-Type: text/markdown

## Lazylinop

![License](https://img.shields.io/badge/License-BSD_2-blue.svg)
[![Downloads](https://static.pepy.tech/badge/lazylinop)](https://pepy.tech/project/lazylinop)
[![Downloads](https://static.pepy.tech/badge/lazylinop/month)](https://pepy.tech/project/lazylinop)
[![PyPI version](https://badge.fury.io/py/lazylinop.svg)](https://pypi.org/project/lazylinop/)

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:

```bash
pip install lazylinop
```

Run the following commands to install from conda:

```bash
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:

```python3
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:

```python3
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

- Link to the documentation: [Gitlab pages](https://faustgrp.gitlabpages.inria.fr/lazylinop/index.html)

## Running unit tests

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