1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) INRIA
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 b=%s_l_r(a,b)
14    // a\b a scalar matrix, b rational matrix
15    //!
16    if  size(a,"*")==0  then b=[],return,end
17    if size(a,1)==-1 then a=a+0,end
18
19    [ma,na]=size(a);
20    if ma==1&na==1 then
21        b.num=a\b.num,
22    elseif size(b.num,1)==1 then
23        b=rlist(a\b.num,ones(na,ma)*b.den,b.dt)
24    else
25        [num,den]=b(["num","den"]);
26
27        dd=[];nn=[]
28        for j=1:size(num,2)
29            [y,fact]=lcm(den(:,j)),
30            nn=[nn,a\(num(:,j).*fact)];
31            dd=[dd y]
32        end
33        [num,den]=simp(nn,ones(na,1)*dd)
34        b=rlist(num,den,b.dt)
35    end
36endfunction
37