File: GB_AxB_saxpy4_meta.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 (103 lines) | stat: -rw-r--r-- 3,239 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
//------------------------------------------------------------------------------
// GB_AxB_saxpy4_meta: C+=A*B, C is full, A is sparse/hyper, B bitmap/full
//------------------------------------------------------------------------------

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

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

// This method is only used for built-in semirings with no typecasting in
// pre-generated kernels, or JIT kernels.  It is not used for generic methods.

// The accumulator matches the semiring monoid.
// The ANY monoid and non-atomic monoids are not supported.

// C is full.
// M is not present.
// A is sparse or hypersparse.
// B is bitmap or full.

#if GB_IS_ANY_MONOID
#error "saxpy4 not defined for the ANY monoid"
#endif

{

    //--------------------------------------------------------------------------
    // get C, M, A, and B
    //--------------------------------------------------------------------------

    ASSERT (GB_IS_FULL (C)) ;                 // C is always full
    const int64_t cvlen = C->vlen ;
    ASSERT (C->vlen == A->vlen) ;
    ASSERT (C->vdim == B->vdim) ;
    ASSERT (A->vdim == B->vlen) ;

    #if ( !GB_HAS_IDENTITY_BYTE )
    // declare the monoid identity value
    GB_DECLARE_IDENTITY_CONST (zidentity) ;
    #endif

    const int8_t *restrict Bb = B->b ;
    const int64_t bvlen = B->vlen ;
    const int64_t bvdim = B->vdim ;

    #ifdef GB_JIT_KERNEL
    #define B_is_bitmap GB_B_IS_BITMAP
    #define B_iso GB_B_ISO
    #else
    const bool B_is_bitmap = GB_IS_BITMAP (B) ;
    const bool B_iso = B->iso ;
    #endif

    ASSERT (GB_IS_BITMAP (B) || GB_IS_FULL (B)) ;

    GB_Ap_DECLARE (Ap, const) ; GB_Ap_PTR (Ap, A) ;
    GB_Ah_DECLARE (Ah, const) ; GB_Ah_PTR (Ah, A) ;
    GB_Ai_DECLARE (Ai, const) ; GB_Ai_PTR (Ai, A) ;
    const int64_t anvec = A->nvec ;
    const int64_t avlen = A->vlen ;
    const int64_t avdim = A->vdim ;

    #ifdef GB_JIT_KERNEL
    #define A_is_hyper  GB_A_IS_HYPER
    #define A_is_sparse GB_A_IS_SPARSE
    #define A_iso GB_A_ISO
    #else
    const bool A_is_hyper = GB_IS_HYPERSPARSE (A) ;
    const bool A_is_sparse = GB_IS_SPARSE (A) ;
    const bool A_iso = A->iso ;
    #endif

    ASSERT (GB_IS_SPARSE (A) || GB_IS_HYPERSPARSE (A)) ;

    #if !GB_A_IS_PATTERN
    const GB_A_TYPE *restrict Ax = (GB_A_TYPE *) A->x ;
    #endif
    #if !GB_B_IS_PATTERN
    const GB_B_TYPE *restrict Bx = (GB_B_TYPE *) B->x ;
    #endif
          GB_C_TYPE *restrict Cx = (GB_C_TYPE *) C->x ;

    //--------------------------------------------------------------------------
    // C += A*B, no mask, A sparse/hyper, B bitmap/full
    //--------------------------------------------------------------------------

    if (B_is_bitmap)
    { 
        // A is sparse/hyper, B is bitmap, no mask
        #undef  GB_B_IS_BITMAP
        #define GB_B_IS_BITMAP 1
        #include "template/GB_AxB_saxpy4_template.c"
    }
    else
    { 
        // A is sparse/hyper, B is full, no mask
        #undef  GB_B_IS_BITMAP
        #define GB_B_IS_BITMAP 0
        #include "template/GB_AxB_saxpy4_template.c"
    }
    #undef GB_B_IS_BITMAP
}