FAµST (Flexible Approximate MUlti-layer Sparse Transforms)  3.38.14
Functions
pyfaust.tools Namespace Reference

The pyfaust tools module. More...

Functions

def omp (y, D, maxiter=None, tol=0, relerr=True, verbose=False)
 Runs the greedy OMP algorithm optimized by Cholesky decomposition. More...
 

Detailed Description

The pyfaust tools module.

Function Documentation

◆ omp()

def pyfaust.tools.omp (   y,
  D,
  maxiter = None,
  tol = 0,
  relerr = True,
  verbose = False 
)

Runs the greedy OMP algorithm optimized by Cholesky decomposition.

Parameters
ythe vector to approximate by D@x.
Dthe dictionary as a numpy array or a Faust.
maxiterthe maximum number of iterations of the algorithm. By default (None) it's y's dimension: max(y.shape).
tolthe tolerance error to reach for the algorithm to stop. By default, it's zero for not stopping on error criterion.
relerrthe type of error stopping criterion. Default to True to use relative error, otherwise (False) the absolute error is used.
verboseto enable the verbosity (value to True).
Returns
x the solution of y = D@x (according to the error).

Examples

>>> from pyfaust.tools import omp
>>> from scipy.sparse import random
>>> from pyfaust import rand, seed
>>> import numpy as np
>>> np.random.seed(42) # just for reproducibility
>>> seed(42)
>>> D = rand(1024, 1024)
>>> x0 = random(1024, 1, .01)
>>> y = D @ x0
>>> maxiter = 17
>>> x = omp(y, D, maxiter, tol=10**-16)

Stopping. Exact signal representation found!

>>> # omp() runs at most maxiter iterations until the error tolerance is
>>> # reached
pyfaust.tools
The pyfaust tools module.
Definition: tools.py:1
pyfaust.seed
def seed(s)
(Re)Initializes the pyfaust pseudo-random generator.
Definition: __init__.py:5032
pyfaust.rand
def rand(num_rows, num_cols, num_factors=None, dim_sizes=None, density=None, fac_type='sparse', per_row=True, dev='cpu', dtype='float64', field=None, seed=0)
Generates a random Faust.
Definition: __init__.py:4725
pyfaust.tools.omp
def omp(y, D, maxiter=None, tol=0, relerr=True, verbose=False)
Runs the greedy OMP algorithm optimized by Cholesky decomposition.
Definition: tools.py:97