1function C = sprandsym (arg1, arg2) 2%SPRANDSYM random symmetric matrix. 3% C = sprandsym (A) is a symmetric random matrix. Its lower triangle and 4% diagonal have the same pattern as tril (A). The values of C have a 5% normal distribution. A must be square. This usage is the same as 6% C = GrB.random (A, 'symmetric', 'normal'). 7% 8% C = sprandsym (n,d) is an n-by-n symmetric random matrix with about n*n*d 9% entries, with a normal distribution. If d == inf, C is full. To use 10% this function instead of the built-in MATLAB sprandsym, use 11% C = sprandsym (n,GrB(d)), or C = GrB.random (n,d,'symmetric','normal'). 12% 13% For additional options, see GrB.random. 14% The C = sprandsym (n,d,rc) syntax is not supported. 15% C is returned as a double GraphBLAS matrix. 16% 17% Example: 18% 19% A = sprand (1000, 1000, 0.5) ; 20% G = GrB (A) ; 21% C0 = sprandsym (A) ; % the built-in sprandsym 22% C1 = sprandsym (G) ; % GrB/sprandsym 23% 24% See also GrB/sprand, GrB/sprandn, GrB.random. 25 26% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 27% SPDX-License-Identifier: GPL-3.0-or-later 28 29if (nargin == 1) 30 % C = sprandsym (G) 31 G = arg1.opaque ; 32 C = GrB (gb_random (G, 'symmetric', 'normal')) ; 33else 34 % C = sprandsym (n, d) 35 n = gb_get_scalar (arg1) ; 36 d = gb_get_scalar (arg2) ; 37 C = GrB (gb_random (n, d, 'symmetric', 'normal')) ; 38end 39 40