1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C)  2016 - INRIA - Serge Steer
3//
4// This file is licensed under the terms of the GNU GPL v2.0,
5// pursuant to article 5.3.4 of the CeCILL v.2.1.
6// For more information, see the COPYING file which you should have received
7// along with this program.
8function r=%zpk_a_zpk(a,b)
9    //r=a+b
10    if a.dt<>b.dt then
11        error(msprintf(_("%s: time domains are not compatible.\n"),"[a,b]"))
12    end
13
14    [ma,na]=size(a)
15    [mb,nb]=size(b)
16    if ma*na==1 then
17        r=b;
18        for i=1:mb
19            for j=1:nb
20                r(i,j)=%zpk_sum([a,b(i,j)])
21            end
22        end
23    elseif mb*nb==1 then
24        r=a
25        for i=1:mb
26            for j=1:nb
27                r(i,j)=%zpk_sum([a(i,j),b])
28            end
29        end
30    else
31        if ma<>mb|na<>nb  then
32            error(_("Inconsistent row/column dimensions.\n"))
33        end
34        r=a
35        for i=1:mb
36            for j=1:nb
37                r(i,j)=%zpk_sum([a(i,j),b(i,j)])
38            end
39        end
40    end
41endfunction
42