1function Mask = GB_spec_getmask (Mask, Mask_struct)
2%GB_SPEC_GETMASK return the mask, typecasted to logical
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7if (isstruct (Mask))
8    if (Mask_struct && isfield (Mask, 'pattern'))
9        Mask = Mask.pattern ;
10    else
11        Mask = Mask.matrix ;
12    end
13end
14
15if (Mask_struct)
16    if (issparse (Mask))
17        Mask = GB_spones_mex (Mask) ;
18    else
19        Mask = true (size (Mask)) ;
20    end
21end
22
23Mask = GB_mex_cast (full (Mask), 'logical') ;
24