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 f = %r_a_hm(f,m)
14    //f = f+m,
15    //f: transfer matrix, m : hypermatrix
16    //author Serge Steer INRIA
17    //!
18    [num,den]=f(["num","den"])
19    szf = size(den)
20    szm = size(m)
21
22    if and(szf>=0) & and(szm>=0) then
23        num = num(:);
24        den = den(:);
25        m = m(:)
26        if prod(szf)==1 & prod(szm)>1 then
27            den = den(ones(m))
28        end
29        [num,den]=simp(num+m.*den,den)
30        num=matrix(num,szf)
31        den=matrix(den,szf)
32        f=rlist(num,den,f.dt)
33    else
34        msg = _("%s: Implicit size not supported.\n")
35        error(msprintf(msg, "%r_a_hm"))
36    end
37endfunction
38