1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) INRIA - Serge Steer , F.D
3//
4// Copyright (C) 2012 - 2016 - Scilab Enterprises
5//
6// This file is hereby licensed under the terms of the GNU GPL v2.0,
7// pursuant to article 5.3.4 of the CeCILL v.2.1.
8// This file was originally licensed under the terms of the CeCILL v2.1,
9// and continues to be available under such terms.
10// For more information, see the COPYING file which you should have received
11// along with this program.
12
13function s=%lss_m_s(s1,D2)
14    // s=s1*gain
15    // SISO case FD
16    [A1,B1,C1,D1,x1,dom1]=s1(2:7);
17    [n2,m2]=size(D2);
18    if prod(size(s1))==1 then
19        if n2==1 then
20            D=D1*D2; [A1,B1*D2];
21            s=tlist(["lss","A","B","C","D","X0","dt"],A1,B1*D2,C1,D,x1,dom1);
22            return;
23        end
24        if m2==1 then
25            s=tlist(["lss","A","B","C","D","X0","dt"],A1,B1,D2*C1,D2*D1,x1,dom1);
26            return;
27        end
28        [Q,M]=fullrf(D2);[n2,mq]=size(Q);
29        if mq==1 then
30            s=Q*tlist(["lss","A","B","C","D","X0","dt"],A1,B1*M,C1,D1*M,x1,dom1);
31            return;
32        end
33        w=s1;
34        for k=2:mq, w=blockdiag(w,s1);end
35        s=w*M;s=Q*s;
36        return;
37    end
38    D=D1*D2;
39    s=tlist(["lss","A","B","C","D","X0","dt"],A1,B1*D2,C1,D,x1,dom1);
40endfunction
41