Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 5f62b8db authored by hhakim's avatar hhakim
Browse files

Minor changes in pyfaust.tools.omp.

parent 449afc4e
No related branches found
No related tags found
No related merge requests found
......@@ -5,12 +5,13 @@
import numpy as np
from scipy.sparse.linalg import spsolve_triangular
from numpy.linalg import solve, lstsq, norm
from numpy.linalg import solve, lstsq
from scipy.sparse import hstack, vstack, csr_matrix
from numpy import concatenate as cat
from numpy import zeros, argmax, empty, ndarray
from pyfaust import Faust
def omp(y, D, maxiter=None, tol=0, relerr=True, verbose=False):
"""
Runs the greedy OMP algorithm optimized by Cholesky decomposition.
......@@ -47,8 +48,8 @@ def omp(y, D, maxiter=None, tol=0, relerr=True, verbose=False):
else:
raise Exception("y must be a vector")
if(Faust.isFaust(D) or isinstance(D, ndarray)):
P = lambda z : D@z
Pt = lambda z : D.T.conj()@z
P = lambda z: D@z
Pt = lambda z: D.T.conj()@z
else:
raise Exception("D must be a Faust or a numpy.ndarray. Here D is "
"a:"+str(type(D)))
......@@ -80,15 +81,15 @@ def omp(y, D, maxiter=None, tol=0, relerr=True, verbose=False):
s = s_initial
R = empty((maxiter+1,maxiter+1)).astype(np.complex)
oldErr = y.T.conj()@y
err_mse = []
# err_mse = []
t=0
t = 0
IN = []
DR = Pt(residual)
done = False
it = 1
MAXITER=n
MAXITER = n
while not done:
......@@ -231,3 +232,6 @@ def UpdateCholeskySparse(R,P,Pt,index,m):
return R
greed_omp_chol = omp
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment