Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
faust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.4.
Show more breadcrumbs
faust group
faust
Commits
8ef8ef37
Commit
8ef8ef37
authored
2 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Review/Validate with doctest all examples of pyfaust.tools.
parent
fdec065d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wrapper/python/pyfaust/tools.py
+12
-2
12 additions, 2 deletions
wrapper/python/pyfaust/tools.py
with
12 additions
and
2 deletions
wrapper/python/pyfaust/tools.py
+
12
−
2
View file @
8ef8ef37
...
...
@@ -20,7 +20,7 @@ def omp(y, D, maxiter=None, tol=0, relerr=True, verbose=False):
D: the dictionary as a numpy array or a Faust.
maxiter: the maximum number of iterations of the algorithm.
By default (None) it
'
s y
'
s dimension: max(y.shape).
tol: the tolerance error
under what
the algorithm stop
s
. By default,
tol: the tolerance error
to reach for
the algorithm
to
stop. By default,
it
'
s zero for not stopping on error criterion.
relerr: the type of error stopping criterion. Default to
True to use relative error, otherwise (False) the absolute error is used.
...
...
@@ -31,10 +31,20 @@ def omp(y, D, maxiter=None, tol=0, relerr=True, verbose=False):
Example:
>>>
from
pyfaust.tools
import
omp
>>>
# generate yours y and D and maxiter then call 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
"""
from
pyfaust
import
Faust
# check y is a numpy.ndarray (or a matrix_csr ?)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment