Mentions légales du service

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

Bind the C++ impl. of Hadamard-Faust into matfaust.FaustFactory.hadamard().

parent 22b99e8a
Branches
Tags
No related merge requests found
...@@ -157,6 +157,18 @@ classdef FaustFactory ...@@ -157,6 +157,18 @@ classdef FaustFactory
F = Faust(core_obj, isreal(M)); F = Faust(core_obj, isreal(M));
end end
function H = hadamard(n)
core_obj = mexFaustReal('hadamard', n);
is_real = true;
% TODO: check n (must be integer > 0)
% TODO: handle errors on returned core_obj
% if(core_obj == 0)
% throw(e)
% end
H = matfaust.Faust(core_obj, is_real);
end
%========================================================================================== %==========================================================================================
%> @brief Generates a random Faust. %> @brief Generates a random Faust.
%> %>
......
...@@ -144,6 +144,28 @@ void save(Faust::TransformHelper<SCALAR,Cpu>* core_ptr, int nargs, const mxArray ...@@ -144,6 +144,28 @@ void save(Faust::TransformHelper<SCALAR,Cpu>* core_ptr, int nargs, const mxArray
} }
if(!strcmp("hadamard", cmd)){
if(nlhs!=1)
mexErrMsgTxt("hadamard(): 1 variable result is expected.");
if(nrhs < 2)
mexErrMsgTxt("hadamard(): wrong number of arguments (must be 2)");
//printf("mexFaust.cpp hadamard(): retrieving arguments\n");
unsigned int n = (unsigned int) mxGetScalar(prhs[1]);
//printf("mexFaust.cpp hadamard(): faust creation\n");
Faust::TransformHelper<SCALAR,Cpu>* H = Faust::TransformHelper<SCALAR,Cpu>::hadamardFaust(n);
H->display();
if(H) //not NULL
plhs[0]=convertPtr2Mat<Faust::TransformHelper<SCALAR,Cpu> >(H);
else {
plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL);
double* ptr_out = (double*) mxGetData(plhs[0]);
ptr_out[0]=(double) 0;
}
return;
}
// New // New
if (!strcmp("new", cmd)) if (!strcmp("new", cmd))
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment