1function test146
2%TEST146 test C<M,struct> = scalar
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7fprintf ('test146 --------------------- C<M,struct> = scalar\n') ;
8
9m = 5 ;
10n = 4 ;
11
12M = logical (sprand (m, n, 0.5)) ;
13
14C1 = GB_mex_expand (M, pi) ;
15C2 = sparse (m, n) ;
16C2 (M) = pi ;
17assert (isequal (C2, C1.matrix))
18
19for k = [false true]
20    GB_builtin_complex_set (k) ;
21    z = 1 + 1i ;
22    C1 = GB_mex_expand (M, z) ;
23    C2 = sparse (m, n) ;
24    C2 (M) = z ;
25    assert (isequal (C2, C1.matrix))
26end
27
28C1 = GB_mex_expand (M, true) ;
29C2 = logical (sparse (m, n)) ;
30C2 (M) = true ;
31assert (isequal (C2, logical (C1.matrix)))
32
33fprintf ('test146: all tests passed\n') ;
34
35