Mentions légales du service

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

Minor change.

Simplify the way the acess to constants in ConstraintName is made.
parent 5b0123c1
No related branches found
No related tags found
Loading
...@@ -26,44 +26,44 @@ classdef ConstraintName ...@@ -26,44 +26,44 @@ classdef ConstraintName
end end
function is_int = is_int_constraint(obj) function is_int = is_int_constraint(obj)
import matfaust.ConstraintName %import matfaust.ConstraintName
is_int = obj.name == ConstraintName.SP || obj.name == ConstraintName.SPLIN || obj.name == ConstraintName.SPCOL ... % use obj instead of ConstraintName to avoid to import the class
|| obj.name == ConstraintName.SP_POS || obj.name == ConstraintName.SPLINCOL; % obj has access to static attributes of its class
% (doing the same for is_real_constraint(), is_mat_constraint(), conv2str())
is_int = obj.name == obj.SP || obj.name == obj.SPLIN || obj.name == obj.SPCOL ...
|| obj.name == obj.SP_POS || obj.name == obj.SPLINCOL;
% BLKDIAG is a int constraint according to what faust_ConstraintGeneric.cpp indicates % BLKDIAG is a int constraint according to what faust_ConstraintGeneric.cpp indicates
end end
function is_real = is_real_constraint(obj) function is_real = is_real_constraint(obj)
import matfaust.ConstraintName is_real = obj.name == obj.NORMCOL || obj.name == obj.NORMLIN;
is_real = obj.name == ConstraintName.NORMCOL || obj.name == ConstraintName.NORMLIN;
end end
function is_mat = is_mat_constraint(obj) function is_mat = is_mat_constraint(obj)
import matfaust.ConstraintName is_mat = obj.name == obj.SUPP || obj.name == obj.CONST;
is_mat = obj.name == ConstraintName.SUPP || obj.name == ConstraintName.CONST;
end end
function str = conv2str (obj) function str = conv2str (obj)
import matfaust.ConstraintName
switch obj.name switch obj.name
case ConstraintName.SP case obj.SP
str = 'sp'; str = 'sp';
case ConstraintName.SPLIN; case obj.SPLIN;
str = 'splin'; str = 'splin';
case ConstraintName.SPCOL; case obj.SPCOL;
str = 'spcol'; str = 'spcol';
case ConstraintName.SPLINCOL; case obj.SPLINCOL;
str = 'splincol'; str = 'splincol';
case ConstraintName.SP_POS; case obj.SP_POS;
str = 'sppos'; str = 'sppos';
case ConstraintName.NORMCOL; case obj.NORMCOL;
str = 'normcol'; str = 'normcol';
case ConstraintName.NORMLIN; case obj.NORMLIN;
str = 'normlin'; str = 'normlin';
case ConstraintName.SUPP; case obj.SUPP;
str = 'supp'; str = 'supp';
case ConstraintName.CONST; case obj.CONST;
str = 'const'; str = 'const';
%case ConstraintName.BLKDIAG; %case obj.BLKDIAG;
% str = 'blkdiag' % str = 'blkdiag'
otherwise otherwise
error('Unknown name') error('Unknown name')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment