1function Mask = GB_random_mask (m, n, d, M_is_csc, M_is_hyper)
2% Mask = GB_random_mask (m, n, d, M_is_csc, M_is_hyper)
3%
4% Construct a random matrix, either as a matrix or a struct
5% With 3 arguments, Mask is a sparse logical matrix.
6% With 4, Mask is a struct.
7
8% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
9% SPDX-License-Identifier: Apache-2.0
10
11M = (sprand (m, n, d) ~= 0) ;
12
13if (nargin < 4)
14    Mask = M ;
15else
16    Mask.matrix   = M ;
17    Mask.is_csc   = M_is_csc ;
18    Mask.is_hyper = M_is_hyper ;
19end
20
21