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
bfd508f4
Commit
bfd508f4
authored
9 years ago
by
Adrien Leman
Committed by
hhakim
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add faust_prox
parent
dedbb1a1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/faust_linear_operator/CPU/faust_prox.h
+4
-1
4 additions, 1 deletion
src/faust_linear_operator/CPU/faust_prox.h
src/faust_linear_operator/CPU/faust_prox.hpp
+14
-14
14 additions, 14 deletions
src/faust_linear_operator/CPU/faust_prox.hpp
with
18 additions
and
15 deletions
src/faust_linear_operator/CPU/faust_prox.h
+
4
−
1
View file @
bfd508f4
...
...
@@ -6,7 +6,10 @@
#include
"faust_exception.h"
#include
"faust_Vect.h"
/** \brief faust_prox.h contains the projection operator: <br>
* PALM relies on projections onto the constraint sets for each factor at each iteration, <br>
* so the projection operator should be simple and easy to compute.
*/
namespace
Faust
{
template
<
typename
FPP
>
...
...
This diff is collapsed.
Click to expand it.
src/faust_linear_operator/CPU/faust_prox.hpp
+
14
−
14
View file @
bfd508f4
...
...
@@ -21,7 +21,7 @@ void Faust::sort_idx(const std::vector<FPP> &v, std::vector<int>& idx, int s)
for
(
int
i
=
0
;
i
<
v
.
size
()
;
i
++
)
vec_pair
[
i
]
=
std
::
make_pair
(
i
,
v
[
i
]);
std
::
partial_sort
(
vec_pair
.
begin
(),
vec_pair
.
begin
()
+
s
,
vec_pair
.
end
(),
partial_sort_comp
<
FPP
>
);
std
::
partial_sort
(
vec_pair
.
begin
(),
vec_pair
.
begin
()
+
s
,
vec_pair
.
end
(),
Faust
::
partial_sort_comp
<
FPP
>
);
idx
.
resize
(
s
);
for
(
int
i
=
0
;
i
<
s
;
i
++
)
idx
[
i
]
=
vec_pair
[
i
].
first
;
...
...
@@ -42,7 +42,7 @@ void Faust::prox_sp(Faust::MatDense<FPP,Cpu> & M,faust_unsigned_int k)
{
const
std
::
vector
<
FPP
>
vec
(
M
.
getData
(),
M
.
getData
()
+
nb_elt_mat
);
std
::
vector
<
int
>
index
;
sort_idx
(
vec
,
index
,
k
);
Faust
::
sort_idx
(
vec
,
index
,
k
);
index
.
erase
(
index
.
begin
()
+
k
,
index
.
end
());
M
.
setZeros
();
...
...
@@ -57,7 +57,7 @@ void Faust::prox_sp(Faust::MatDense<FPP,Cpu> & M,faust_unsigned_int k)
template
<
typename
FPP
>
void
Faust
::
prox_spcol
(
Faust
::
MatDense
<
FPP
,
Cpu
>
&
M
,
faust_unsigned_int
k
)
{
prox_spcol_normfree
(
M
,
k
);
Faust
::
prox_spcol_normfree
(
M
,
k
);
M
.
normalize
();
}
...
...
@@ -81,7 +81,7 @@ void Faust::prox_spcol_normfree(Faust::MatDense<FPP,Cpu> & M,faust_unsigned_int
for
(
int
j
=
0
;
j
<
dim2
;
j
++
)
{
mat
[
j
].
assign
(
M
.
getData
()
+
j
*
dim1
,
M
.
getData
()
+
(
j
+
1
)
*
dim1
);
sort_idx
(
mat
[
j
],
index
[
j
],
k
);
Faust
::
sort_idx
(
mat
[
j
],
index
[
j
],
k
);
index
[
j
].
erase
(
index
[
j
].
begin
()
+
k
,
index
[
j
].
end
());
}
M
.
setZeros
();
...
...
@@ -98,7 +98,7 @@ void Faust::prox_spcol_normfree(Faust::MatDense<FPP,Cpu> & M,faust_unsigned_int
template
<
typename
FPP
>
void
Faust
::
prox_splin_normfree
(
Faust
::
MatDense
<
FPP
,
Cpu
>
&
M
,
faust_unsigned_int
k
)
{
const
faust_unsigned_int
dim1
=
M
.
getNbRow
();
const
faust_unsigned_int
dim1
=
M
.
getNbRow
();
const
faust_unsigned_int
dim2
=
M
.
getNbCol
();
const
faust_unsigned_int
nb_elt_mat
=
dim1
*
dim2
;
if
(
k
<=
0
)
...
...
@@ -113,7 +113,7 @@ void Faust::prox_splin_normfree(Faust::MatDense<FPP,Cpu> & M,faust_unsigned_int
{
for
(
int
j
=
0
;
j
<
dim2
;
j
++
)
mat
[
i
][
j
]
=
M
.
getData
()[
j
*
dim1
+
i
];
sort_idx
(
mat
[
i
],
index
[
i
],
k
);
Faust
::
sort_idx
(
mat
[
i
],
index
[
i
],
k
);
index
[
i
].
erase
(
index
[
i
].
begin
()
+
k
,
index
[
i
].
end
());
}
M
.
setZeros
();
...
...
@@ -129,7 +129,7 @@ void Faust::prox_splin_normfree(Faust::MatDense<FPP,Cpu> & M,faust_unsigned_int
template
<
typename
FPP
>
void
Faust
::
prox_splin
(
Faust
::
MatDense
<
FPP
,
Cpu
>
&
M
,
faust_unsigned_int
k
)
{
prox_splin_normfree
(
M
,
k
);
Faust
::
prox_splin_normfree
(
M
,
k
);
M
.
normalize
();
}
...
...
@@ -142,8 +142,8 @@ void Faust::prox_splincol(Faust::MatDense<FPP,Cpu> &M,faust_unsigned_int k)
Faust
::
MatDense
<
FPP
,
Cpu
>
Msplin
=
M
;
prox_spcol_normfree
(
Mspcol
,
k
);
prox_splin_normfree
(
Msplin
,
k
);
Faust
::
prox_spcol_normfree
(
Mspcol
,
k
);
Faust
::
prox_splin_normfree
(
Msplin
,
k
);
//Msplin.transpose();
//prox_spcol_normfree(Msplin,k);
...
...
@@ -169,7 +169,7 @@ void Faust::prox_normcol(Faust::MatDense<FPP,Cpu> & M,FPP s)
faust_unsigned_int
dim2
=
M
.
getNbCol
();
if
(
s
<
0
)
{
handleError
(
"prox : "
,
"prox_normcol : s < 0 "
);
handleError
(
"prox : "
,
"
Faust::
prox_normcol : s < 0 "
);
}
...
...
@@ -207,7 +207,7 @@ template<typename FPP>
void
Faust
::
prox_normlin
(
Faust
::
MatDense
<
FPP
,
Cpu
>
&
M
,
FPP
s
)
{
M
.
transpose
();
prox_normcol
(
M
,
s
);
Faust
::
prox_normcol
(
M
,
s
);
M
.
transpose
();
}
...
...
@@ -221,7 +221,7 @@ void Faust::prox_sp_pos(Faust::MatDense<FPP,Cpu> & M,faust_unsigned_int k)
if
(
ptr_data
[
i
]
<
0
)
ptr_data
[
i
]
=
0
;
prox_sp
(
M
,
k
);
Faust
::
prox_sp
(
M
,
k
);
}
...
...
@@ -235,7 +235,7 @@ void Faust::prox_blkdiag(Faust::MatDense<FPP,Cpu> & M,int k)
faust_unsigned_int
Msize
=
M
.
getNbRow
();
if
(
Msize
!=
M
.
getNbCol
())
{
handleError
(
"prox : "
,
"prox_blkdiag : input matrix must be square"
);
handleError
(
"prox : "
,
"
Faust::
prox_blkdiag : input matrix must be square"
);
}
int
sizeblock
=
Msize
/
k
;
...
...
@@ -274,7 +274,7 @@ void Faust::prox_supp(Faust::MatDense<FPP,Cpu> & M,const Faust::MatDense<FPP,Cpu
{
if
(
(
supp
.
getNbRow
()
!=
M
.
getNbRow
())
||
(
supp
.
getNbCol
()
!=
M
.
getNbCol
())
)
{
handleError
(
"prox : "
,
"prox_supp : dimensions of the matrix are not equal"
);
handleError
(
"prox : "
,
"
Faust::
prox_supp : dimensions of the matrix are not equal"
);
}
M
.
scalarMultiply
(
supp
);
M
.
normalize
();
...
...
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