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
|
//------------------------------------------------------------------------------
// GB_subassign_04: C(I,J) += A ; using S
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2025, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//------------------------------------------------------------------------------
// Method 04: C(I,J) += A ; using S
// M: NULL
// Mask_comp: false
// C_replace: false
// accum: present
// A: matrix
// S: constructed
// C: not bitmap: use GB_bitmap_assign instead
// A: any sparsity structure.
#include "assign/GB_subassign_methods.h"
#include "jitifyer/GB_stringify.h"
#define GB_FREE_ALL GB_Matrix_free (&S) ;
GrB_Info GB_subassign_04
(
GrB_Matrix C,
// input:
#define C_replace false
const void *I, // I index list
const bool I_is_32,
const int64_t ni,
const int64_t nI,
const int Ikind,
const int64_t Icolon [3],
const void *J, // J index list
const bool J_is_32,
const int64_t nj,
const int64_t nJ,
const int Jkind,
const int64_t Jcolon [3],
#define M NULL
#define Mask_comp false
#define Mask_struct true
const GrB_BinaryOp accum,
const GrB_Matrix A,
#define scalar NULL
#define scalar_type NULL
#define assign_kind GB_SUBASSIGN
GB_Werk Werk
)
{
//--------------------------------------------------------------------------
// check inputs
//--------------------------------------------------------------------------
GrB_Info info ;
GrB_Matrix S = NULL ;
ASSERT (!GB_IS_BITMAP (C)) ;
ASSERT (!GB_any_aliased (C, A)) ; // NO ALIAS of C==A
GB_UNJUMBLE (A) ;
//--------------------------------------------------------------------------
// S = C(I,J)
//--------------------------------------------------------------------------
struct GB_Matrix_opaque S_header ;
GB_CLEAR_MATRIX_HEADER (S, &S_header) ;
GB_OK (GB_subassign_symbolic (S, C, I, I_is_32, ni, J, J_is_32, nj, true,
Werk)) ;
//--------------------------------------------------------------------------
// via the JIT or PreJIT kernel
//--------------------------------------------------------------------------
info = GB_subassign_jit (C,
/* C_replace: */ false,
I, I_is_32, ni, nI, Ikind, Icolon,
J, J_is_32, nj, nJ, Jkind, Jcolon,
/* M: */ NULL,
/* Mask_comp: */ false,
/* Mask_struct: */ true,
accum,
A,
/* scalar, scalar_type: */ NULL, NULL,
S,
GB_SUBASSIGN, GB_JIT_KERNEL_SUBASSIGN_04, "subassign_04",
Werk) ;
if (info != GrB_NO_VALUE)
{
GB_FREE_ALL ;
return (info) ;
}
//--------------------------------------------------------------------------
// via the generic kernel
//--------------------------------------------------------------------------
GB_IDECL (I, const, u) ; GB_IPTR (I, I_is_32) ;
GB_IDECL (J, const, u) ; GB_IPTR (J, J_is_32) ;
GBURBLE ("(generic assign) ") ;
#define GB_GENERIC
#define GB_SCALAR_ASSIGN 0
#include "assign/include/GB_assign_shared_definitions.h"
#include "assign/template/GB_subassign_04_template.c"
}
|