1function C = gb_minbyrow (op, A) 2%GB_MINBYROW min, by row 3% Implements C = min (A, [ ], 2) 4 5% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 6% SPDX-License-Identifier: GPL-3.0-or-later 7 8% C = min (A, [ ], 2) reduces each row to a scalar; C is m-by-1 9C = gbvreduce (op, A) ; 10 11% if C(i) > 0, but if A(i,:) is sparse, then assign C(i) = 0. 12ctype = gbtype (C) ; 13 14 % d (i) = number of entries in A(i,:); d (i) not present if A(i,:) empty 15 [m, n] = gbsize (A) ; 16 d = gbdegree (A, 'row') ; 17 % d (i) is an explicit zero if A(i,:) has 1 to n-1 entries 18 d = gbselect (d, '<', n) ; 19 zero = gbnew (0, ctype) ; 20 if (gbnvals (d) == m) 21 % all rows A(i,:) have between 1 and n-1 entries 22 C = gbapply2 (op, C, zero) ; 23 else 24 d = gbapply2 (['1st.' ctype], zero, d) ; 25 % if d(i) is between 1 and n-1 and C(i) > 0 then C (i) = 0 26 C = gbeadd (op, C, d) ; 27 end 28 29