Mentions légales du service

Skip to content
Snippets Groups Projects
Commit baeac4a3 authored by hhakim's avatar hhakim
Browse files

Fix matfaust.Faust.factors when the factor is a single (precision) sparse matrix.

>> factors(matfaust.rand(10, 10, 'class', 'single'), 1)
Error using mexFaustRealFloat
newMxGetData: the mex matrix must be float as the ptr is.

Error in matfaust.Faust/call_mex (line 4795)
                                                [varargout{1:nargout}] =
                                                mexFaustRealFloat(func_name,
                                                F.matrix.objectHandle, varargin{:});

Error in matfaust.Faust/factors (line 2460)
                                factors{j} = call_mex(F, 'factors', i);
parent acddaccb
Branches
Tags
No related merge requests found
...@@ -394,7 +394,7 @@ mxArray* transformFact2SparseMxArray(faust_unsigned_int id, Faust::TransformHelp ...@@ -394,7 +394,7 @@ mxArray* transformFact2SparseMxArray(faust_unsigned_int id, Faust::TransformHelp
mwIndex* jc = mxGetJc(sparseMat); mwIndex* jc = mxGetJc(sparseMat);
// std::cout << "transformFact2SparseMxArray()" << std::endl; // std::cout << "transformFact2SparseMxArray()" << std::endl;
// FPP* pr = static_cast<FPP*>(mxGetDoubles(sparseMat)); //given up because fails to compile with template FPP // FPP* pr = static_cast<FPP*>(mxGetDoubles(sparseMat)); //given up because fails to compile with template FPP
float* pr; double* pr; // matlab doesn't support single sparse matrix, so we convert the Faust::MatSparse<float> to double buffer
#ifdef MX_HAS_INTERLEAVED_COMPLEX #ifdef MX_HAS_INTERLEAVED_COMPLEX
newMxGetData(pr, sparseMat); newMxGetData(pr, sparseMat);
#else #else
...@@ -438,6 +438,7 @@ mxArray* transformFact2SparseMxArray(faust_unsigned_int id, Faust::TransformHelp ...@@ -438,6 +438,7 @@ mxArray* transformFact2SparseMxArray(faust_unsigned_int id, Faust::TransformHelp
free(i_jc); free(i_jc);
return sparseMat; return sparseMat;
} }
template<typename FPP, FDevice DEV> template<typename FPP, FDevice DEV>
mxArray* transformFact2SparseMxArray(faust_unsigned_int id, Faust::TransformHelper<FPP, DEV>* core_ptr) mxArray* transformFact2SparseMxArray(faust_unsigned_int id, Faust::TransformHelper<FPP, DEV>* core_ptr)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment