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
dafc37f4
Commit
dafc37f4
authored
4 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Document matfaust.fact.butterfly and add dir='left'|'right' argument.
parent
9aab054f
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
wrapper/matlab/+matfaust/+fact/butterfly.m
+35
-9
35 additions, 9 deletions
wrapper/matlab/+matfaust/+fact/butterfly.m
wrapper/matlab/src/mexButterfly.cpp.in
+6
-4
6 additions, 4 deletions
wrapper/matlab/src/mexButterfly.cpp.in
with
41 additions
and
13 deletions
wrapper/matlab/+matfaust/+fact/butterfly.m
+
35
−
9
View file @
dafc37f4
% experimental block start
%==========================================================================
%> @brief Factorizes the matrix M according to the butterfly support.
%> @brief Factorizes the matrix M according to a butterfly support.
%>
%> @param 'dir', str: the direction of factorization 'right'ward or 'left'ward
%> (more precisely: at each stage of the factorization the most right factor or
%> the most left factor is split in two).
%>
%> @retval F the Faust which is an approximate of M according to a butterfly support.
%==========================================================================
function
F
=
butterfly
(
M
)
import
matfaust
.
Faust
if
(
isreal
(
M
))
core_obj
=
mexButterflyReal
(
M
);
else
core_obj
=
mexButterflyCplx
(
M
);
end
F
=
Faust
(
core_obj
,
isreal
(
M
));
function
F
=
butterfly
(
M
,
varargin
)
import
matfaust
.
Faust
nargin
=
length
(
varargin
);
dir
=
'right'
;
if
(
nargin
>
0
)
for
i
=
1
:
nargin
switch
(
varargin
{
i
})
case
'dir'
if
(
nargin
<
i
+
1
||
~
any
(
strcmp
(
varargin
{
i
+
1
},
{
'right'
,
'left'
})))
error
(
'keyword argument
''
dir
''
must be followed by
''
left
''
or
''
right
''
'
)
else
dir
=
varargin
{
i
+
1
};
end
end
end
end
if
(
strcmp
(
dir
,
'right'
))
dir
=
1
;
elseif
(
strcmp
(
dir
,
'left'
))
dir
=
0
;
end
if
(
isreal
(
M
))
core_obj
=
mexButterflyReal
(
M
,
dir
);
else
core_obj
=
mexButterflyCplx
(
M
,
dir
);
end
F
=
Faust
(
core_obj
,
isreal
(
M
));
end
% experimental block end
This diff is collapsed.
Click to expand it.
wrapper/matlab/src/mexButterfly.cpp.in
+
6
−
4
View file @
dafc37f4
...
...
@@ -72,16 +72,18 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
if (nrhs < 1)
{
mexErrMsgTxt("Bad Number of inputs arguments (must be 1)");
mexErrMsgTxt("Bad Number of inputs arguments (must be
at least
1)");
}
try
{
ButterflyFactDir dir = RIGHT;
if(nrhs >= 2)
dir = static_cast<ButterflyFactDir>(static_cast<int>(mxGetScalar(prhs[1])));
TransformHelper<SCALAR, Cpu>* F = nullptr;
Faust::MatDense<SCALAR,Cpu> matrix;
mxArray2FaustMat(prhs[0],matrix);
mxArray2FaustMat(prhs[0],
matrix);
F = Faust::butterfly_hierarchical(matrix);
F->display();
F = Faust::butterfly_hierarchical(matrix, dir);
plhs[0] = convertPtr2Mat<Faust::TransformHelper<SCALAR, Cpu>>(F);
}
catch (const std::exception& e)
...
...
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