1function C = spones (G, type) 2%SPONES return pattern of a sparse matrix. 3% C = spones (G) returns a matrix C with the same pattern as G, but with 4% all entries set to 1. The behavior of spones (G) for a GrB matrix 5% differs from spones (A) for a MATLAB matrix A. An explicit entry 6% G(i,j) that has a value of zero is converted to the explicit entry 7% C(i,j)=1. Explicit zero entries never appear in a MATLAB sparse 8% matrix. 9% 10% C = spones (G) returns C as the same type as G if G is real. 11% If G is complex, C has the underlying real type of G ('single' if 12% G is 'single complex', or 'double' if G is 'double complex'). 13% 14% C = spones (G,type) returns C in the requested type ('double', 15% 'single', 'int8', ...). For example, use C = spones (G, 'logical') to 16% return the pattern of G as a sparse logical matrix. 17% 18% See also GrB/spfun, GrB.apply. 19 20% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 21% SPDX-License-Identifier: GPL-3.0-or-later 22 23G = G.opaque ; 24if (nargin == 1) 25 C = GrB (gb_spones (G)) ; 26else 27 C = GrB (gb_spones (G, type)) ; 28end 29 30