1function V = GB_spec_vdiag (A, k, vtype)
2%GB_SPEC_VDIAG a MATLAB mimic of GxB_Vector_diag
3%
4% Usage:
5% V = GB_spec_vdiag (A, k, vtype)
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
14A = GB_spec_matrix (A) ;
15if (nargin < 2)
16    k = 0 ;
17end
18if (nargin < 3)
19    vtype = A.class ;
20end
21
22%-------------------------------------------------------------------------------
23% v = diag (A,k)
24%-------------------------------------------------------------------------------
25
26V.matrix  = diag (A.matrix, k) ;
27V.pattern = diag (A.pattern, k) ;
28V.class = vtype ;
29
30