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
Show more breadcrumbs
faust group
faust
Commits
b6b73b2f
Commit
b6b73b2f
authored
1 year ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Add an example for pyfaust hierarchical_py exp code.
parent
28534380
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#851712
passed
1 year ago
Stage: test
Stage: pkg_purepy
Stage: pkg
Stage: code_cov
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wrapper/python/pyfaust/fact.py
+29
-0
29 additions, 0 deletions
wrapper/python/pyfaust/fact.py
with
29 additions
and
0 deletions
wrapper/python/pyfaust/fact.py
+
29
−
0
View file @
b6b73b2f
...
...
@@ -582,6 +582,35 @@ def hierarchical_py(A, J, N, res_proxs, fac_proxs, is_update_way_R2L=False,
Returns:
the Faust resulting from the factorization of A.
Example:
>>>
from
pyfaust.fact
import
hierarchical_py
>>>
from
pyfaust.proj
import
splincol
>>>
from
pyfaust
import
wht
>>>
import
numpy
as
np
>>>
from
numpy.linalg
import
norm
>>>
d
=
32
>>>
dtype
=
'
float32
'
>>>
H
=
wht
(
d
,
normed
=
False
)
>>>
H
=
H
.
toarray
().
astype
(
dtype
)
>>>
n
=
int
(
np
.
log2
(
d
))
>>>
fac_projs
=
[]
>>>
res_projs
=
[]
>>>
for
i
in
range
(
n
-
1
):
res_projs
+=
[
splincol
((
d
,
d
),
int
(
d
/
2
**
(
i
+
1
)),
normalized
=
True
)];
fac_projs
+=
[
splincol
((
d
,
d
),
2
,
normalized
=
True
)]
>>>
HF
=
hierarchical_py
(
H
.
astype
(
dtype
),
n
,
30
,
res_projs
,
fac_projs
,
is_fact_side_left
=
False
,
is_update_way_R2L
=
True
)
hierarchical_py
factor
1
hierarchical_py
factor
2
hierarchical_py
factor
3
hierarchical_py
factor
4
>>>
print
(
HF
)
Faust
size
32
x32
,
density
0.3125
,
nnz_sum
320
,
5
factor
(
s
):
-
FACTOR
0
(
float
)
SPARSE
,
size
32
x32
,
density
0.0625
,
nnz
64
-
FACTOR
1
(
float
)
SPARSE
,
size
32
x32
,
density
0.0625
,
nnz
64
-
FACTOR
2
(
float
)
SPARSE
,
size
32
x32
,
density
0.0625
,
nnz
64
-
FACTOR
3
(
float
)
SPARSE
,
size
32
x32
,
density
0.0625
,
nnz
64
-
FACTOR
4
(
float
)
SPARSE
,
size
32
x32
,
density
0.0625
,
nnz
64
>>>
print
((
HF
-
H
).
norm
()
/
norm
(
H
)
<
1e-6
)
True
:py:func:`.palm4mspalm4msa_py`
"""
S
=
Faust
([
A
],
dev
=
dev
,
dtype
=
A
.
dtype
)
...
...
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