File: test03.m

package info (click to toggle)
suitesparse-graphblas 7.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 67,112 kB
  • sloc: ansic: 1,072,243; cpp: 8,081; sh: 512; makefile: 506; asm: 369; python: 125; awk: 10
file content (63 lines) | stat: -rw-r--r-- 1,756 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
function test03
%TEST03 test GB_*_check functions

% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
% SPDX-License-Identifier: Apache-2.0

[~, ~, ~, types, ~, ~] = GB_spec_opsall ;
types = types.all ;

rng ('default') ;

for k = 1:length (types)
    aclass = types {k} ;
    for is_hyper = 0:1
        for is_csc = 0:1
            A = GB_spec_random (10,30,0.2,100,aclass, is_csc, is_hyper) ;
            C = GB_mex_dump (A,2) ;
            GB_spec_compare (C, A) ;
        end
    end
    for hyper_switch = -0.1:0.1:0.4
        A = GB_spec_random (10,30,0.02,100,aclass, is_csc, [ ], hyper_switch) ;
        C = GB_mex_dump (A,2) ;
        GB_spec_compare (C, A) ;
    end
end

for is_hyper = 0:1
    for is_csc = 0:1
        A = GB_spec_random (100,2,0.5,100,'int8', is_csc, is_hyper) ;
        C = GB_mex_dump (A,2) ;
        GB_spec_compare (C, A) ;
    end
end

for k = [false true]
    fprintf ('builtin_complex: %d\n', k) ;
    GB_builtin_complex_set (k) ;

    % complex case:
    A = GB_mex_random (10, 30, 15, 1, 1, 0, 0, 0) ;
    C = GB_mex_dump (A,2) ;
    GB_spec_compare (C, A) ;
    A = GB_mex_random (10, 30, 15, 1, 1, 0, 0, 1) ;
    C = GB_mex_dump (A,2) ;
    GB_spec_compare (C, A) ;
    A = GB_mex_random (10, 30, 15, 1, 1, 1, 0, 1) ;
    C = GB_mex_dump (A,2) ;
    GB_spec_compare (C, A) ;
    A = GB_mex_random (10, 30, 15, 1, 1, 1, 0, 0) ;
    C = GB_mex_dump (A,2) ;
    GB_spec_compare (C, A) ;
    A = GB_mex_random (10, 30, 15, 1, 1, 1, 1, 1) ;
    C = GB_mex_dump (A,2) ;
    GB_spec_compare (C, A) ;
    A = GB_mex_random (3, 3, 5, 0, 1, 1, 1, 3) 
    C = GB_mex_dump (A)
    GB_spec_compare (C, A) ;
end

GB_builtin_complex_set (true) ;
fprintf ('\ntest03: all object check tests passed\n') ;