1function C = vreduce (arg1, arg2, arg3, arg4, arg5, arg6)
2%GRB.VREDUCE reduce a matrix to a vector.
3%
4%   C = GrB.vreduce (monoid, A)
5%   C = GrB.vreduce (monoid, A, desc)
6%   C = GrB.vreduce (Cin, M, monoid, A)
7%   C = GrB.vreduce (Cin, M, monoid, A, desc)
8%   C = GrB.vreduce (Cin, accum, monoid, A)
9%   C = GrB.vreduce (Cin, accum, monoid, A, desc)
10%   C = GrB.vreduce (Cin, M, accum, monoid, A)
11%   C = GrB.vreduce (Cin, M, accum, monoid, A, desc)
12%
13% The monoid and A arguments are required.  All others are optional.
14%
15%   Monoids for real non-logical types: '+', '*', 'max', 'min', 'any'
16%   For logical: '|', '&', 'xor', 'eq', 'any'
17%   For complex types: '+', '*', 'any'
18%   For integer types: 'bitor', 'bitand', 'bitxor', 'bitxnor'
19%
20% See 'help GrB.monoidinfo' for more details on the available monoids.
21%
22% By default, each row of A is reduced to a scalar.  If Cin is not present,
23% C (i) = reduce (A (i,:)).  In this case, Cin and C are column vectors of
24% size m-by-1, where A is m-by-n.  If desc.in0 is 'transpose', then A.' is
25% reduced to a column vector; C (j) = reduce (A (:,j)).  In this case, Cin
26% and C are column vectors of size n-by-1, if A is m-by-n.
27%
28% See also GrB.reduce, GrB/sum, GrB/prod, GrB/max, GrB/min.
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 (nargin > 2 && 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
53switch (nargin)
54    case 2
55        [C, k] = gbvreduce (arg1, arg2) ;
56    case 3
57        [C, k] = gbvreduce (arg1, arg2, arg3) ;
58    case 4
59        [C, k] = gbvreduce (arg1, arg2, arg3, arg4) ;
60    case 5
61        [C, k] = gbvreduce (arg1, arg2, arg3, arg4, arg5) ;
62    case 6
63        [C, k] = gbvreduce (arg1, arg2, arg3, arg4, arg5, arg6) ;
64end
65
66if (k == 0)
67    C = GrB (C) ;
68end
69
70