1function U = triu (G, k) 2%TRIU upper triangular part of a matrix. 3% U = triu (G) returns the upper triangular part of G. 4% 5% U = triu (G,k) returns the entries on and above the kth diagonal of X, 6% where k=0 is the main diagonal. 7% 8% See also GrB/tril. 9 10% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 11% SPDX-License-Identifier: GPL-3.0-or-later 12 13if (isobject (G)) 14 G = G.opaque ; 15end 16 17if (nargin < 2) 18 k = 0 ; 19else 20 k = gb_get_scalar (k) ; 21end 22 23U = GrB (gbselect ('triu', G, k)) ; 24 25