File: GB_add_bitmap_M_bitmap.c

package info (click to toggle)
suitesparse 1%3A7.10.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 254,920 kB
  • sloc: ansic: 1,134,743; cpp: 46,133; makefile: 4,875; fortran: 2,087; java: 1,826; sh: 996; ruby: 725; python: 495; asm: 371; sed: 166; awk: 44
file content (118 lines) | stat: -rw-r--r-- 4,754 bytes parent folder | download | duplicates (2)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//------------------------------------------------------------------------------
// GB_add_bitmap_M_bitmap: C<#M>=A+B, C bitmap, M bitmap/full
//------------------------------------------------------------------------------

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

//------------------------------------------------------------------------------

// C is bitmap.
// M is bitmap or full, complemented or not, and either value or structural.
// A and B have any sparsity format but at least one is bitmap or full.

{

    //----------------------------------------------------------------------
    // C is bitmap; M is bitmap or full
    //----------------------------------------------------------------------

    //      ------------------------------------------
    //      C      <M> =        A       +       B
    //      ------------------------------------------
    //      bitmap  bitmap      sparse          bitmap
    //      bitmap  bitmap      sparse          full  
    //      bitmap  bitmap      bitmap          sparse
    //      bitmap  bitmap      bitmap          bitmap
    //      bitmap  bitmap      bitmap          full  
    //      bitmap  bitmap      full            sparse
    //      bitmap  bitmap      full            bitmap
    //      bitmap  bitmap      full            full  

    //      ------------------------------------------
    //      C      <M> =        A       +       B
    //      ------------------------------------------
    //      bitmap  full        sparse          bitmap
    //      bitmap  full        sparse          full  
    //      bitmap  full        bitmap          sparse
    //      bitmap  full        bitmap          bitmap
    //      bitmap  full        bitmap          full  
    //      bitmap  full        full            sparse
    //      bitmap  full        full            bitmap
    //      bitmap  full        full            full  

    //      ------------------------------------------
    //      C     <!M> =        A       +       B
    //      ------------------------------------------
    //      bitmap  bitmap      sparse          sparse
    //      bitmap  bitmap      sparse          bitmap
    //      bitmap  bitmap      sparse          full  
    //      bitmap  bitmap      bitmap          sparse
    //      bitmap  bitmap      bitmap          bitmap
    //      bitmap  bitmap      bitmap          full  
    //      bitmap  bitmap      full            sparse
    //      bitmap  bitmap      full            bitmap
    //      bitmap  bitmap      full            full  

    //      ------------------------------------------
    //      C     <!M> =        A       +       B
    //      ------------------------------------------
    //      bitmap  full        sparse          sparse
    //      bitmap  full        sparse          bitmap
    //      bitmap  full        sparse          full  
    //      bitmap  full        bitmap          sparse
    //      bitmap  full        bitmap          bitmap
    //      bitmap  full        bitmap          full  
    //      bitmap  full        full            sparse
    //      bitmap  full        full            bitmap
    //      bitmap  full        full            full  


    ASSERT (GB_IS_BITMAP (M) || GB_IS_FULL (M)) ;
    ASSERT (A_is_bitmap || A_is_full || B_is_bitmap || B_is_full) ;

    #undef  GB_GET_MIJ     
    #define GB_GET_MIJ(p)                                       \
        bool mij = GBb_M (Mb, p) && GB_MCAST (Mx, p, msize) ;   \
        if (Mask_comp) mij = !mij ;

    #ifdef GB_JIT_KERNEL
    {
        #if (GB_A_IS_BITMAP || GB_A_IS_FULL) && (GB_B_IS_BITMAP || GB_B_IS_FULL)
        {
            // A and B are both bitmap/full
            #include "template/GB_add_bitmap_M_bitmap_27.c"
        }
        #elif (GB_A_IS_BITMAP || GB_A_IS_FULL)
        {
            // A is bitmap/full, B is sparse/hyper
            #include "template/GB_add_bitmap_M_bitmap_28.c"
        }
        #else
        {
            // A is sparse/hyper, B is bitmap/full
            #include "template/GB_add_bitmap_M_bitmap_29.c"
        }
        #endif
    }
    #else
    { 
        if ((A_is_bitmap || A_is_full) && (B_is_bitmap || B_is_full))
        { 
            // A and B are both bitmap/full
            #include "template/GB_add_bitmap_M_bitmap_27.c"
        }
        else if (A_is_bitmap || A_is_full)
        { 
            // A is bitmap/full, B is sparse/hyper
            #include "template/GB_add_bitmap_M_bitmap_28.c"
        }
        else
        { 
            // A is sparse/hyper, B is bitmap/full
            #include "template/GB_add_bitmap_M_bitmap_29.c"
        }
    }
    #endif
}