1function C = gb_minbycol (op, A) 2%GB_MINBYCOL min, by column 3% Implements C = min (A, [ ], 1) 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, [ ], 1) reduces each col to a scalar; C is 1-by-n 9desc.in0 = 'transpose' ; 10C = gbvreduce (op, A, desc) ; 11 12% if C(j) > 0, but if A(:,j) is sparse, then assign C(j) = 0. 13ctype = gbtype (C) ; 14 15 % d (j) = number of entries in A(:,j); d (j) not present if A(:,j) empty 16 [m, n] = gbsize (A) ; 17 d = gbdegree (A, 'col') ; 18 % d (j) is an explicit zero if A(:,j) has 1 to m-1 entries 19 d = gbselect (d, '<', m) ; 20 zero = gbnew (0, ctype) ; 21 if (gbnvals (d) == n) 22 % all columns A(:,j) have between 1 and m-1 entries 23 C = gbapply2 (op, C, zero) ; 24 else 25 d = gbapply2 (['1st.' ctype], zero, d) ; 26 % if d (j) is between 1 and m-1 and C (j) > 0 then C (j) = 0 27 C = gbeadd (op, C, d) ; 28 end 29 30C = gbtrans (C) ; 31 32