Mentions légales du service

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

Add in matfaust projector functors (sp, splin,...) as defined already for pyfaust.

parent ac2d6b21
Branches
Tags
No related merge requests found
...@@ -8,9 +8,12 @@ classdef ConstraintMat < matfaust.factparams.ConstraintGeneric ...@@ -8,9 +8,12 @@ classdef ConstraintMat < matfaust.factparams.ConstraintGeneric
methods methods
function constraint = ConstraintMat(name, param, varargin) function constraint = ConstraintMat(name, param, varargin)
% check param is a mat % check param is a mat
if(~ ismatrix(param) || ~ isnumeric(param)) if(~ ismatrix(param) || ~ isnumeric(param) && ~ islogical(param))
error('ConstraintMat must receive a matrix as param argument.') error('ConstraintMat must receive a matrix as param argument.')
end end
if(islogical(param))
param = real(param)
end
constraint = constraint@matfaust.factparams.ConstraintGeneric(name, size(param, 1), size(param, 2), param, varargin{:}); constraint = constraint@matfaust.factparams.ConstraintGeneric(name, size(param, 1), size(param, 2), param, varargin{:});
if(~ isa(constraint.name, 'matfaust.factparams.ConstraintName') || ~ constraint.name.is_mat_constraint()) if(~ isa(constraint.name, 'matfaust.factparams.ConstraintName') || ~ constraint.name.is_mat_constraint())
error('ConstraintMat first argument must be a ConstraintName with a matrix type name.') error('ConstraintMat first argument must be a ConstraintName with a matrix type name.')
......
classdef const < matfaust.factparams.proj_gen
properties
end
methods
function proj = const(C, varargin)
import matfaust.factparams.ConstraintMat
shape = size(C);
proj.constraint = ConstraintMat('const', C, varargin{:});
end
end
end
classdef normcol < matfaust.factparams.proj_gen
properties
end
methods
function proj = normcol(shape, normval, varargin)
import matfaust.factparams.ConstraintReal
proj.constraint = ConstraintReal('normcol', shape(1), shape(2), normval, varargin{:});
end
end
end
classdef sp < matfaust.factparams.proj_gen
properties
end
methods
function proj = sp(shape, k, varargin)
import matfaust.factparams.ConstraintInt
% default values
proj.constraint = ConstraintInt('sp', shape(1), shape(2), k, varargin{:});
end
end
end
classdef spcol < matfaust.factparams.proj_gen
properties
end
methods
function proj = spcol(shape, k, varargin)
import matfaust.factparams.ConstraintInt
proj.constraint = ConstraintInt('spcol', shape(1), shape(2), k, varargin{:});
end
end
end
classdef splin < matfaust.factparams.proj_gen
properties
end
methods
function proj = splin(shape, k, varargin)
import matfaust.factparams.ConstraintInt
proj.constraint = ConstraintInt('splin', shape(1), shape(2), k, varargin{:});
end
end
end
classdef supp < matfaust.factparams.proj_gen
properties
end
methods
function proj = supp(S, varargin)
import matfaust.factparams.ConstraintMat
proj.constraint = ConstraintMat('supp', S, varargin{:});
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment