1function C = eadd (arg1, arg2, arg3, arg4, arg5, arg6, arg7)
2%GRB.EADD sparse matrix addition.
3%
4%   C = GrB.eadd (op, A, B)
5%   C = GrB.eadd (op, A, B, desc)
6%   C = GrB.eadd (Cin, accum, op, A, B, desc)
7%   C = GrB.eadd (Cin, M, op, A, B, desc)
8%   C = GrB.eadd (Cin, M, accum, op, A, B, desc)
9%
10% GrB.eadd computes the element-wise 'addition' T=A+B.  The result T has
11% the pattern of the union of A and B. The operator is used where A(i,j)
12% and B(i,j) are present.  Otherwise the entries in A and B are copied
13% directly into T:
14%
15%   if (A(i,j) and B(i,j) is present)
16%       T(i,j) = op (A(i,j), B(i,j))
17%   elseif (A(i,j) is present but B(i,j) is not)
18%       T(i,j) = A(i,j)
19%   elseif (B(i,j) is present but A(i,j) is not)
20%       T(i,j) = B(i,j)
21%
22% T is then accumulated into C via C<#M,replace> = accum (C,T).
23%
24% Cin, M, accum, and the descriptor desc are the same as all other
25% GrB.methods; see GrB.mxm and GrB.descriptorinfo for more details.  For
26% the binary operator, see GrB.binopinfo.
27%
28% See also GrB.emult.
29
30% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
31% SPDX-License-Identifier: GPL-3.0-or-later
32
33if (isobject (arg1))
34    arg1 = arg1.opaque ;
35end
36
37if (isobject (arg2))
38    arg2 = arg2.opaque ;
39end
40
41if (isobject (arg3))
42    arg3 = arg3.opaque ;
43end
44
45if (nargin > 3 && isobject (arg4))
46    arg4 = arg4.opaque ;
47end
48
49if (nargin > 4 && isobject (arg5))
50    arg5 = arg5.opaque ;
51end
52
53if (nargin > 5 && isobject (arg6))
54    arg6 = arg6.opaque ;
55end
56
57switch (nargin)
58    case 3
59        [C, k] = gbeadd (arg1, arg2, arg3) ;
60    case 4
61        [C, k] = gbeadd (arg1, arg2, arg3, arg4) ;
62    case 5
63        [C, k] = gbeadd (arg1, arg2, arg3, arg4, arg5) ;
64    case 6
65        [C, k] = gbeadd (arg1, arg2, arg3, arg4, arg5, arg6) ;
66    case 7
67        [C, k] = gbeadd (arg1, arg2, arg3, arg4, arg5, arg6, arg7) ;
68end
69
70if (k == 0)
71    C = GrB (C) ;
72end
73
74