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
2db31be7
Commit
2db31be7
authored
3 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Add matfaust mex wrappers bsr_mat_to_sp_mat functions.
There were missing in
c460d7e6
.
parent
68d8961f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wrapper/matlab/src/faust_factors.hpp
+33
-1
33 additions, 1 deletion
wrapper/matlab/src/faust_factors.hpp
with
33 additions
and
1 deletion
wrapper/matlab/src/faust_factors.hpp
+
33
−
1
View file @
2db31be7
#include
"faust2Mx.h"
#include
"class_handle.hpp"
#include
"faust_TransformHelper.h"
/**
* These functions allow to convert a MatBSR factor of a Faust::TransformHelper to MatSparse, as the bsr matrices are not supported in Matlab.
*/
template
<
typename
SCALAR
>
mxArray
*
bsr_mat_to_sp_mat
(
int
id
,
Faust
::
TransformHelper
<
SCALAR
,
Cpu
>*
core_ptr
);
template
<
typename
SCALAR
>
mxArray
*
bsr_mat_to_sp_mat
(
int
id
,
Faust
::
TransformHelper
<
SCALAR
,
GPU2
>*
core_ptr
);
template
<
typename
SCALAR
,
FDevice
DEV
>
void
faust_factors
(
const
mxArray
**
prhs
,
const
int
nrhs
,
mxArray
**
plhs
,
const
int
nlhs
)
{
...
...
@@ -15,9 +25,31 @@ void faust_factors(const mxArray **prhs, const int nrhs, mxArray **plhs, const i
plhs
[
0
]
=
transformFact2SparseMxArray
(
id
,
core_ptr
);
//
// plhs[0] = FaustSpMat2mxArray(*dynamic_cast<const Faust::MatSparse<SCALAR,Cpu>*>(core_ptr->get_gen_fact(id)));
else
else
if
(
core_ptr
->
is_fact_dense
(
id
))
plhs
[
0
]
=
transformFact2FullMxArray
(
id
,
core_ptr
);
// plhs[0] = FaustMat2mxArray(*dynamic_cast<const Faust::MatDense<SCALAR,Cpu>*>(core_ptr->get_gen_fact(id)));
else
if
(
core_ptr
->
is_fact_bsr
(
id
))
{
plhs
[
0
]
=
bsr_mat_to_sp_mat
(
id
,
core_ptr
);
}
else
mexErrMsgTxt
(
"Unhandled type of matrix"
);
}
template
<
typename
SCALAR
>
mxArray
*
bsr_mat_to_sp_mat
(
int
id
,
Faust
::
TransformHelper
<
SCALAR
,
Cpu
>*
core_ptr
)
{
auto
bsr_mat
=
dynamic_cast
<
const
MatBSR
<
SCALAR
,
Cpu
>*>
(
core_ptr
->
get_gen_fact
(
id
));
auto
sp_mat
=
bsr_mat
->
to_sparse
();
return
FaustSpMat2mxArray
(
sp_mat
);
}
#ifdef USE_GPU_MOD
template
<
typename
SCALAR
>
mxArray
*
bsr_mat_to_sp_mat
(
int
id
,
Faust
::
TransformHelper
<
SCALAR
,
GPU2
>*
core_ptr
)
{
//TODO: nothing to do now because MatBSR aren't supported on GPU2, implement it later
return
nullptr
;
}
#endif
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