File: test88.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 (34 lines) | stat: -rw-r--r-- 952 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
function test88
%TEST88 test hypersparse matrices with hash-based method

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

rng ('default') ;
d.axb = 'hash' ;
semiring.multiply = 'times' ;
semiring.class = 'double' ;
semiring.add = 'plus' ;

for n = [10 100 200 300 1000]
    
    for trials = 1:100

        A = GB_spec_random (n, n, 0.001, 1, 'double', true, true, 0.001) ;
        B = GB_spec_random (n, n, 0.001, 1, 'double', true, true, 0.001) ;
        S = sparse (n,n) ;

        B.matrix  (1:10,:) = sparse (rand (10,n)) ;
        B.pattern (1:10,:) = sparse (true (10,n)) ;
        B.matrix  (:,10) = sparse (rand (n,1)) ;
        B.pattern (:,10) = sparse (true (n,1)) ;

        C1 = A.matrix * B.matrix ;
        C2 = GB_mex_mxm (S, [ ], [ ], semiring, A, B, d) ;

        assert (isequal_roundoff (C1, C2.matrix)) ;
    end
end

fprintf ('test88: all tests passed\n') ;