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
6f9b5fc5
Commit
6f9b5fc5
authored
5 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Update matfaust.eye and its mex code to bind them to the new C++ core impl. of Faust eye.
parent
3b840f47
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wrapper/matlab/+matfaust/eye.m
+16
-3
16 additions, 3 deletions
wrapper/matlab/+matfaust/eye.m
wrapper/matlab/src/mexFaust.cpp.in
+25
-5
25 additions, 5 deletions
wrapper/matlab/src/mexFaust.cpp.in
with
41 additions
and
8 deletions
wrapper/matlab/+matfaust/eye.m
+
16
−
3
View file @
6f9b5fc5
...
...
@@ -16,6 +16,7 @@
%>
%>Faust size 4x4, density 0.25, nnz_sum 4, 1 factor(s):
%>- FACTOR 0 (real) SPARSE, size 4x4, density 0.25, nnz 4
%>identity matrix flag
%>
%>>> full(matfaust.eye(4))
%>
...
...
@@ -99,9 +100,13 @@ function F = eye(varargin)
if
(
nargin
~=
1
&&
~
isnumeric
(
la
)
&&
(
ischar
(
la
)
||
ischar
(
cell2mat
(
la
))))
% F = Faust(sparse(1:m, 1:n, 1+eps(1)*j)); % hack to avoid passing through a full matrix
if
(
strcmp
(
la
,
'complex'
))
F
=
Faust
(
eye
(
m
,
n
,
'like'
,
sparse
(
1
,
1
,
1
+
i
)));
% F = Faust(eye(m,n,'like', sparse(1,1,1+i)));
core_obj
=
mexFaustCplx
(
'eye'
,
m
,
n
);
is_real
=
false
;
elseif
(
strcmp
(
la
,
'real'
))
F
=
Faust
(
speye
(
m
,
n
));
% F = Faust(speye(m,n));
core_obj
=
mexFaustReal
(
'eye'
,
m
,
n
);
is_real
=
true
;
else
if
(
iscell
(
la
))
la
=
cell2mat
(
la
)
...
...
@@ -109,6 +114,14 @@ function F = eye(varargin)
error
([
'Unknown option: '
la
])
end
else
F
=
Faust
(
speye
(
m
,
n
));
% F = Faust(speye(m,n));
core_obj
=
mexFaustReal
(
'eye'
,
m
,
n
);
is_real
=
true
;
end
e
=
MException
(
'FAUST:OOM'
,
'Out of Memory'
);
if
(
core_obj
==
0
)
throw
(
e
)
end
F
=
matfaust
.
Faust
(
core_obj
,
is_real
);
end
This diff is collapsed.
Click to expand it.
wrapper/matlab/src/mexFaust.cpp.in
+
25
−
5
View file @
6f9b5fc5
...
...
@@ -154,9 +154,9 @@ void save(Faust::TransformHelper<SCALAR,Cpu>* core_ptr, int nargs, const mxArray
//TODO: hadamard, fourier, and proxs must be in there own mex function (one for hadamard and fourier, another for the prox)
if(!strcmp("hadamard", cmd)){
if(nlhs!=1)
mexErrMsgTxt("
hadamard(): 1 variable result is expected
.");
mexErrMsgTxt("
mex wht(): too many left hand side variables
.");
if(nrhs < 3)
mexErrMsgTxt("
hadamard
(): wrong number of arguments (must be
2
)");
mexErrMsgTxt("
mex wht
(): wrong number of arguments (must be
3
)");
unsigned int n = (unsigned int) mxGetScalar(prhs[1]);
bool norma = (bool) mxGetScalar(prhs[2]);
...
...
@@ -174,11 +174,12 @@ void save(Faust::TransformHelper<SCALAR,Cpu>* core_ptr, int nargs, const mxArray
}
if(!strcmp("fourier", cmd)){
if(!strcmp("fourier", cmd))
{
if(nlhs!=1)
mexErrMsgTxt("
fourier(): 1 variable result is expected
.");
mexErrMsgTxt("
mex dft(): too many left hand side variables
.");
if(nrhs < 3)
mexErrMsgTxt("
fourier
(): wrong number of arguments (must be
2
)");
mexErrMsgTxt("
mex dft
(): wrong number of arguments (must be
3
)");
unsigned int n = (unsigned int) mxGetScalar(prhs[1]);
bool norma = (bool) mxGetScalar(prhs[2]);
...
...
@@ -196,6 +197,25 @@ void save(Faust::TransformHelper<SCALAR,Cpu>* core_ptr, int nargs, const mxArray
}
if(!strcmp("eye", cmd))
{
if(nlhs != 1)
mexErrMsgTxt("eye(): too many left hand side variables.");
unsigned int n, m;
n = mxGetScalar(prhs[1]);
m = mxGetScalar(prhs[2]);
Faust::TransformHelper<SCALAR,Cpu>* eye = Faust::TransformHelper<SCALAR,Cpu>::eyeFaust(n, m);
if(eye) // not NULL
plhs[0] = convertPtr2Mat<Faust::TransformHelper<SCALAR,Cpu>>(eye);
else
{
plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL);
double* ptr_out = (double*) mxGetData(plhs[0]);
ptr_out[0]=(double) 0;
}
return;
}
if(!strcmp("prox", cmd))
{
if(nlhs!=1)
...
...
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