1function C = GB_spec_mdiag (v, k, ctype) 2%GB_SPEC_MDIAG a MATLAB mimic of GxB_Matrix_diag 3% 4% Usage: 5% C = GB_spec_mdiag (v, k, ctype) 6 7% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 8% SPDX-License-Identifier: Apache-2.0 9 10%------------------------------------------------------------------------------- 11% get inputs 12%------------------------------------------------------------------------------- 13 14v = GB_spec_matrix (v) ; 15if (nargin < 2) 16 k = 0 ; 17end 18if (nargin < 3) 19 ctype = v.class ; 20end 21 22%------------------------------------------------------------------------------- 23% C = diag (v,k) 24%------------------------------------------------------------------------------- 25 26C.matrix = diag (v.matrix, k) ; 27C.pattern = diag (v.pattern, k) ; 28C.class = ctype ; 29 30