else
//at leat one matrix is eye*x
if size(szf,"*")>2 | size(szm,"*")>2 then
- error(msprintf(_("%s: Inconsistent addition.\n"), "%p_a_r"))
+ msg = gettext("%s: Eye variable undefined in this context.\n")
+ error(msprintf(msg, "%p_a_r"));
end
if or(szf<0)&or(szm<0) then
[num,den]=simp(num+m.*den,den)
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
-//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2021 - Samuel GOUGEON
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
// along with this program.
function f = %p_s_r(m,f)
- //f= m-f
- //author Serge Steer INRIA
- //!
- [num,den]=f(["num","den"])
- szf=size(den)
- szm=size(m)
-
- if and(szf>=0)&and(szm>=0) then
- if prod(szf)==1&prod(szm)>1 then
- den=den(ones(m))
- szf=szm
- end
-
- if size(szf,"*")>2 then
- num=num(:);den=den(:);m=m(:)
- end
- [num,den]=simp(-num+m.*den,den)
- num=matrix(num,szf)
- den=matrix(den,szf)
- else
- //at leat one matrix is eye*x
- if size(szf,"*")>2 | size(szm,"*")>2 then
- msg = gettext("%s: Eye variable undefined in this context.\n")
- error(msprintf(msg, "%p_s_r"));
- end
- if or(szf<0)&or(szm<0) then
- [num,den]=simp(-num+m.*den,den)
- elseif or(szf<0) then
- [num,den]=simp(-num+m.*den,den*ones(m))
- elseif or(szm<0) then
- [num,den]=simp(-num+(m+0)*eye(den).*den,den)
- end
- end
- f=rlist(num,den,f.dt)
+ f = m + (-f)
+ // see %p_a_r()
endfunction
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
-//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2021 - Samuel GOUGEON
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
// For more information, see the COPYING file which you should have received
// along with this program.
-function f=%r_a_p(f,m)
- //f = f+m,
- //f: transfer matrix, m : polynomial matrix
- //author Serge Steer INRIA
- //!
- [num,den]=f(["num","den"])
- szf=size(den)
- szm=size(m)
-
- if and(szf>=0)&and(szm>=0) then
- if prod(szf)==1&prod(szm)>1 then
- den=den(ones(m))
- szf=szm
- end
-
- if size(szf,"*")>2 then
- num=num(:);den=den(:);m=m(:)
- end
- [num,den]=simp(num+m.*den,den)
- num=matrix(num,szf)
- den=matrix(den,szf)
- else
- //at leat one matrix is eye*x
- if size(szf,"*")>2 | size(szm,"*")>2 then
- msg = _("%s: Inconsistent addition.\n")
- error(msprintf(msg, "%r_a_p"))
- end
- if or(szf<0)&or(szm<0) then
- [num,den]=simp(num+m.*den,den)
- elseif or(szf<0) then
- [num,den]=simp(num+m.*den,den*ones(m))
- elseif or(szm<0) then
- [num,den]=simp(num+(m+0)*eye(den).*den,den)
- end
- end
- f=rlist(num,den,f.dt)
-
+function f = %r_a_p(f,m)
+ f = m + f
+ // see %p_a_r()
endfunction
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
-//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2021 - Samuel GOUGEON
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
// along with this program.
function f = %r_s_p(f,m)
- //f = f-m,
- //f: transfer matrix, m : scalar or scalar matrix
- //author Serge Steer INRIA
- //!
- [num,den]=f(["num","den"])
- szf=size(den)
- szm=size(m)
-
- if and(szf>=0)&and(szm>=0) then
- if prod(szf)==1&prod(szm)>1 then
- den=den(ones(m))
- szf=szm
- end
-
- if size(szf,"*")>2 then
- num=num(:);den=den(:);m=m(:)
- end
- [num,den]=simp(num-m.*den,den)
- num=matrix(num,szf)
- den=matrix(den,szf)
- else
- //at leat one matrix is eye*x
- if size(szf,"*")>2 | size(szm,"*")>2 then
- msg = gettext("%s: Eye variable undefined in this context.\n")
- error(msprintf(msg, "%r_s_p"));
- end
- if or(szf<0)&or(szm<0) then
- [num,den]=simp(num-m.*den,den)
- elseif or(szf<0) then
- [num,den]=simp(num-m.*den,den*ones(m))
- elseif or(szm<0) then
- [num,den]=simp(num-(m+0)*eye(den).*den,den)
- end
- end
- f=rlist(num,den,f.dt)
+ f = f + (-m)
+ // see %r_a_p
endfunction
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
-//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2021 - Samuel GOUGEON
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
// For more information, see the COPYING file which you should have received
// along with this program.
-function f1=%r_x_p(f1,f2)
- // %r_x_p(r,p)=r.*p
- //author Serge Steer, INRIA
- //!
- f1.num=f1.num.*f2
- sz=size(f1.num)
- if size(sz,"*")<=2 then
-
- f1=simp(f1)
- else
- [num,den]=simp(f1.num(:),f1.den(:))
- f1.num=matrix(num,sz)
- f1.den=matrix(den,sz)
- end
+function f1 = %r_x_p(f1, f2)
+ // rat .* pol == pol .* rat
+ f1 = %p_x_r(f2, f1)
endfunction