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
|
//------------------------------------------------------------------------------
// GB_add_bitmap_template: C=A+B, C<#M>=A+B, C bitmap
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2025, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//------------------------------------------------------------------------------
// C is bitmap. The mask M can have any sparsity structure, and is efficient
// to apply (all methods are asymptotically optimal). All cases (no M, M, !M)
// are handled. The values of A, B, and C are not accessed if C is iso, in
// which case GB_ISO_ADD is #defined by the #including file.
{
// TODO: the input C can be modified in-place, if it is also bitmap
int64_t cnvals = 0 ;
#ifdef GB_JIT_KERNEL
{
#if GB_NO_MASK
{
// M is not present.
// A or B is bitmap (or both). Neither A nor B are full.
#include "template/GB_add_bitmap_noM.c"
}
#elif (GB_M_IS_SPARSE || GB_M_IS_HYPER)
{
// M is sparse/hyper and complemented, value/structural.
// A and B can have any format, except at least one is bitmap/full.
#include "template/GB_add_bitmap_M_sparse.c"
}
#else
{
// M is bitmap/full, complemented or not, and valued/structural.
// A and B have any sparsity format but at least one is bitmap/full.
#include "template/GB_add_bitmap_M_bitmap.c"
}
#endif
}
#else
{
if (M == NULL)
{
// M is not present.
// A or B is bitmap (or both). Neither A nor B are full.
#include "template/GB_add_bitmap_noM.c"
}
else if (M_is_sparse_or_hyper)
{
// M is sparse/hyper and complemented, value/structural.
// A and B can have any format, except at least one is bitmap/full.
#include "template/GB_add_bitmap_M_sparse.c"
}
else
{
// M is bitmap/full, complemented or not, and valued/structural.
// A and B have any sparsity format but at least one is bitmap/full.
#include "template/GB_add_bitmap_M_bitmap.c"
}
}
#endif
C->nvals = cnvals ;
}
|