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
|
//------------------------------------------------------------------------------
// GB_red: hard-coded functions for reductions
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2025, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//------------------------------------------------------------------------------
#include "GB_control.h"
GB_type_enabled
#if GB_TYPE_ENABLED
#include "GB.h"
#include "FactoryKernels/GB_red__include.h"
// reduction operator and type:
GB_update_op
GB_add_op
GB_geta_and_update
// A matrix (no typecasting to Z type here)
GB_atype
GB_declarea
GB_geta
// monoid properties:
GB_ztype
GB_declare_identity
GB_declare_const_identity
GB_is_any_monoid
GB_monoid_is_terminal
GB_terminal_condition
GB_if_terminal_break
GB_declare_const_terminal
// panel size
GB_panel
// disable this operator and use the generic case if these conditions hold
GB_disable
#include "monoid/include/GB_monoid_shared_definitions.h"
//------------------------------------------------------------------------------
// reduce to a non-iso matrix to scalar, for monoids only
//------------------------------------------------------------------------------
GrB_Info GB (_red)
(
GB_Z_TYPE *result,
const GrB_Matrix A,
GB_void *restrict W_space,
bool *restrict F,
int ntasks,
int nthreads
)
{
#if GB_DISABLE
return (GrB_NO_VALUE) ;
#else
GB_Z_TYPE z = (*result) ;
GB_Z_TYPE *restrict W = (GB_Z_TYPE *) W_space ;
if (A->nzombies > 0 || GB_IS_BITMAP (A))
{
#include "reduce/template/GB_reduce_to_scalar_template.c"
}
else
{
#include "reduce/template/GB_reduce_panel.c"
}
(*result) = z ;
return (GrB_SUCCESS) ;
#endif
}
#else
GB_EMPTY_PLACEHOLDER
#endif
|